LinkageError with Jenkins on WebLogic

My Jenkins 1.613 runs on WebLogic 12c as well as on JBoss EAP 6.3. I managed to get the Jenkins email-ext plugin working on JBoss. However, whenever I use tokens like $ PROJECT_NAME, the email-ext plugin does not work in WebLogic (works fine on JBoss, I have to stress again).

I get the following stack, which seems to indicate some problem with the tokenmacro plugin.

java.lang.LinkageError: loader constraint violation: when resolving method "com.google.common.collect.Multimaps.newListMultimap( java/util/Map; com/google/common/base/Supplier;) com/google/common/collect/ListMultimap;" the class loader (instance of hudson/ClassicPluginStrategy$AntClassLoader2) of the current class, org/jenkinsci/plugins/tokenmacro/Tokenizer, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for resolved class, com/google/common/collect/Multimaps, have different Class objects for the type ap; com/google/common/base/Supplier;) com/google/common/collect/ListMultimap; used in signature at org.jenkinsci.plugins.tokenmacro.Tokenizer.find(Tokenizer.java:109) at org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:167) at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:233) at hudson.plugins.emailext.plugins.ContentBuilder.transformText(ContentBuilder.java:71) at hudson.plugins.emailext.ExtendedEmailPublisher.setSubject(ExtendedEmailPublisher.java:659) 

Questions:

  • Based on my understanding of this trace, the problem is that there are conflicting copies of the loaded Multimaps class? It is right?
  • Why use multiple class loaders (AntClassLoader2 and AppClassLoader)? Shouldn't it be that after the classloader finds the required class, it simply "returns" this class and delegates the loading of classes to the parent class loaders only when it does not find the class?
  • Why does my setup work in JBoss, but not in WebLogic?
  • What can be done to solve this problem? I tried placing Guava 11 in WEB-INF for the tokenmacro plugin directory, but that does not help. I also tried the same with Guava 13.

Additional information that may be helpful:

  • Installed version of Plugen Macro Plugin - 1.10
  • The extension version for the email extension is 2.40.5
  • In my jenkins.war, I have a weblogic.xml file where wls: prefer-web-inf-classes is set to true.
+6
source share
3 answers

1.) I would accept the same.

2.a (multiple classloaders): application containers like JBoss have special classloaders. They serve to separate classes in different applications. You should be able to use any version of the class in your application, regardless of the version used in another application.

Therefore, two classes are considered different if they have the same name but different class loaders.

Problems arise when two applications receive a β€œcontact” or where classes are provided by the container. I would suggest that the problem is that Guava is provided by WebLogic.

In addition, Jenkins is a kind of application container, it must share different plugins, therefore AntClassLoader2.

2b (Class division): Usually it's just the opposite: always ask the parent class loader, if he cannot find the class, try to find it yourself. But the whole story is much more complicated (to get an idea, see https://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html , maybe there is other similar documentation for WebLogic).

3) As a first premise, I would like to check if WebLogic (as your instance) supports Guava.

4) I would try to isolate the problem and make it reproducible by writing a small webapp that uses the Provider. Perhaps I would search and read the documentation on how class loading is handled in WebLogic.

+3
source

I can check ext tempate email but cannot send.

+1
source

You must force the Application classes to load before the Weblogic classes, you can achieve this by forcing it to use the application-preference directive packages as described here: http://docs.oracle.com/cd/E24329_01/web.1211/e21049/weblogic_xml. htm # WBAPP592

this is an example extracted by one of my production applications: a file located inside the EAR package in the application / META -INF / weblogic-application.xml

 <?xml version="1.0" encoding="UTF-8"?> <weblogic-application xmlns="http://xmlns.oracle.com/weblogic/weblogic-application" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_5.xsd http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.0/weblogic-application.xsd"> <classloader-structure> <module-ref> <module-uri>j2ee-connector.rar</module-uri> </module-ref> <module-ref> <module-uri>ejb-1.0-SNAPSHOT.jar</module-uri> </module-ref> </classloader-structure> <prefer-application-packages> <package-name>org.slf4j.*</package-name> <package-name>org.apache.commons.logging.*</package-name> <package-name>org.apache.commons.io.*</package-name> <package-name>ch.qos.logback.*</package-name> </prefer-application-packages> <prefer-application-resources> <resource-name>org/slf4j/impl/StaticLoggerBinder.class</resource-name> </prefer-application-resources> </weblogic-application> 

part of preference application packages and optional application resources (depending on how your code works) is important here.

put com.google.common. *

I know that Jenkins is just an ordinary war, not an ear, so you can create a maven project that includes war and determine how to load packages inside your ear or see the documentation and directly modify war descriptors using weblogic.xml and documented preferences -web-inf-classes and set it right.

0
source

All Articles