0 Replies Latest reply on Oct 28, 2010 1:37 AM by aubryvn

    error marshalling arguments when sending message through producer

    aubryvn

      Hi All,

       

      I am running CF9 on my computer and I am trying to send message using StreamingAMF.

      I can send messages directly from a CFM page.

      I can receive messages in a Air app.

       

      But I have this error when I am trying to send a message from a Flex application

       

      [BlazeDS]10/28/2010 10:25:28.428 [ERROR] [Message.General] Exception when invoking service 'message-service': flex.messaging.MessageException: Unable to send message to CF Gateway 'cfgw': error marshalling arguments; nested exception is:

      java.io.NotSerializableException: coldfusion.util.CaseInsensitiveMap$ScopeSet

        incomingMessage: Flex Message (flex.messaging.messages.AsyncMessage)

          clientId = 49AD4ECB-5B09-947F-7A47-BD26EB1A294E

          correlationId =

          destination = ColdFusionGateway

          messageId = CCAC2E81-B1B9-52FC-096B-F1F10E532E62

          timestamp = 1288254328412

          timeToLive = 0

          body = {message=test}

          hdr(User) = TestUser

          hdr(gatewayid) = cfgw

          hdr(DSId) = 49AB5593-6B0F-482D-9E95-885E52C4AD2D

          hdr(DSSubtopic) = test

          hdr(DSEndpoint) = my-streaming-amf

        Exception: flex.messaging.MessageException: Unable to send message to CF Gateway 'cfgw': error marshalling arguments; nested exception is:

      java.io.NotSerializableException: coldfusion.util.CaseInsensitiveMap$ScopeSet

      at coldfusion.flex.CFEventGatewayAdapter.invoke(CFEventGatewayAdapter.java:215)

      at flex.messaging.services.MessageService.serviceMessage(MessageService.java:318)

      at flex.messaging.services.MessageService.serviceMessage(MessageService.java:233)

      at flex.messaging.services.MessageService.serviceMessage(MessageService.java:224)

      at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1400)

      at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:1005)

      at flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBrokerFilter.java:103)

      at flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:158)

      at flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:44)

      at flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFilter.java:67)

      at flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:166)

      at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:291)

      at flex.messaging.endpoints.BaseStreamingHTTPEndpoint.service(BaseStreamingHTTPEndpoint.java :462)

      at coldfusion.flash.messaging.CFStreamingAMFEndPoint.service(CFStreamingAMFEndPoint.java:125 )

      at flex.messaging.MessageBrokerServlet.service(MessageBrokerServlet.java:353)

      at coldfusion.flex.ColdFusionMessageBrokerServlet.service(ColdFusionMessageBrokerServlet.jav a:114)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

      at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)

      at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)

      at coldfusion.filter.FlashRequestControlFilter.doFilter(FlashRequestControlFilter.java:71)

      at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)

      at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)

      at jrun.servlet.FilterChain.service(FilterChain.java:101)

      at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)

      at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)

      at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)

      at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)

      at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)

      at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)

      at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)

      at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)

      at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

      Caused by: java.rmi.MarshalException: error marshalling arguments; nested exception is:

      java.io.NotSerializableException: coldfusion.util.CaseInsensitiveMap$ScopeSet

      at sun.rmi.server.UnicastRef.invoke(Unknown Source)

      at coldfusion.eventgateway.flex.rmi.FlexToCFProxyServer_Stub.sendToCFGateway(Unknown Source)

      at coldfusion.flex.CFEventGatewayAdapter.invoke(CFEventGatewayAdapter.java:209)

      ... 31 more

      Caused by: java.io.NotSerializableException: coldfusion.util.CaseInsensitiveMap$ScopeSet

      at java.io.ObjectOutputStream.writeObject0(Unknown Source)

      at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)

      at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

      at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

      at java.io.ObjectOutputStream.writeObject0(Unknown Source)

      at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)

      at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

      at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

      at java.io.ObjectOutputStream.writeObject0(Unknown Source)

      at java.io.ObjectOutputStream.writeObject(Unknown Source)

      at sun.rmi.server.UnicastRef.marshalValue(Unknown Source)

      ... 34 more

       

       

      Here's some flex code :

       

      <mx:ChannelSet id="channelSet">

           <mx:StreamingAMFChannel url="http://localhost:8500/flex2gateway/cfstreamingamf"/>

      </mx:ChannelSet>

       

       

      <mx:Producer id="prod"

      autoConnect="true"

      subtopic="test"

      channelSet="{channelSet}"

      reconnectAttempts="-1"

      reconnectInterval="1000"

      destination="ColdFusionGateway"

      acknowledge="prod_acknowledgeHandler(event)"

      channelConnect="prod_channelConnectHandler(event)"

      channelDisconnect="prod_channelDisconnectHandler(event)"

      fault="prod_faultHandler(event)"

      channelFault="prod_channelFaultHandler(event)"

      />

       

       

      public function sendMessage(s:String):void

      {

           var msg:AsyncMessage = new AsyncMessage();

           msg.headers.gatewayid  = "cfgw";

       

           msg.body = new Object();

           msg.body.message = "test";

           msg.headers.User = userid;

       

       

           if(!prod.connected){

                prod.connect();

           }

           prod.send(msg);

      }

      I really do not know what can be the cause of this error as I can send message directly from coldfusion.
      Here's my gateway code :
      <cfcomponent output="false">
         <cffunction name="onIncomingMessage" access="remote" returntype="any">
              <cfargument name="event" type="struct" required="true"/>
              <cfset messageBody = arguments.event.data.body> 
              <cfset message = messageBody.message> 
              <cfset msg= structNew()/>
              <cfset msg['destination'] = "ColdFusionGateway"/>
              <cfset msg['body'] = message/>
              <cfset msg['headers']['DSSubtopic'] = event.data.headers.DSSubtopic/>
              <cfset msg['headers']['User'] = event.data.headers.User/>
              <cfset sendGatewayMessage("cfgw",msg)/>
      </cffunction>
         
      <cffunction name="allowSend" access="remote" returntype="boolean">
          <cfargument name="subtopic" type="any" required="true"/>
          <cfreturn true/>
      </cffunction>
          
      <cffunction name="allowSubscribe" access="remote" returntype="boolean">
          <cfargument name="subtopic" type="any" required="true"/>
          <cfreturn true/>
      </cffunction>
         
      </cfcomponent>
      Any kind of help is welcome ;-)
      Thanks.
      Aub