I am having a problem with Axis2 1.4.1 used to deploy a WebService to a Tomcat 6.0.18 server.
I've have a complex application that exhibits weird behavior, and I
have boiled it down to a simplified case. It should be attached as a
Maven project.
Using the AxisServlet, I can access a WebService that is implemented
via an annotated class, as long as all of the data objects are
deployed in WEB-INF/classes.
Given this skeleton implementation:
@WebService(serviceName = "Example")
public class ServiceClass {
...
@WebMethod
public String echoString(String arg) {
return "Hello World" + arg;
}
@WebMethod
public DataObject getDataObject() {
return new DataObject();
}
...
}
If DataObject is a part of the war (and thus deployed in
${webapp}/${project}/WEB-INF/classes/), this will work fine. If this
is deployed inside of a jar that is located under /WEB-INF/lib/, it
will not work.
It appears to be related to these JIRA reports:
https://issues.apache.org/jira/browse/AXIS2-3341
https://issues.apache.org/jira/browse/AXIS2-3736
https://issues.apache.org/jira/browse/AXIS2-3590
I was hoping to verify that everything is configured correctly, and
that the approach I am using is expected to work.
I build this via "mvn clean package". When I deploy this as a webapp
named "webservice" on my Tomcat server, with a URL of:
"http://localhost:8686", I can get the WSDL using the following URL:
http://localhost:8686/webservice/services/Example.ServiceClassPort?wsdl
Then using SoapUI 2.5.1, I import the WSDL, and the "echoString" call
works just fine. The getDataObject method will fail with a stack
trace very similar to the one in AXIS2-3736 (See below for the
complete stack trace).
If I unpack the class by running "jar xf
../lib/service-1.0-SNAPSHOT.jar com" from the WEB-INF/classes
directory, and restart Tomcat everything works just fine, and SoapUI
shows exactly what I would expect it to for both the echoString and
getDataObject methods.
Is there any solid work around for this? I'd prefer not to have to
unpack my classes if I can. Is this a problem with JAXB? Is there
anything I can do to tweak the configuration for the classpath to be
more inclusive? I'm not an expert in JAXB nor Axis, this is really my
first attempt at implementing WebServices with this toolchain.
Thanks in Advance,
Kirby
Stack Trace for failure case:
org.apache.axis2.AxisFault: javax.xml.bind.MarshalException
- with linked exception:
[javax.xml.bind.JAXBException: com.p21csi.example.ws.DataObject is not
known to this context]
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at
org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:220)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException
- with linked exception:
[javax.xml.bind.JAXBException: com.p21csi.example.ws.DataObject is not
known to this context]
at
org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:175)
at
org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70)
at
org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:128)
at
org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:217)
... 17 more
Caused by: javax.xml.bind.MarshalException
- with linked exception:
[javax.xml.bind.JAXBException: com.p21csi.example.ws.DataObject is not
known to this context]
at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:331)
at
com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:175)
at
org.apache.axis2.datasource.jaxb.JAXBDSContext$3.run(JAXBDSContext.java:664)
at
org.apache.axis2.java.security.AccessController.doPrivileged(AccessController.java:76)
at
org.apache.axis2.datasource.jaxb.JAXBDSContext.marshalByType(JAXBDSContext.java:566)
at
org.apache.axis2.datasource.jaxb.JAXBDSContext.marshal(JAXBDSContext.java:294)
at
org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl._outputFromBO(JAXBBlockImpl.java:175)
at org.apache.axis2.jaxws.message.impl.BlockImpl.outputTo(BlockImpl.java:342)
at
org.apache.axis2.jaxws.message.impl.BlockImpl.serialize(BlockImpl.java:266)
at
org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerializeAndConsume(OMSourcedElementImpl.java:664)
at
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:918)
at
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:947)
at
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:918)
at
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:947)
at
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:240)
at
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:228)
at
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:947)
at
org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:471)
at
org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:79)
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutputStream(CommonsHTTPTransportSender.java:337)
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:214)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)
at
org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:198)
... 17 more
Caused by: javax.xml.bind.JAXBException:
com.p21csi.example.ws.DataObject is not known to this context
at
com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:242)
at
com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:257)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:143)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:185)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:305)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:312)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:71)
at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:490)
at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:328)
... 39 more
Caused by: javax.xml.bind.JAXBException:
com.p21csi.example.ws.DataObject is not known to this context
at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:587)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:140)
... 45 more
sample.tar.gz
Description: GNU Zip compressed data
