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
Related
I am trying to instrument service method of javax.servlet.Servlet interface implementations as following:
.transform(
new AgentBuilder.Transformer.ForAdvice()
.include(MyAgent.class.getClassLoader())
.advice(
named("service")
.and(takesArgument(0, ServletRequest.class))
.and(takesArgument(1, ServletResponse.class))
, "com.MyAdvice"
)
)
Now, if I attach this agent to an already running Spring boot application via agentmain - I see below exception on trying to access any web page
java.lang.LinkageError: loader constraint violation: when resolving method 'void javax.servlet.http.HttpServletRequestWrapper.<init>(javax.servlet.http.HttpServletRequest)'
the class loader org.springframework.boot.loader.LaunchedURLClassLoader #18be83e4 of the current class,
org/springframework/web/servlet/resource/ResourceUrlEncodingFilter$ResourceUrlEncodingRequestWrapper, and the class loader 'app' for the method's defining class, javax/servlet/http/HttpServletRequestWrapper,
have different Class objects for the type javax/servlet/http/HttpServletRequest used in the signature (org.springframework.web.servlet.resource.ResourceUrlEncodingFilter$ResourceUrlEncodingRequestWrapper is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader #18be83e4, parent loader 'app'; javax.servlet.http.HttpServletRequestWrapper is in unnamed module of loader 'app')
I understand its because javax/servlet/http/HttpServletRequest instance is loaded from 2 different jars - one that came through agent and another through spring boot embedded tomcat. If I try to set scope as provided in agent's pom.xml [ since I do not want to include servlet-api in agent bundled jar and try use already provided servlet-api implementation from Spring boot ], I get Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletRequest - possibly because the classloader loading the agent can't see spring boot provided servlet api.
Is there any possible workaround or fix to resolve this situation? Thank you for your time and feedback.
Ideally, your agent does not contain such classes. Rather, match classes by their name: takesArgument(0, named("javax.servlet.ServletRequest")), for instance.
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.
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.
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
I'm deploying an ear to JBoss and when I start the server I get this exception thrown:
Caused by: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "ch.qos.logback.classic.LoggerContext.getLogger(Ljava/lang/String;)Lorg/slf4j/Logger;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, ch/qos/logback/classic/LoggerContext, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for interface org/slf4j/ILoggerFactory have different Class objects for the type ;)Lorg/slf4j/Logger; used in the signature
I have an EAR project and in the deployment assembly I include logback-classic/logback-core/ and slf4j-api. When I do this, the three jars automatically get placed in the EAR Libraries folder in the build paths of 2 other ejb projects (which are both packaged as jars and referenced in the deployment assembly of the EAR)
not sure why this is happening.. Also, when I dont put the jars in the deployment assembly of the EAR, I link them in the build path of the 2 ejb projects directly, but when I deploy the ear JBoss throws noClassFound exception on slf4j/Logger..
any ideas?
Fixed this issue.. I had to edit my jboss-deployment-structure.xml and add the main deployment with exclusions in addition to the sub-deployments that I had.