Can someone please help me with a strange problem?
I have a service:
@WebMethod
@WebResult(name = "sendCustomerCommunicationResponse", targetNamespace = "......something/Underwriting/Correspondance/V1", partName = "Body")
public SendCustomerCommunicationResponse sendCustomerCommunication(
@WebParam(name = "sendCustomerCommunicationRequest", targetNamespace = "........something/Underwriting/Correspondance/V1", partName = "Body")
SendCustomerCommunicationRequest body)
throws ServiceException_Exception, SystemException_Exception
;
And locally I'm calling it with :
SendCustomerCommunicationResponse response = correspondanceServicePort.sendCustomerCommunication(sendCustomerCommunicationRequest);
And this works well. But when I'm deploying the application on another server, I'm receiving:
"java.lang.ClassCastException:
it.usi.xframe.ub1.batch.services.esb.SendCustomerCommunicationRequest incompatible with
it.usi.xframe.ub1.batch.services.esb.SendCustomerCommunicationResponse"
P.S. The application is running on WebSphere server
The request is :
<soapenv:Envelope ...someSchema...>
<soapenv:Header>
<v1:TechnicalHeader>
<v1:correlationId>12742</v1:correlationId>
<v1:sender>userName</v1:sender>
<v1:countryCode/>
<v1:channelId/>
<v1:userID>userName</v1:userID>
<v1:operationId>CHANGE_STATUS</v1:operationId>
</v1:TechnicalHeader>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>someUser</wsse:Username>
<wsse:Password>somePassoword</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<v11:sendCustomerCommunicationRequest>
<v11:eventCode>{"header":{"publishingDate":1474016634749,"eventId":"DEL-NEG","applicationCode":"UB3","correlationId":"9999","language":"IT","channelId":"MOB"},"body":{"ndg":"5106215","additionalInfo":{}}}</v11:eventCode>
</v11:sendCustomerCommunicationRequest>
</soapenv:Body>
</soapenv:Envelope>
Maybe it could be a WebSphere JAXB issue, related to the version you're using or your server may miss some fixings. Take a look at what the docs say:
The JAXB Unmarshaller generates stub classes at runtime to assist in unmarshalling the document. These generated classes are cached and may be reused by other JAXBContexts in the application.
When a
JAXBContext
contains a class which has an element wildcard (i.e.@XmlAnyElement
) it was possible that the Unmarshaller would use incompatible generated stub classes from anotherJAXBContext
which could result in aClassCastException
being thrown during unmarshalling. The problem was resolved by improving the collision checking done on previously generated stub classes so that a new stub class is generated from the currentJAXBContext
if the previously generated stub class found in the cache is not compatible.
That's hard to guess because of IBM's nature regardless the version you're using. Also, refer some other fixings:
Q:
SendCustomerCommunicationResponse
defined? does it include @Xml..
annotations? (eg @XmlRoot ..
@WebResult
return variable to something different than the name of the return class (SendCustomerCommunicationResponse
) ServiceException_Exception
and SystemException_Exception
? your own exceptions? It seems those are JAX-RS/JAXB generated exceptions.. It looks like a class version mismatch issue.
One of the scenarios where the developers create Web-Service stubs and build them in their project using a newer version whereas the server classpath has an older version of some dependent jar file. I would recommend the following steps to rule out this option of mismatched dependency versions.
The second approach can be to do a remote debug, if possible, after enabling the de-compiler in your IDE. Check the class files where the exception occurs and ensure that the editor is linked to the navigator view, to ensure that your navigator shows the file in the jar that being debugged. You should be able to find the exact jar file that is invoked at the time of the exception.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With