Uploaded image for project: 'Mule'
  1. Mule
  2. MULE-4634

UnsupportedEncodingException "utf-8" since java 1.6.0.1x

    Details

      Description

      When upgrading Java on a machine running CXF Transport with mule the Encoding gets broken.
      The Exception is:

      15:10:52,309 ERROR [STDERR] Nov 25, 2009 3:10:52 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept
      INFO: Interceptor has thrown exception, unwinding now
      org.apache.cxf.interceptor.Fault: Could not create XMLStreamReader (input was of encoding {0}).
      	at org.apache.cxf.interceptor.StaxOutInterceptor.handleMessage(StaxOutInterceptor.java:74)
      	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
      	at org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:198)
      	at org.mule.transport.cxf.CxfServiceComponent$1.write(CxfServiceComponent.java:271)
      	at org.mule.transport.servlet.AbstractReceiverServlet.writeResponse(AbstractReceiverServlet.java:191)
      	at org.mule.transport.servlet.MuleReceiverServlet.doPost(MuleReceiverServlet.java:191)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      	at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      	at java.lang.Thread.run(Thread.java:619)
      Caused by: javax.xml.stream.XMLStreamException: java.io.UnsupportedEncodingException: "utf-8"
      	at com.ctc.wstx.stax.WstxOutputFactory.createSW(WstxOutputFactory.java:257)
      	at com.ctc.wstx.stax.WstxOutputFactory.createXMLStreamWriter(WstxOutputFactory.java:124)
      	at org.apache.cxf.interceptor.StaxOutInterceptor.handleMessage(StaxOutInterceptor.java:67)
      	... 25 more
      Caused by: java.io.UnsupportedEncodingException: "utf-8"
      	at sun.nio.cs.StreamEncoder.forOutputStreamWriter(StreamEncoder.java:42)
      	at java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:83)
      	at com.ctc.wstx.stax.WstxOutputFactory.createSW(WstxOutputFactory.java:253)
      	... 27 more
      

      Which looks strange, but in fact the Encoding is ""utf-8"" when "utf-8" was expected. Somewhere the enclosing quotes sneaked in with the java version upgrade.
      Here a Mule Event from 1.6.06:

      
      {MULE_EVENT=MuleEvent: e8b9f602-9c88-11de-9ab5-43f36b7c80ec, sync=true, stop processing=false, org.mule.endpoint.DynamicURIInboundEndpoint@55116481, mule.message=org.mule.transport.servlet.HttpRequestMessageAdapter/org.mule.transport.servlet.HttpRequestMessageAdapter@166caf0{id=eae3b3d5-9c88-11de-9ab5-43f36b7c80ec, payload=org.apache.catalina.connector.CoyoteInputStream, properties=Properties{invocation:{}, inbound:{content-type=text/xml; charset=utf-8, connection=keep-alive, soapaction="", Host=localhost:8080, accept=text/xml, multipart/related, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2, content-length=831, user-agent=Java/1.6.0_06}, outbound:{http.request=/foo/bar/service, http.context.path=/foo/bar/service, MULE_ENCODING=utf-8, http.method=POST, http.request.path=/foo/bar/service, MULE_REMOTE_SYNC=true, MULE_ORIGINATING_ENDPOINT=servlet:ServiceControllerImplPort}, session:{}, }, correlationId=null, correlationGroup=-1, correlationSeq=-1, encoding=utf-8, exceptionPayload=null}, org.apache.cxf.transport.Destination=org.mule.transport.cxf.transport.MuleUniversalDestination@1a8c8c9, SOAPAction=null, org.apache.cxf.transport.local.LocalConduit.directDispatch=true, org.apache.cxf.message.Message.HTTP_REQUEST_METHOD=POST, Content-Type=text/xml, org.apache.cxf.message.Message.ENCODING=utf-8, org.apache.cxf.message.Message.BASE_PATH=/foo/bar/service, org.apache.cxf.message.Message.PATH_INFO=/foo/bar/service}
      

      What you can see is: user-agent=Java/1.6.0_06 and MULE_ENCODING=utf-8

      the same request to 1.6.0.16

      
      {MULE_EVENT=MuleEvent: 513d4039-9c87-11de-a654-e750bf59dcd3, sync=true, stop processing=false, org.mule.endpoint.DynamicURIInboundEndpoint@a17031d2, mule.message=org.mule.transport.servlet.HttpRequestMessageAdapter/org.mule.transport.servlet.HttpRequestMessageAdapter@c987f5{id=76c91bd2-9c88-11de-a654-e750bf59dcd3, payload=org.apache.catalina.connector.CoyoteInputStream, properties=Properties{invocation:{}, inbound:{content-type=text/xml;charset="utf-8", connection=keep-alive, soapaction="", Host=localhost:8080, accept=text/xml, multipart/related, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2, content-length=831, user-agent=JAX-WS RI 2.1.6 in JDK 6}, outbound:{http.request=/foo/bar/service, http.context.path=/foo/bar/service, MULE_ENCODING="utf-8", http.method=POST, http.request.path=/foo/bar/service, MULE_REMOTE_SYNC=true, MULE_ORIGINATING_ENDPOINT=servlet:ServiceControllerImplPort}, session:{}, }, correlationId=null, correlationGroup=-1, correlationSeq=-1, encoding="utf-8", exceptionPayload=null}, org.apache.cxf.transport.Destination=org.mule.transport.cxf.transport.MuleUniversalDestination@19554f9, SOAPAction=null, org.apache.cxf.transport.local.LocalConduit.directDispatch=true, org.apache.cxf.message.Message.HTTP_REQUEST_METHOD=POST, Content-Type=text/xml, org.apache.cxf.message.Message.ENCODING="utf-8", org.apache.cxf.message.Message.BASE_PATH=/foo/bar/service, org.apache.cxf.message.Message.PATH_INFO=/foo/bar/service}
      
      

      Here: user-agent=JAX-WS RI 2.1.6 in JDK 6 and MULE_ENCODING="utf-8

      either Mule needs to be fixed (but i dont know where and why, because this seems to be related to the message handling) or it is a jdk bug

        Attachments

          Activity

            People

            • Assignee:
              dirk Dirk Olmes
              Reporter:
              ccfla Fabian Lange
            • Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: