问题
I am working on application deployed in WAS 8.5.5.2. I am getting the below error while rendering TIF image. I have kept Axiom 1.2.14 which is latest in classpath and restarted the server. Got a classcast exception. Then, i have searched the entire WAS for any internal builtin jars and found few instances under org.apache.axis2 jar (builtin jar in WAS runtimes folder). SO i have removed my jar from the classpath. Still i am getting the same error. Any clues will really helpful ..
Unable to perform rendering due to exception (java.lang.ClassCastException: org.apache.axiom.util.stax.xop.XOPEncodingStreamWriter incompatible with org.apache.axiom.ext.stax.datahandler.DataHandlerWriter)
org.apache.axiom.ext.stax.datahandler.DataHandlerWriter)
stacktrace=org.apache.axiom.util.stax.XMLStreamWriterUtils.internalGetDataHandlerWriter(XMLStreamWriterUtils.java:71)
org.apache.axiom.util.stax.XMLStreamWriterUtils.writeDataHandler(XMLStreamWriterUtils.java:134)
com.myapplication.mdivrs.axis2.mdivrsStub$RenderDocument.serialize(mdivrsStub.java:1503)
com.myapplication.mdivrs.axis2.mdivrsStub$RenderDocumentE.serialize(mdivrsStub.java:2607)
com.myapplication.mdivrs.axis2.mdivrsStub$RenderDocumentE.serialize(mdivrsStub.j ava:2593)
org.apache.axis2.databinding.ADBDataSource.serialize(ADBDataSource.java:90)
org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:781)
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:967) org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:207)
org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:74)
org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84)
org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:570)
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:399)
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:226)
org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:556)
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
com.myapplication.mdivrs.axis2.mdivrsStub.renderDocument(mdivrsStub.java:200)
com.myapplication.mdi.services.WSRenderer.doRender(WSRenderer.java:413)
com.myapplication.mdi.services.WSRenderer.render(WSRenderer.java:242)
com.myapplication.mdi.services.Retrieval.getImageData(Retrieval.java:973)
com.myapplication.mdi.server.impl.DocServicesImpl.getRendition(DocServicesImpl.java:1038)
回答1:
If you want to use Axis2 in WebSphere, you need to configure your application as described here.
来源:https://stackoverflow.com/questions/34587270/classcast-exception-during-rendering-while-using-axiom-in-was-8-5-5-2