Announcement Announcement Module
Collapse
No announcement yet.
Flex 3.2 Spring Blazeds GA1.0 glassfish can not assess remote method Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Flex 3.2 Spring Blazeds GA1.0 glassfish can not assess remote method

    Hi all,

    I am using Spring Blazeds GA1.0 and glassfish application server.

    My web.xml config file is like

    <servlet>
    <servlet-name>MessageBrokerServlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <init-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/web-application-config.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
    <servlet-name>MessageBrokerServlet</servlet-name>
    <url-pattern>/messagebroker/*</url-pattern>
    </servlet-mapping>


    And my web-application-config.xml file is like

    <!-- Bootstraps and exposes the BlazeDS MessageBroker -->
    <flex:message-broker/>

    <bean id="userService" class="com.netop.user.UserDao">
    <flex:remoting-destination/>
    <property name="dataSource" ref="dataSource"/>
    </bean>

    My main application mxml file is like

    private function initApp():void{
    this.remoteObject = new RemoteObject("userService");
    this.remoteObject.showBusyCursor = true;
    //this.remoteObject.endpoint = "http://localhost:8180/netop/messagebroker/amf";
    this.remoteObject.addEventListener(FaultEvent.FAUL T, onFault);
    this.remoteObject.addEventListener(ResultEvent.RES ULT, onResult);
    this.remoteObject.findAllUser("","");
    }

    private function onFault(fault:FaultEvent):void{
    trace(fault.message);
    trace(fault.fault);
    }

    private function onResult(event:ResultEvent):void{
    trace("diu nei");
    }

    And when iI start the glassfish server , the log message like

    資訊: Loading XML bean definitions from ServletContext resource [/WEB-INF/web-application-config.xml]

    資訊: Bean factory for application context [org.springframework.web.context.support.XmlWebAppl icationContext@12f4add]: org.springframework.beans.factory.support.DefaultL istableBeanFactory@1dfb97c
    資訊: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@1dfb97c: defining beans [_messageBrokerHandlerAdapter,_messageBrokerDefault HandlerMapping,_jsonConfigMapEditorConfigurer,_mes sageBrokerMessagingProcessor,_flexRemotingAnnotati onPostProcessor,_messageBrokerRemotingProcessor,or g.springframework.flex.core.ExceptionTranslationAd vice#0,org.springframework.flex.core.EndpointServi ceMessagePointcutAdvisor#0,org.springframework.fle x.core.MessageInterceptionAdvice#0,org.springframe work.flex.core.EndpointServiceMessagePointcutAdvis or#1,_messageBrokerEndpointProcessor,_messageBroke r,org.springframework.flex.remoting.RemotingDestin ationExporter#0,userService,dataSource]; root of factory hierarchy

    資訊: Loading Flex services configuration from: ServletContext resource [/WEB-INF/flex/services-config.xml]
    資訊: Including Flex services configuration from: ServletContext resource [/WEB-INF/flex/remoting-config.xml]
    資訊: Including Flex services configuration from: ServletContext resource [/WEB-INF/flex/proxy-config.xml]
    資訊: Including Flex services configuration from: ServletContext resource [/WEB-INF/flex/messaging-config.xml]

    資訊: BlazeDS - Community Edition: 3.2.0.3978
    資訊: MessageBroker with id '_messageBroker' is starting.

    資訊: MessageBroker with id '_messageBroker' is ready (startup time: '438' ms)


    But the flex debug message show the following

    [RPC Fault faultString="[MessagingError message='Destination 'userService' either does not exist or the destination has no channels defined (and the application does not define any default channels.)']" faultCode="InvokeFailed" faultDetail="Couldn't establish a connection to 'userService'"]

    I have no idea about this

    I have add the services file full path in the compiler arguments
    but cannot use the default remoting channel.
    If I uncomment //this.remoteObject.endpoint = "http://localhost:8180/netop/messagebroker/amf"; this code, I can access the remote method successfully, anyone can tell me what's wrong with my setting.

    Thank you very much~

    Tim Cheung

  • #2
    Looks like you don't have the channel defined as an application wide default in services-config.xml, thus you have to explicitly define it client-side. See here: http://static.springsource.org/sprin...l/ch02s06.html

    Comment

    Working...
    X