Exception while running Bamboo Plugin - java

I am developing a bamboo plugin, while running this plugin.
This is the error that I get:
java.lang.LinkageError : loader constraint violation: when resolving method "com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.setContentHandler(Lorg/xml/sax/ContentHandler;)V" the class loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoader) of the current class, com/gargoylesoftware/htmlunit/html/HTMLParser$HtmlUnitDOMBuilder, and the class loader (instance of org/apache/catalina/loader/WebappClassLoader) for resolved class, com/gargoylesoftware/htmlunit/html/HTMLParser$HtmlUnitDOMBuilder, have different Class objects for the type used in the signature)
Any clue or Suggestion on how to resolve this?
Thanks in Advance,
Abhishek

Related

i am moving my existing project(present in was 9) to jboss eap 7.3

Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "org.springframework.context.support.AbstractXmlApplicationContext.(Lorg/springframework/context/ApplicationContext;)V" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/springframework/context/support/ClassPathXmlApplicationContext, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for the method's defining class, org/springframework/context/support/AbstractXmlApplicationContext, have different Class objects for the type org/springframework/context/ApplicationContext used in the signature
i have included spring 4.3.24 jars in lib and as dependency..

LinkageError :Caused by: java.lang.LinkageError: loader constraint violation: when resolving field "DATETIME"

I am facing an issue. Not able to get the solution if any one can help me. I am implementing JAXB in my code for XML validation through XSD and XSLT. Error is a class conflicting between JRE and Weblogic server. Application is not able to understand which to refer.
Java version: 7
Weblogic: 10.3.3 (Weblogic 11g)
Caused by: java.lang.LinkageError: loader constraint violation: when resolving field "DATETIME" the class loader (instance of weblogic/utils/classloaders/ChangeAwareClassLoader) of the referring class, javax/xml/datatype/DatatypeConstants, and the class loader (instance of <bootloader>) for the field's resolved type, loader constraint violation: when resolving field "DATETIME" the class loader
at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.<clinit>(RuntimeBuiltinLeafInfoImpl.java:224)
at com.sun.xml.bind.v2.model.impl.RuntimeTypeInfoSetImpl.<init>(RuntimeTypeInfoSetImpl.java:61)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:127)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:79)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.<init>(ModelBuilder.java:151)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.<init>(RuntimeModelBuilder.java:87)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:422)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:372)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
Thank you in advance for the help.
Here in the logs error was showing that conflict was in DataTypeConstants. Actually I analysed the conflicts of classes in weblogic. Then I came to know that DataTypeConstants name was not present in the conflicts. My error was coming on the line:
JAXBContext obj = JAXBContext.newInstance(MyClass.class);
On this line NullPointerException was shown. Jaxb-api.jar was present in my library , so JAXBContext was loading from their , inside that DataTypeConstants was getting conflict. I removed my Jaxb-api.jar and then weblogic took my JAXBContext and DataTypeConstants both from rt.jar of JRE. As both the classes were in one jar rt.jar got the preference to load DataTypeConstants.
To know how to analyse conflicts of classes in weblogic, Below are the links which will help.
Visit https://dzone.com/articles/weblogic-classloader-analysis
and https://blog.eisele.net/2011/01/using-new-weblogic-classloader-analysis.html

java.lang.LinkageError: loader constraint violation for Spring MVC and Thymeleaf

I am building my application using Spring MVC and Thymeleaf. I am also using Log4j for Logging.
While invoking one of the service where the Thymeleaf Template is getting loaded I get the following Error:
Handler dispatch failed; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of org/apache/catalina/loader/ParallelWebappClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of java/net/URLClassLoader) for the method's defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature
This error is thrown when the following line of code is executed:
ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
If I invoke the same Service Again(without making any changes or restart/clean of Server) I am getting a different Error:
Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.thymeleaf.templateresolver.ClassLoaderTemplateResolver
The gradle config file is:
compile group: 'org.thymeleaf', name: 'thymeleaf', version: '3.0.11.RELEASE'
compile group: 'org.thymeleaf', name: 'thymeleaf-spring4', version: '3.0.11.RELEASE'
Server used - Tomcat.
Any help is highly appreciated.
It would seem that you have the slf4j jar file in both the root class loader, and your webapp's WAR file. Try using maven to mark it as 'provided', so it doesn't get in the WAR. Then java won't get confused about the same classes being loaded in multiple class loaders.

Removing javax/rmi/CORBA corba jars from Jboss

QDeploying a service on JBOSS EAP 6.4 fetches an linking error while calling and ejb hosted on Jboss.I want to override the orb implementation but get the linkage error
Can someone help me with the steps to exclude this jboss rmi jar.
I tried excluding it in jboss deployment structure but in vain.
loader constraint violation in interface itable initialization: when resolving method
"com.ibm.rmi.io.ValueHandlerImpl.readValue(Lorg/omg/CORBA/portable/InputStream;ILjava/lang/Class;Ljava/lang/String;Lorg/omg/SendingContext/RunTime;)Ljava/io/Serializable;"
the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, com/ibm/rmi/io/ValueHandlerImpl,
and the class loader (instance of org/jboss/modules/ModuleClassLoader) for interface
javax/rmi/CORBA/ValueHandler have different Class objects for the type java/lang/Class;Ljava/lang/String;Lorg/omg/SendingContext/RunTime;)
Ljava/io/Serializable; used in the signature

How to select version of library to use in OSGI bundle

I develop jira plugin, where I should send email with images.
There is one bug with javax.mail-1.4.5, that was fixed in javax.mail-1.4.7
I tried a lot, but was not able when plugin deployed on jira tell to use my version of javax.mail (1.4.7). It all the time use javax.mail-1.4.5 from root class loader.
I all the time recieve next Exception:
java.lang.LinkageError: loader constraint violation: when resolving overridden method "javax.mail.internet.MimeMessage.getDataHandler()Ljavax/activation/DataHandler;" the class loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoader) of the current class, javax/mail/internet/MimeMessage, and its superclass loader (instance of org/apache/catalina/loader/WebappClassLoader), have different Class objects for the type getDataHandler used in the signature
at com.solarwinds.MailSenderJob.buildSimpleMessage(MailSenderJob.java:163)
My question is next: how to tell OSGi, that here I would like to use another version of library?
Add the specific library to the class path of your project. Or if you're using Maven, simply edit the pom.xml file.

Categories

Resources