JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Use Agile By Default
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile Access more options (Alt+g)
  • Create Issue
  • Mule
  • MULE-6289

Mule Context missing when receiving a message on TCP inbound endpoint

  • Agile Board
  • More Actions
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 3.2.2 (EE only)
  • Fix Version/s: 3.1.4 (EE only), 3.2.3 (EE only), 3.3.1
  • Component/s: Transport: TCP / UDP / SSL / Multicast
  • Labels:
    • TCP
  • User impact:
    High
  • Configuration:
    Hide

    CLIENT CONFIGURATION
    --------------------

    <?xml version="1.0" encoding="UTF-8"?>
    <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:spring="http://www.springframework.org/schema/beans" xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
    xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:http="http://www.mulesoft.org/schema/mule/http"
    xmlns:tcp="http://www.mulesoft.org/schema/mule/tcp"
    xmlns:client="http://www.mulesoft.org/schema/mule/client" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
    xmlns:management="http://www.mulesoft.org/schema/mule/management"
    xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting"
    xmlns:sxc="http://www.mulesoft.org/schema/mule/sxc" xmlns:mule-xml="http://www.mulesoft.org/schema/mule/xml"
    xsi:schemaLocation="
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
    http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd
    http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/3.2/mule-jms.xsd
    http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.2/mule-http.xsd
    http://www.mulesoft.org/schema/mule/tcp http://www.mulesoft.org/schema/mule/tcp/3.2/mule-tcp.xsd
    http://www.mulesoft.org/schema/mule/client http://www.mulesoft.org/schema/mule/client/3.2/mule-client.xsd
    http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/3.2/mule-cxf.xsd
    http://www.mulesoft.org/schema/mule/management http://www.mulesoft.org/schema/mule/management/3.2/mule-management.xsd
    http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/3.2/mule-scripting.xsd
    http://www.mulesoft.org/schema/mule/sxc http://www.mulesoft.org/schema/mule/sxc/3.2/mule-sxc.xsd
    http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/3.2/mule-xml.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

    <tcp:connector name="tcpConnector" validateConnections="false">
    <tcp:safe-protocol payloadOnly="false" />
    </tcp:connector>
    <model name="tcp-test">
    <service name="client">
    <inbound>
    <http:inbound-endpoint address="http://localhost:8080/service" ></http:inbound-endpoint>
    </inbound>
    <outbound>
    <pass-through-router>
    <tcp:outbound-endpoint address="tcp://localhost:8200/tcpeventprocessor"
    exchange-pattern="request-response"/>
    </pass-through-router>
    </outbound>
    </service>
    </model>
    </mule>

    SERVER CONFIGURATION
    --------------------

    <?xml version="1.0" encoding="UTF-8"?>
    <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:spring="http://www.springframework.org/schema/beans" xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
    xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:tcp="http://www.mulesoft.org/schema/mule/tcp"
    xmlns:client="http://www.mulesoft.org/schema/mule/client" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
    xmlns:management="http://www.mulesoft.org/schema/mule/management"
    xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting"
    xmlns:sxc="http://www.mulesoft.org/schema/mule/sxc" xmlns:mule-xml="http://www.mulesoft.org/schema/mule/xml"
    xsi:schemaLocation="
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
    http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd
    http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/3.2/mule-jms.xsd
    http://www.mulesoft.org/schema/mule/tcp http://www.mulesoft.org/schema/mule/tcp/3.2/mule-tcp.xsd
    http://www.mulesoft.org/schema/mule/client http://www.mulesoft.org/schema/mule/client/3.2/mule-client.xsd
    http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/3.2/mule-cxf.xsd
    http://www.mulesoft.org/schema/mule/management http://www.mulesoft.org/schema/mule/management/3.2/mule-management.xsd
    http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/3.2/mule-scripting.xsd
    http://www.mulesoft.org/schema/mule/sxc http://www.mulesoft.org/schema/mule/sxc/3.2/mule-sxc.xsd
    http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/3.2/mule-xml.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

    <tcp:connector name="tcpConnector" validateConnections="false">
    <tcp:safe-protocol payloadOnly="false" />
    </tcp:connector>

    <model name="tcp-test2">
    <service name="server">
    <inbound>
    <tcp:inbound-endpoint address="tcp://localhost:8200/tcpeventprocessor" exchange-pattern="request-response" />
    </inbound>
    <echo-component/>
    </service>
    </model>
    </mule>

    Show
    CLIENT CONFIGURATION -------------------- <?xml version="1.0" encoding="UTF-8"?> <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:tcp="http://www.mulesoft.org/schema/mule/tcp" xmlns:client="http://www.mulesoft.org/schema/mule/client" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns:management="http://www.mulesoft.org/schema/mule/management" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:sxc="http://www.mulesoft.org/schema/mule/sxc" xmlns:mule-xml="http://www.mulesoft.org/schema/mule/xml" xsi:schemaLocation=" http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/3.2/mule-jms.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.2/mule-http.xsd http://www.mulesoft.org/schema/mule/tcp http://www.mulesoft.org/schema/mule/tcp/3.2/mule-tcp.xsd http://www.mulesoft.org/schema/mule/client http://www.mulesoft.org/schema/mule/client/3.2/mule-client.xsd http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/3.2/mule-cxf.xsd http://www.mulesoft.org/schema/mule/management http://www.mulesoft.org/schema/mule/management/3.2/mule-management.xsd http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/3.2/mule-scripting.xsd http://www.mulesoft.org/schema/mule/sxc http://www.mulesoft.org/schema/mule/sxc/3.2/mule-sxc.xsd http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/3.2/mule-xml.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <tcp:connector name="tcpConnector" validateConnections="false"> <tcp:safe-protocol payloadOnly="false" /> </tcp:connector> <model name="tcp-test"> <service name="client"> <inbound> <http:inbound-endpoint address="http://localhost:8080/service" ></http:inbound-endpoint> </inbound> <outbound> <pass-through-router> <tcp:outbound-endpoint address="tcp://localhost:8200/tcpeventprocessor" exchange-pattern="request-response"/> </pass-through-router> </outbound> </service> </model> </mule> SERVER CONFIGURATION -------------------- <?xml version="1.0" encoding="UTF-8"?> <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:tcp="http://www.mulesoft.org/schema/mule/tcp" xmlns:client="http://www.mulesoft.org/schema/mule/client" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns:management="http://www.mulesoft.org/schema/mule/management" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:sxc="http://www.mulesoft.org/schema/mule/sxc" xmlns:mule-xml="http://www.mulesoft.org/schema/mule/xml" xsi:schemaLocation=" http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/3.2/mule-jms.xsd http://www.mulesoft.org/schema/mule/tcp http://www.mulesoft.org/schema/mule/tcp/3.2/mule-tcp.xsd http://www.mulesoft.org/schema/mule/client http://www.mulesoft.org/schema/mule/client/3.2/mule-client.xsd http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/3.2/mule-cxf.xsd http://www.mulesoft.org/schema/mule/management http://www.mulesoft.org/schema/mule/management/3.2/mule-management.xsd http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/3.2/mule-scripting.xsd http://www.mulesoft.org/schema/mule/sxc http://www.mulesoft.org/schema/mule/sxc/3.2/mule-sxc.xsd http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/3.2/mule-xml.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <tcp:connector name="tcpConnector" validateConnections="false"> <tcp:safe-protocol payloadOnly="false" /> </tcp:connector> <model name="tcp-test2"> <service name="server"> <inbound> <tcp:inbound-endpoint address="tcp://localhost:8200/tcpeventprocessor" exchange-pattern="request-response" /> </inbound> <echo-component/> </service> </model> </mule>
  • Log Output:
    Hide
    ERROR 2012-06-11 13:21:59,847 [tcpConnector.receiver.02] org.mule.exception.DefaultSystemExceptionStrategy: Caught exception in Exception Strategy:
    ********************************************************************************
    Message : Failed to transform from "byte[]" to "Object"
    Type : org.mule.api.transformer.TransformerException
    Code : MULE_ERROR-65110
    JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html
    Transformer : ByteArrayToMuleMessage{this=4a4de3fe, name='null', ignoreBadInput=false, returnClass=SimpleDataType{type=org.mule.api.MuleMessage, mimeType='*/*'}, sourceTypes=[SimpleDataType{type=[B, mimeType='*/*'}, SimpleDataType{type=java.io.InputStream, mimeType='*/*'}]}
    ********************************************************************************
    Exception stack is:
    1. The MuleContext must not be null (java.lang.IllegalArgumentException)
      org.mule.util.SerializationUtils:30 (null)
    2. Failed to transform from "byte[]" to "Object" (org.mule.api.transformer.TransformerException)
      org.mule.transformer.simple.ByteArrayToSerializable:58 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
    ********************************************************************************
    Root Exception stack trace:
    java.lang.IllegalArgumentException: The MuleContext must not be null
    at org.mule.util.SerializationUtils.deserialize(SerializationUtils.java:30)
    at org.mule.transformer.simple.ByteArrayToSerializable.doTransform(ByteArrayToSerializable.java:52)
    at org.mule.transformer.AbstractTransformer.transform(AbstractTransformer.java:423)
    at org.mule.transformer.AbstractTransformer.transform(AbstractTransformer.java:375)
    at org.mule.transformer.wire.TransformerPairWireFormat.read(TransformerPairWireFormat.java:62)
    at org.mule.transport.tcp.protocols.MuleMessageWorker.doRead(MuleMessageWorker.java:71)
    at org.mule.transport.tcp.protocols.MuleMessageSafeProtocol.read(MuleMessageSafeProtocol.java:38)
    at org.mule.transport.tcp.TcpMessageReceiver$TcpWorker.getNextMessage(TcpMessageReceiver.java:364)
    at org.mule.transport.AbstractReceiverResourceWorker.doRun(AbstractReceiverResourceWorker.java:44)
    at org.mule.transport.AbstractReceiverWorker.run(AbstractReceiverWorker.java:63)
    at org.mule.work.WorkerContext.run(WorkerContext.java:310)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:679)
    Show
    ERROR 2012-06-11 13:21:59,847 [tcpConnector.receiver.02] org.mule.exception.DefaultSystemExceptionStrategy: Caught exception in Exception Strategy: ******************************************************************************** Message : Failed to transform from "byte[]" to "Object" Type : org.mule.api.transformer.TransformerException Code : MULE_ERROR-65110 JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html Transformer : ByteArrayToMuleMessage{this=4a4de3fe, name='null', ignoreBadInput=false, returnClass=SimpleDataType{type=org.mule.api.MuleMessage, mimeType='*/*'}, sourceTypes=[SimpleDataType{type=[B, mimeType='*/*'}, SimpleDataType{type=java.io.InputStream, mimeType='*/*'}]} ******************************************************************************** Exception stack is: 1. The MuleContext must not be null (java.lang.IllegalArgumentException)   org.mule.util.SerializationUtils:30 (null) 2. Failed to transform from "byte[]" to "Object" (org.mule.api.transformer.TransformerException)   org.mule.transformer.simple.ByteArrayToSerializable:58 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html) ******************************************************************************** Root Exception stack trace: java.lang.IllegalArgumentException: The MuleContext must not be null at org.mule.util.SerializationUtils.deserialize(SerializationUtils.java:30) at org.mule.transformer.simple.ByteArrayToSerializable.doTransform(ByteArrayToSerializable.java:52) at org.mule.transformer.AbstractTransformer.transform(AbstractTransformer.java:423) at org.mule.transformer.AbstractTransformer.transform(AbstractTransformer.java:375) at org.mule.transformer.wire.TransformerPairWireFormat.read(TransformerPairWireFormat.java:62) at org.mule.transport.tcp.protocols.MuleMessageWorker.doRead(MuleMessageWorker.java:71) at org.mule.transport.tcp.protocols.MuleMessageSafeProtocol.read(MuleMessageSafeProtocol.java:38) at org.mule.transport.tcp.TcpMessageReceiver$TcpWorker.getNextMessage(TcpMessageReceiver.java:364) at org.mule.transport.AbstractReceiverResourceWorker.doRun(AbstractReceiverResourceWorker.java:44) at org.mule.transport.AbstractReceiverWorker.run(AbstractReceiverWorker.java:63) at org.mule.work.WorkerContext.run(WorkerContext.java:310) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:679)
  • Similar Issues:
    None

Description

Scenario: Mule application with outbound TCP endpoint (client) and Mule application with inbound TCP endpoint (server). The TCP connector is configured as follows at both ends.

<tcp:connector name="tcpConnector" validateConnections="false">
<tcp:safe-protocol payloadOnly="false" />
</tcp:connector>

Note that payloadOnly="false". When a message is received by the TCP inbound endpoint, Mule throws an exception stating that the Mule Context must not be null. When payloadOnly is set to false, the receiving program expects an entire Mule Message. In the class TransformerPairWireFormat, Mule creates a Transformer called inboundTransformer which is called to effect this transformation. It seems as though this transformer is not being initialised properly. In fact when the execution of the stack trace passes through this class, the Mule Context of the inboundTransformer is already null. This causes the exception further down the stack trace.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Transitions
  • Commits
  • Source
  • Builds
Hide
Permalink
Ingram Bondin added a comment - 11/Jun/12 09:01 AM

Note that in MuleMessageWorker, doWrite calls wireFormat.setMuleContext(RequestContext.getEvent().getMuleContext())
but doRead does not. This is why the initialisation of TransformerPairWireFormat is failing. Moreover, one cannot simply add this line to doRead() as there is no event in play while it is executing.

Show
Ingram Bondin added a comment - 11/Jun/12 09:01 AM Note that in MuleMessageWorker, doWrite calls wireFormat.setMuleContext(RequestContext.getEvent().getMuleContext()) but doRead does not. This is why the initialisation of TransformerPairWireFormat is failing. Moreover, one cannot simply add this line to doRead() as there is no event in play while it is executing.
Hide
Permalink
Pablo Kraan added a comment - 29/Jun/12 12:56 PM

Fix 3.1.x
http://fisheye.codehaus.org/changelog/mule/?cs=24586

Fix 3.2.x
http://fisheye.codehaus.org/changelog/mule/?cs=24587

Fix 3.3.x
http://fisheye.codehaus.org/changelog/mule/?cs=24588

Fix 3.x
http://fisheye.codehaus.org/changelog/mule/?cs=24589

Show
Pablo Kraan added a comment - 29/Jun/12 12:56 PM Fix 3.1.x http://fisheye.codehaus.org/changelog/mule/?cs=24586 Fix 3.2.x http://fisheye.codehaus.org/changelog/mule/?cs=24587 Fix 3.3.x http://fisheye.codehaus.org/changelog/mule/?cs=24588 Fix 3.x http://fisheye.codehaus.org/changelog/mule/?cs=24589

People

  • Assignee:
    Pablo Kraan
    Reporter:
    Ingram Bondin
Vote (0)
Watch (1)

Dates

  • Created:
    11/Jun/12 07:22 AM
    Updated:
    29/Jun/12 12:57 PM
    Resolved:
    29/Jun/12 12:57 PM

Agile

  • View on Board
  • Atlassian JIRA (v5.0.7#734-sha1:8ad78a6)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for MuleForge. Try JIRA - bug tracking software for your team.