0
votes

I need to migrate project from Java 7 to Java 8 and deploy it on WAS 9 (before this migration application was running on Java 7 and WAS 8.5) So, I upgraded Java to version 8 and add some necessary dependencies in pom.xml but I get stuck with this errors in log file and actually don't know what should I do to resolve it. Am I missing some dependency? Should I exclude some jar files?

Also, for this project class loader was configured to parent last in Websphere.

Caused by: java.lang.LinkageError: loading constraint violation when resolving method "javax/xml/bind/Unmarshaller.unmarshal(Ljavax/xml/stream/XMLStreamReader;Ljava/lang/Class;)Ljavax/xml/bind/JAXBElement;" : loader "com/ibm/ws/classloader/CompoundClassLoader@ebfd011c" of class "org/apache/cxf/configuration/spring/JAXBBeanFactory" and loader "com/ibm/oti/vm/BootstrapClassLoader@38c22f6e" of class "javax/xml/bind/Unmarshaller" have different types for the method signature at org.apache.cxf.configuration.spring.JAXBBeanFactory.createJAXBBean(JAXBBeanFactory.java:51)

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name AuthenticationServicePort.jms-conduit': Cannot create inner bean '(inner bean)' of type [org.apache.cxf.configuration.spring.JAXBBeanFactory] while setting bean property 'clientConfig'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public static java.lang.Object org.apache.cxf.configuration.spring.JAXBBeanFactory.createJAXBBean(javax.xml.bind.JAXBContext,java.lang.String,java.lang.Class)] threw exception; nested exception is java.lang.LinkageError: loading constraint violation when resolving method "javax/xml/bind/Unmarshaller.unmarshal(Ljavax/xml/stream/XMLStreamReader;Ljava/lang/Class;)Ljavax/xml/bind/JAXBElement;" : loader "com/ibm/ws/classloader/CompoundClassLoader@ebfd011c" of class "org/apache/cxf/configuration/spring/JAXBBeanFactory" and loader "com/ibm/oti/vm/BootstrapClassLoader@38c22f6e" of class "javax/xml/bind/Unmarshaller" have different types for the method signature

Does anybody knows what should I do? Or what I am doing wrong?

Many thanks in advance

1
LinkageErrors like this typically are caused by a cross-visibility between two versions of an API packaged in separate class loaders. Are you including a copy of the JAXB and/or StAX APIs (the two things in that method signature) in your application, with the class loader set to parent-last delegation? If so... removing them might do the trick (they're included in the server/JDK).Jarid
@Jarid basically this project consists of 2 applications. In this one that doesn't work I removed all STAX jar files in lib folder from exported war, and I don't have any JAXB jar files inside lib folder. In other one that works fine I have both JAXB and STAX jar files. Should I remove them also although that application works fine or not?Luka Žugaj
They're probably not doing you any good in the working app, but if it's working, I probably wouldn't recommend changing anything and risking a breakage.Jarid
@Jarid I managed to sort it out somehow. I don’t know if it’s the most correct, but you can take a look in the comment below.Luka Žugaj

1 Answers

0
votes

OK, I figured it out

Here is what I did:

  1. Upgrade jaxb-api dependency to version 2.2
  2. Upgrade jaxb-impl dependency to version 2.1.9
  3. Add cxf-rt-transports-http dependency (version 2.7.11)
  4. Remove all JAXB jar files and STAX jar files from lib folder in exported war, but I left only stax2-api-3.1.4.jar inside it