JAXBException: ClassCastException is thrown while running a process which uses JAXB marshalling inside custom workitem handler
Issue
- Running a process with a custom
workitem handlerthat is usingJAXBmarshalling fails with the following exception:
ERROR [stderr] (http-/127.0.0.1:8080-4) javax.xml.bind.JAXBException: ClassCastException: attempting to cast jar:file:/C:/BPMS/jboss-eap-6.1/modules/system/layers/base/javax/xml/bind/api/main/jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-2.jar!/javax/xml/bind/JAXBContext.class to jar:file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/rt.jar!/javax/xml/bind/JAXBContext.class. Please make sure that you are specifying the proper ClassLoader.
17:56:55,620 ERROR [stderr] (http-/127.0.0.1:8080-4) at javax.xml.bind.ContextFinder.handleClassCastException(ContextFinder.java:115)
17:56:55,620 ERROR [stderr] (http-/127.0.0.1:8080-4) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:251)
17:56:55,620 ERROR [stderr] (http-/127.0.0.1:8080-4) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:235)
17:56:55,621 ERROR [stderr] (http-/127.0.0.1:8080-4) at javax.xml.bind.ContextFinder.find(ContextFinder.java:432)
17:56:55,621 ERROR [stderr] (http-/127.0.0.1:8080-4) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:637)
17:56:55,622 ERROR [stderr] (http-/127.0.0.1:8080-4) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:584)
17:56:55,622 ERROR [stderr] (http-/127.0.0.1:8080-4) at com.test.CustomWorkItemHandler.executeWorkItem(CustomWorkItemHandler.java:55)
- Also while using
Apache HttpClientlibraries like this:
StringEntity input = new StringEntity(request);
input.setContentType("application/xml");
postRequest.setEntity(input);
HttpResponse httpResponse = httpClient.execute(postRequest);
fails with the following error:
Process Instances failed to start: java.lang.LinkageError:loader constraint violation: when resolving method "org.apache.http.client.methods.HttpPost.setEntity(Lorg/apache/http/HttpEntity;)V" the class loader (instance of org/drools/core/common/ProjectClassLoader$InternalTypesClassLoader) of the current class, com/test/jbpm6/jaxb/customworkitem/TestCustomWorkItemHandler, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for resolved class, org/apache/http/client/methods/HttpPost, have different Class objects for the type tp/HttpEntity;)V used in the signature
Environment
- Red Hat JBoss BPM Suite (BPMS)
- 6.0.1
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
