Hi.
We are using CXF in our application but get some random errors under
heavy load.
The server holds a plugin-pool with the web-services.
The plugins are reused and in this scenario instantiated nearly at the
same time.
This is the main part of the plugin:(code have been removed for
viewability)
public class ValidateSipSynchPlugin implements SynchronousPlugin
{
private JAXBContext mContext = null;
private Marshaller mMarshaller = null;
@Override
public void execute(String id, InputStream in, OutputStream out)
throws IOException
{
ObjectFactory objFactory = new ObjectFactory();
ValidateSipResponse response =
objFactory.createValidateSipResponse();
response.setId(id);
response.setStatus(GetSipStatusType.ARCHIVED);
// set some other data...
marshaller = getMarshaller();
marshaller.marshal(objFactory.createValidateSipResponse(response), out);
}
private JAXBContext getContext() throws JAXBException
{
if (mContext == null)
{
mContext = JAXBContext.newInstance(ObjectFactory.class);
}
return mContext;
}
private Marshaller getMarshaller() throws JAXBException
{
if (mMarshaller == null)
{
mMarshaller = getContext().createMarshaller();
}
return mMarshaller;
}
}
I created a simple cli app that starts about 50 threads where all
threads make a request to the server.
The request is exactly the same but once in a while we get errors when
reading the response.
Below is the interceptor log from the client. notice the namespace
difference in the last to inbounded messages.
Outbound Message
---------------------------
ID: 20
Address: http://hades:8080/iip
Encoding: UTF-8
Content-Type: text/xml
Headers:
{SOAPAction=["http://www.idainfront.se/schema/archive-2.0-custom/ValidateSip"],
Accept=[*/*]}
Payload:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:ValidateSip xmlns="http://www.idainfront.se/schema/archive-2.0"
xmlns:ns2="http://www.idainfront.se/schema/archive-2.0-custom"
producer="Foo" system="Bar" callerId="massingest-cli">
<ArchiveObject>
<DisplayName>AL00 2007:1</DisplayName>
<ObjectType>VVDIARK</ObjectType>
</ArchiveObject>
</ns2:ValidateSip>
</soap:Body>
</soap:Envelope>
--------------------------------------
Outbound Message
---------------------------
ID: 29
Address: http://hades:8080/iip
Encoding: UTF-8
Content-Type: text/xml
Headers:
{SOAPAction=["http://www.idainfront.se/schema/archive-2.0-custom/ValidateSip"],
Accept=[*/*]}
Payload:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:ValidateSip xmlns="http://www.idainfront.se/schema/archive-2.0"
xmlns:ns2="http://www.idainfront.se/schema/archive-2.0-custom"
producer="Foo" system="Bar" callerId="massingest-cli">
<ArchiveObject>
<DisplayName>AL00 2007:1</DisplayName>
<ObjectType>VVDIARK</ObjectType>
</ArchiveObject>
</ns2:ValidateSip>
</soap:Body>
</soap:Envelope>
--------------------------------------
Inbound Message
----------------------------
ID: 20
Response-Code: 200
Encoding: UTF-8
Content-Type: text/xml; charset=UTF-8
Headers: {content-type=[text/xml; charset=UTF-8],
transfer-encoding=[chunked], Date=[Mon, 09 May 2011 14:49:12 GMT],
X-localid=[0000052707],
X-localtxid=[95563fd8-d2c6-f6a3-37ba-eec2d0c4a997],
X-Powered-By=[Servlet/2.5 JSP/2.1]}
Payload:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:ValidateSipResponse
xmlns="http://www.idainfront.se/schema/archive-2.0"
xmlns:ns2="http://www.idainfront.se/schema/archive-2.0-custom">
<ns2:Status>ARCHIVED</ns2:Status>
<ns2:Id>iipax://objectbase.document/docpartition#20545</ns2:Id>
</ns2:ValidateSipResponse>
</soap:Body>
</soap:Envelope>
--------------------------------------
Inbound Message
----------------------------
ID: 29
Response-Code: 200
Encoding: UTF-8
Content-Type: text/xml; charset=UTF-8
Headers: {content-type=[text/xml; charset=UTF-8],
transfer-encoding=[chunked], Date=[Mon, 09 May 2011 14:49:12 GMT],
X-localid=[0000079003],
X-localtxid=[f8d1ea1c-f1f5-fce7-47a8-9661c593673b],
X-Powered-By=[Servlet/2.5 JSP/2.1]}
Payload:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns3:ValidateSipResponse
xmlns:ns2="http://www.idainfront.se/schema/archive-2.0"
xmlns:ns3="http://www.idainfront.se/schema/archive-2.0-custom">
<Status>ARCHIVED</Status>
<Id>iipax://objectbase.document/docpartition#20546</Id>
</ns3:ValidateSipResponse>
</soap:Body>
</soap:Envelope>
And the following Exception is thrown:
DefaultValidationEventHandler: [ERROR]: unexpected element (uri:"",
local:"Status"). Expected elements are
<{http://www.idainfront.se/schema/archive-2.0-custom}Status>,<{http://www.idainfront.se/schema/archive-2.0-custom}Id>,<{http://www.idainfront.se/schema/archive-2.0-custom}Fault>
javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: unexpected
element (uri:"", local:"Status"). Expected elements are
<{http://www.idainfront.se/schema/archive-2.0-custom}Status>,<{http://www.idainfront.se/schema/archive-2.0-custom}Id>,<{http://www.idainfront.se/schema/archive-2.0-custom}Fault>
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:146)
at $Proxy47.validateSip(Unknown Source)
at se.idainfront.trv.tool.PokeCommand
$MyRunnable.run(PokeCommand.java:155)
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.xml.bind.UnmarshalException
- with linked exception:
[javax.xml.bind.UnmarshalException: unexpected element (uri:"",
local:"Status"). Expected elements are
<{http://www.idainfront.se/schema/archive-2.0-custom}Status>,<{http://www.idainfront.se/schema/archive-2.0-custom}Id>,<{http://www.idainfront.se/schema/archive-2.0-custom}Fault>]
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:425)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:362)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:339)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:764)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:628)
at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:154)
at
org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:198)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:733)
at org.apache.cxf.transport.http.HTTPConduit
$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2201)
at org.apache.cxf.transport.http.HTTPConduit
$WrappedOutputStream.handleResponse(HTTPConduit.java:2071)
at org.apache.cxf.transport.http.HTTPConduit
$WrappedOutputStream.close(HTTPConduit.java:1925)
at
org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
at
org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:188)
at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at
org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:662)
at org.apache.cxf.interceptor.MessageSenderInterceptor
$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
... 3 more
Caused by: javax.xml.bind.UnmarshalException: unexpected element
(uri:"", local:"Status"). Expected elements are
<{http://www.idainfront.se/schema/archive-2.0-custom}Status>,<{http://www.idainfront.se/schema/archive-2.0-custom}Id>,<{http://www.idainfront.se/schema/archive-2.0-custom}Fault>
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:642)
at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:254)
at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:249)
at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:116)
at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.childElement(Loader.java:101)
at
com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.childElement(StructureLoader.java:243)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:478)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:459)
at
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:242)
at
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:176)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
... 24 more
Caused by: javax.xml.bind.UnmarshalException: unexpected element
(uri:"", local:"Status"). Expected elements are
<{http://www.idainfront.se/schema/archive-2.0-custom}Status>,<{http://www.idainfront.se/schema/archive-2.0-custom}Id>,<{http://www.idainfront.se/schema/archive-2.0-custom}Fault>
... 35 more
Does anyone have any idé what is going on here?
Best Regards
Thobias
--
Thobias Bergqvist
Ida Infront AB
+46(0)13-37 37 57
www.idainfront.se