synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hiranya Jayathilaka <hiranya...@gmail.com>
Subject Re: Failing NHTTP Tests
Date Thu, 29 Apr 2010 09:06:03 GMT
Folks,

I have checked in a fix for this. It seems all the NHTTP tests are passing
now. Will appreciate if somebody can verify. Also we need to test our REST
support with this fix. Changes were made to the RESTUtil class.

Thanks,
Hiranya

On Thu, Apr 29, 2010 at 12:13 PM, Hiranya Jayathilaka
<hiranya911@gmail.com>wrote:

> Hi Devs,
>
> On Thu, Apr 29, 2010 at 12:01 PM, Ruwan Linton <ruwan.linton@gmail.com>wrote:
>
>> Is it a bug at the transport or at the axis2, where it tries to pass the
>> message trying to build it??
>>
>
> I think I have found the cause of the issue. For POX messages Synapse calls
> the RESTUtils class of the Axis2 HTTP transport module. When this call is
> made the content type is given as 'application/xml'. Note that by this time
> charset information has been dropped from the content type string. It is set
> to a message context property. The RESTUtils class attempts to find the
> charset encoding from the given content type and falls back to 'UTF-8'.
>
> I'm working on a fix.
>
> Thanks,
> Hiranya
>
>
>> Thanks,
>> Ruwan
>>
>>
>> On Thu, Apr 29, 2010 at 11:55 AM, Hiranya Jayathilaka <
>> hiranya911@gmail.com> wrote:
>>
>>> Hi Andreas,
>>>
>>> On Thu, Apr 29, 2010 at 11:50 AM, Andreas Veithen <
>>> andreas.veithen@gmail.com> wrote:
>>>
>>>> The test kit produces extensive logs in the following directory:
>>>>
>>>>
>>>> modules/transports/core/nhttp/target/testkit-logs/org.apache.synapse.transport.nhttp.HttpCoreNIOListenerTest/0009/
>>>>
>>>
>>> Thanks for pointing this out.
>>>
>>>
>>>>
>>>> The interesting part is this:
>>>>
>>>> 18 [http-Listener I/O dispatcher-1] DEBUG
>>>> org.apache.synapse.transport.nhttp.wire - >> "POST
>>>> /services/TestService-2734c979-f9a5-4b9f-aadb-6c2cce281176
>>>> HTTP/1.1[\r][\n]"
>>>> 18 [http-Listener I/O dispatcher-1] DEBUG
>>>> org.apache.synapse.transport.nhttp.wire - >> "Content-Type:
>>>> application/xml; charset=ISO-8859-1[\r][\n]"
>>>>
>>>> 47 [HttpServerWorker-9] ERROR
>>>> org.apache.synapse.transport.nhttp.ServerWorker - Error processing
>>>> POST request
>>>> org.apache.axis2.AxisFault: Invalid UTF-8 middle byte 0x20 (at char
>>>> #6, byte #-1)
>>>>        at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
>>>>        at
>>>> org.apache.axis2.builder.ApplicationXMLBuilder.processDocument(ApplicationXMLBuilder.java:75)
>>>>        at
>>>> org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:179)
>>>>        at
>>>> org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
>>>>        at
>>>> org.apache.axis2.transport.http.util.RESTUtil.processXMLRequest(RESTUtil.java:65)
>>>>        at
>>>> org.apache.synapse.transport.nhttp.util.RESTUtil.processPOSTRequest(RESTUtil.java:186)
>>>>        at
>>>> org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:403)
>>>>        at
>>>> org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:259)
>>>>        at
>>>> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:58)
>>>>        at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
>>>>        at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
>>>>        at java.lang.Thread.run(Thread.java:613)
>>>> Caused by: com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 middle byte
>>>> 0x20 (at char #6, byte #-1)
>>>>        at
>>>> com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:548)
>>>>        at
>>>> com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:604)
>>>>        at
>>>> com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:629)
>>>>        at
>>>> com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:324)
>>>>        at
>>>> org.apache.axiom.util.stax.wrapper.XMLInputFactoryWrapper.createXMLStreamReader(XMLInputFactoryWrapper.java:95)
>>>>        at
>>>> org.apache.axiom.util.stax.wrapper.WrappingXMLInputFactory.createXMLStreamReader(WrappingXMLInputFactory.java:116)
>>>>        at
>>>> org.apache.axiom.util.stax.wrapper.XMLInputFactoryWrapper.createXMLStreamReader(XMLInputFactoryWrapper.java:95)
>>>>        at org.apache.axiom.om.util.StAXUtils$1.run(StAXUtils.java:164)
>>>>        at java.security.AccessController.doPrivileged(Native Method)
>>>>        at
>>>> org.apache.axiom.om.util.StAXUtils.createXMLStreamReader(StAXUtils.java:160)
>>>>        at
>>>> org.apache.axis2.builder.BuilderUtil.getPOXBuilder(BuilderUtil.java:230)
>>>>        at
>>>> org.apache.axis2.builder.ApplicationXMLBuilder.processDocument(ApplicationXMLBuilder.java:64)
>>>>        ... 10 more
>>>> Caused by: java.io.CharConversionException: Invalid UTF-8 middle byte
>>>> 0x20 (at char #6, byte #-1)
>>>>        at
>>>> com.ctc.wstx.io.UTF8Reader.reportInvalidOther(UTF8Reader.java:313)
>>>>        at com.ctc.wstx.io.UTF8Reader.read(UTF8Reader.java:204)
>>>>        at
>>>> com.ctc.wstx.io.ReaderBootstrapper.initialLoad(ReaderBootstrapper.java:245)
>>>>        at
>>>> com.ctc.wstx.io.ReaderBootstrapper.bootstrapInput(ReaderBootstrapper.java:132)
>>>>        at
>>>> com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:543)
>>>>        ... 21 more
>>>>
>>>> As one can see, the test sends the request in ISO-8859-1, but the
>>>> transport parses it as UTF-8, causing an error.
>>>>
>>>
>>> Yes it indeed seems like a bug in the transport. Let's try and figure
>>> this out.
>>>
>>> Thanks,
>>> Hiranya
>>>
>>>
>>>>
>>>> Andreas
>>>>
>>>> On Thu, Apr 29, 2010 at 07:50, Hiranya Jayathilaka <
>>>> hiranya911@gmail.com> wrote:
>>>> > Hi Devs,
>>>> > I'm attempting to figure out the problems in our existing NHTTP tests.
>>>> NHTTP
>>>> > tests are based on the Axis2 transports test kit. According to my
>>>> > observations following tests are failing consistently (out of 77 test
>>>> > cases). Relevant exceptions are also shown below.
>>>> > 0009:test=AsyncXML,data=Latin1,messageType=POX,client=java.net
>>>> ,endpoint=axis
>>>> >
>>>> (org.apache.axis2.transport.testkit.tests.async.XMLAsyncMessageTestCase)
>>>> > java.io.IOException: Server returned HTTP response code: 500 for URL:
>>>> >
>>>> http://localhost:8280/services/TestService-9568a692-c528-48d2-ba67-0061c33b25a5
>>>> > at
>>>> >
>>>> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1313)
>>>> > at
>>>> >
>>>> org.apache.axis2.transport.testkit.http.JavaNetClient.sendMessage(JavaNetClient.java:57)
>>>> > at
>>>> >
>>>> org.apache.axis2.transport.testkit.http.JavaNetClient.sendMessage(JavaNetClient.java:36)
>>>> > at
>>>> >
>>>> org.apache.axis2.transport.testkit.client.AsyncTestClientAdapter.sendMessage(AsyncTestClientAdapter.java:45)
>>>> > at
>>>> >
>>>> org.apache.axis2.transport.testkit.tests.async.AsyncMessageTestCase.doRunTest(AsyncMessageTestCase.java:50)
>>>> > at
>>>> >
>>>> org.apache.axis2.transport.testkit.tests.MessageTestCase.runTest(MessageTestCase.java:62)
>>>> > at
>>>> >
>>>> org.apache.axis2.transport.testkit.ManagedTestSuite.run(ManagedTestSuite.java:118)
>>>> > at
>>>> com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
>>>> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> > at
>>>> >
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>> > at
>>>> >
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>> > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
>>>> >
>>>> >
>>>> 0020:test=AsyncXML,data=Latin1,messageType=POX,forceHTTP10=false,client=axis,endpoint=axis
>>>> >
>>>> (org.apache.axis2.transport.testkit.tests.async.XMLAsyncMessageTestCase)
>>>> > junit.framework.AssertionFailedError: Failed to get message
>>>> > at
>>>> >
>>>> org.apache.axis2.transport.testkit.tests.async.AsyncMessageTestCase.doRunTest(AsyncMessageTestCase.java:53)
>>>> > at
>>>> >
>>>> org.apache.axis2.transport.testkit.tests.MessageTestCase.runTest(MessageTestCase.java:62)
>>>> > at
>>>> >
>>>> org.apache.axis2.transport.testkit.ManagedTestSuite.run(ManagedTestSuite.java:118)
>>>> > at
>>>> com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
>>>> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> > at
>>>> >
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>> > at
>>>> >
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>> > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
>>>> >
>>>> 0042:test=AsyncXML,data=Latin1,messageType=POX,forceHTTP10=true,client=axis,endpoint=axis
>>>> >
>>>> (org.apache.axis2.transport.testkit.tests.async.XMLAsyncMessageTestCase)
>>>> > junit.framework.AssertionFailedError: Failed to get message
>>>> > at
>>>> >
>>>> org.apache.axis2.transport.testkit.tests.async.AsyncMessageTestCase.doRunTest(AsyncMessageTestCase.java:53)
>>>> > at
>>>> >
>>>> org.apache.axis2.transport.testkit.tests.MessageTestCase.runTest(MessageTestCase.java:62)
>>>> > at
>>>> >
>>>> org.apache.axis2.transport.testkit.ManagedTestSuite.run(ManagedTestSuite.java:118)
>>>> > at
>>>> com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
>>>> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> > at
>>>> >
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>> > at
>>>> >
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>> > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
>>>> >
>>>> > It seems all the failures are associated with POX+Latin1 test cases.
>>>> But not
>>>> > all of them fail either. Only the above mentioned tests are failing.
>>>> Can
>>>> > somebody please help me figure out what's going on? When I exclude
>>>> Latin1
>>>> > tests from the suite everything works fine.
>>>> > Thanks
>>>> > --
>>>> > Hiranya Jayathilaka
>>>> > Software Engineer;
>>>> > WSO2 Inc.;  http://wso2.org
>>>> > E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
>>>> > Blog: http://techfeast-hiranya.blogspot.com
>>>> >
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
>>>> For additional commands, e-mail: dev-help@synapse.apache.org
>>>>
>>>>
>>>
>>>
>>> --
>>> Hiranya Jayathilaka
>>> Software Engineer;
>>> WSO2 Inc.;  http://wso2.org
>>> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
>>> Blog: http://techfeast-hiranya.blogspot.com
>>>
>>
>>
>>
>> --
>> Ruwan Linton
>> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
>>
>> WSO2 Inc.; http://wso2.org
>> email: ruwan@wso2.com; cell: +94 77 341 3097
>> blog: http://ruwansblog.blogspot.com
>>
>
>
>
> --
> Hiranya Jayathilaka
> Software Engineer;
> WSO2 Inc.;  http://wso2.org
> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
> Blog: http://techfeast-hiranya.blogspot.com
>



-- 
Hiranya Jayathilaka
Software Engineer;
WSO2 Inc.;  http://wso2.org
E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
Blog: http://techfeast-hiranya.blogspot.com

Mime
View raw message