<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    果子的程序人生

    Spring blazeDS Integration destination not exists異常解決

    環境:
    • Spring blazeDS Integration 1.0.0 release
    • blazeDS 3.2.0.3978
    • jdk1.6.0_06
    • flex sdk 3.2.0
    • flex builder 3
    在web.xml中配置DispatcherServlet
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns
    ="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        xsi:schemaLocation
    ="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        id
    ="WebApp_ID" version="2.5">
        
    <display-name>flex_server</display-name>
        
    <context-param>
            
    <param-name>contextConfigLocation</param-name>
            
    <param-value>/WEB-INF/context-*.xml</param-value>
        
    </context-param>
        
    <listener>
            
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        
    </listener>
        
    <servlet>
            
    <servlet-name>flex</servlet-name>
            
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            
    <load-on-startup>1</load-on-startup>
        
    </servlet>
        
    <servlet-mapping>
            
    <servlet-name>flex</servlet-name>
            
    <url-pattern>/messagebroker/*</url-pattern>
        
    </servlet-mapping>
        
    <welcome-file-list>
            
    <welcome-file>index.html</welcome-file>
        
    </welcome-file-list>
    </web-app>

    在flex-servlet.xml中定義destination
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi
    ="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
        xmlns:tx
    ="http://www.springframework.org/schema/tx" xmlns:flex="http://www.springframework.org/schema/flex"
        xsi:schemaLocation
    ="http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-2.5.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
        http://www.springframework.org/schema/flex   
        http://www.springframework.org/schema/flex/spring-flex-1.0.xsd"
    >
        
    <flex:message-broker />
        <!-- premiumService是普通的業務bean -->
        
    <flex:remoting-destination ref="premiumService"/>
    </beans>

    這樣在remoting-config.xml中就不需要定義destination了
    <?xml version="1.0" encoding="UTF-8"?>
    <service id="remoting-service" 
        class
    ="flex.messaging.services.RemotingService">

        
    <adapters>
            
    <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
        
    </adapters>

        
    <default-channels>
            
    <channel ref="my-amf"/>
        
    </default-channels>
        
    <!--注釋掉,否則啟動會報錯或出現其他問題
        <destination id="premiumService">
            <properties>
                <source>org.hag.flex.service.PremiumService</source>
            </properties>
        </destination>
        
    -->
    </service>

    測試
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        creationComplete
    ="premiumService.getPremiumList()">
        
    <mx:Script>
            
    <![CDATA[
                <!-- 省略import -->
                private function resultHandler(evt:ResultHandler):void
                {
                    Alert.show(evt.result.toString());
                }
                private function faultHandler(evt:FaultHandler):void
                {
                    Alert.show(evt.fault.toString());
                }
            
    ]]>
        
    </mx:Script>
        
    <mx:RemoteObject id="premiumService" ref="premiumService"
            result
    ="resultHandler(event)" fault="faultHandler(event)"/>
    </mx:Application>

    結果這時候報錯,destination "premiumService" either does not exists....
    原因是mxml編譯時要根據remoting-config.xml來處理destination的定義,而我們把premiumService定義在了spring bean中,所以它根本就不知道premiumService的存在。取消掉remoting-config.xml的注釋,再次對mxml進行編譯(如修改后保存),在瀏覽器中清除緩存、刷新,OK,結果出來了。

    注意在tomcat啟動時又要把remoting-config.xml定義的destination注釋掉,否則會出問題。或者干脆在其他地方建立一個文件專門用于mxml的編譯。

    posted on 2009-07-04 00:41 果子 閱讀(873) 評論(1)  編輯  收藏 所屬分類: springjavaflex

    評論

    # re: Spring blazeDS Integration destination not exists異常解決 2009-11-12 00:34 hbbbs

    GOOD,我也碰到了這個問題  回復  更多評論   

    導航

    <2009年7月>
    2829301234
    567891011
    12131415161718
    19202122232425
    2627282930311
    2345678

    統計

    常用鏈接

    留言簿(1)

    隨筆分類

    隨筆檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 91亚洲国产在人线播放午夜| 亚洲成人免费在线| 亚洲国产日韩在线成人蜜芽 | 日韩精品亚洲aⅴ在线影院| 精品久久久久国产免费| 少妇无码一区二区三区免费| 久久久久久噜噜精品免费直播| 亚洲丁香婷婷综合久久| 亚洲人成日本在线观看| 久久久久亚洲精品天堂| 亚洲情XO亚洲色XO无码| 久久国产免费直播| 美女视频黄视大全视频免费的| 亚洲人成777在线播放| 亚洲综合一区二区精品导航| 亚洲成AV人片在线观看| AV无码免费永久在线观看| 激情小说亚洲图片| 亚洲欧美国产欧美色欲| 亚洲人成网7777777国产| 亚洲视频在线免费| 1a级毛片免费观看| 美女免费视频一区二区| 老司机亚洲精品影院在线观看| 涩涩色中文综合亚洲| 亚洲AV无码久久| 亚洲精品无码永久中文字幕| 久久亚洲中文字幕精品一区| 免费黄色福利视频| 四虎1515hh永久久免费| 91av视频免费在线观看| 在线看无码的免费网站| 亚洲大片免费观看| 久热中文字幕在线精品免费| AV大片在线无码永久免费| 国产va免费精品观看精品 | 亚洲欧洲日产国码av系列天堂| 国产成人麻豆亚洲综合无码精品| 精品亚洲视频在线观看| 在线精品亚洲一区二区三区| 亚洲人成网77777色在线播放|