java.lang.linkageError: loader constraint violation Error | Weblogic
We see many times java.lang.linkageerror when starting weblogic, the following error occurs:
Mar 20, 2013 3:19:49 PM oracle.jdbc.driver.OracleDriver registerMBeans
WARNING: Error while registering Oracle JDBC Diagnosability MBean.
java.lang.LinkageError: loader constraint violation: when resolving method “java.lang.management.ManagementFactory.getPlatformMBeanServer()Ljavax/management/MBeanServer;” the class loader (instance of com/sipra/mass/adhoc/ClassLoader) of the current class, oracle/jdbc/driver/OracleDriver, and the class loader (instance of <bootloader>) for resolved class, java/lang/management/ManagementFactory, have different Class objects for the type javax/management/MBeanServer used in the signature
at oracle.jdbc.driver.OracleDriver.registerMBeans(OracleDriver.java:302)
at oracle.jdbc.driver.OracleDriver$1.run(OracleDriver.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.jdbc.driver.OracleDriver.<clinit>(OracleDriver.java:195)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.cognos.cm.dbstore.CMDbStoreFactory.loadJDBCDriver(CMDbStoreFactory.java:3107)
at com.cognos.cm.dbstore.CMDbStoreFactory.getInitialConnection(CMDbStoreFactory.java:1928)
at com.cognos.cm.dbstore.CMDbStoreFactory.initContentIndependentBeforeLock(CMDbStoreFactory.java:2111)
at com.cognos.cm.dbstore.CMDbStore.initializeContentIndependentBeforeLock(CMDbStore.java:4597)
at com.cognos.cm.server.CMServlet.initializeContentStoreContentIndependentBeforeLock(CMServlet.java:2321)
at com.cognos.cm.server.CMServlet.init(CMServlet.java:2046)
at com.cognos.cm.server.ContentManager.start(ContentManager.java:314)
at com.cognos.cm.server.ContentManagerLifecycleHandler.start(ContentManagerLifecycleHandler.java:73)
at com.cognos.pogo.services.DefaultHandlerService.start(DefaultHandlerService.java:111)
at com.cognos.pogo.services.DispatcherServices.startInititalServices(DispatcherServices.java:426)
at com.cognos.pogo.transport.PogoServlet$PogoStartup.run(PogoServlet.java:688)
at java.lang.Thread.run(Thread.java:619)
The only changes which went in before restarting the weblogic server was max a redeployment or adding new libraries. This is basically a class loading issue. This looks like the class loading from the application was clashing with the class loading by WebLogic Server.In this case we found , it was a JDBC driver, which was required by the application deployed recently.But it can happen with other libraries or classloaders having different classes also.
On our issue, removing JDBC driver from the application WEB-INF folder, solved the issue.
In another instance we saw the exact same error java.lang.LinkageError: loader constraint violation” but it was due to some other class issue. We had to sync up the versions of saaj jar files to make ti working.
Error seen in logs:
java.lang.LinkageError: Class javax/xml/soap/SOAPMessage violates loader
constraints
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
Here we saw in our application, different versions of saaj.jar in different locations ( in the App/lib of .ear, and the WEB-INF/lib/ in the .war of ear). APP/lib/ saaj-api-1.3.jar and WEB-INF/lib/saaj.jar). Here the issue was the classloader was finding 2 different version for the same class and fails to start but when a server is already running and you start the application it use to work as the one class is already loaded. But it usually throws above error and fails if you start the same from command line as it was checking for the versions. We had to finally refactor the classes jar files and kept both versions in sync to make it work. Hope this helps in your part of debugging 🙂
In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.