java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "org/apache/openjpa/conf/OpenJPAConfiguration"

Apache's JIRA Issue Tracker | Jeremy Bauer | 7 years ago
  1. 0

    [OPENJPA-1410] Class linkage exception when creating an EMF with OpenJPA M3 - ASF JIRA

    apache.org | 1 year ago
    java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "org/apache/openjpa/conf/OpenJPAConfiguration"
  2. 0

    [OPENJPA-1410] Class linkage exception when creating an EMF with OpenJPA M3 - ASF JIRA

    apache.org | 1 year ago
    java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "org/apache/openjpa/conf/OpenJPAConfiguration"
  3. 0

    Posted by Seth Jackson on the user forum[1]. It appears something was modified in OpenJPA 2.0 M3 from M2 that causes a LinkageError. In my current environment, I've tested both Glassfish and Tomcat using M2 and M3. M2 runs without problems, but M3 throws a linkage error as follows: Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "org/apache/openjpa/conf/OpenJPAConfiguration" at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(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:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at org.apache.openjpa.persistence.validation.ValidationUtils.setupValidation(ValidationUtils.java:53) at org.apache.openjpa.persistence.PersistenceProviderImpl.loadValidator(PersistenceProviderImpl.java:290) at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:97) at org.apache.openjpa.persistence.OpenJPAPersistence.createEntityManagerFactory(OpenJPAPersistence.java:128) at org.apache.openjpa.persistence.OpenJPAPersistence.createEntityManagerFactory(OpenJPAPersistence.java:111) at test_test.user.UserAction.execute(UserAction.java:39) I've already confirmed that the OpenJPA classes in question do NOT exist in any other JARs in the path. ValidationUtils.setupValidation(ValidationUtils.java:53) calls the OpenJPAConfiguration.getConfigurationLog(). The object being referenced is JDBCConfigurationImpl, which in other classes retrieves the log reference perfectly fine, before it gets to the offending line. Seth's follow up[2]: After further review, using Glassfish 2.1.1 I received this error message in the server log: Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.openjpa.persistence.validation.ValidationUtils.setupValidation(Lorg/apache/openjpa/conf/OpenJPAConfiguration;)Z" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, org/apache/openjpa/persistence/PersistenceProviderImpl, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for resolved class, org/apache/openjpa/persistence/validation/ValidationUtils, have different Class objects for the type org/apache/openjpa/conf/OpenJPAConfiguration used in the signature So it appears to be the WebappClassLoader and the AppClassLoader are both loading the OpenJPAConfiguration from the same JAR file, causing the error when the class is trying to be resolved in this particular method. [1] http://n2.nabble.com/Struts-2x-OpenJPA-2-0-M3-Tomcat-or-Glassfish-tp4087312p4087312.html [2] http://n2.nabble.com/Struts-2x-OpenJPA-2-0-M3-Tomcat-or-Glassfish-tp4087312p4093228.html

    Apache's JIRA Issue Tracker | 7 years ago | Jeremy Bauer
    java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "org/apache/openjpa/conf/OpenJPAConfiguration"
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Posted by Seth Jackson on the user forum[1]. It appears something was modified in OpenJPA 2.0 M3 from M2 that causes a LinkageError. In my current environment, I've tested both Glassfish and Tomcat using M2 and M3. M2 runs without problems, but M3 throws a linkage error as follows: Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "org/apache/openjpa/conf/OpenJPAConfiguration" at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(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:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at org.apache.openjpa.persistence.validation.ValidationUtils.setupValidation(ValidationUtils.java:53) at org.apache.openjpa.persistence.PersistenceProviderImpl.loadValidator(PersistenceProviderImpl.java:290) at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:97) at org.apache.openjpa.persistence.OpenJPAPersistence.createEntityManagerFactory(OpenJPAPersistence.java:128) at org.apache.openjpa.persistence.OpenJPAPersistence.createEntityManagerFactory(OpenJPAPersistence.java:111) at test_test.user.UserAction.execute(UserAction.java:39) I've already confirmed that the OpenJPA classes in question do NOT exist in any other JARs in the path. ValidationUtils.setupValidation(ValidationUtils.java:53) calls the OpenJPAConfiguration.getConfigurationLog(). The object being referenced is JDBCConfigurationImpl, which in other classes retrieves the log reference perfectly fine, before it gets to the offending line. Seth's follow up[2]: After further review, using Glassfish 2.1.1 I received this error message in the server log: Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.openjpa.persistence.validation.ValidationUtils.setupValidation(Lorg/apache/openjpa/conf/OpenJPAConfiguration;)Z" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, org/apache/openjpa/persistence/PersistenceProviderImpl, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for resolved class, org/apache/openjpa/persistence/validation/ValidationUtils, have different Class objects for the type org/apache/openjpa/conf/OpenJPAConfiguration used in the signature So it appears to be the WebappClassLoader and the AppClassLoader are both loading the OpenJPAConfiguration from the same JAR file, causing the error when the class is trying to be resolved in this particular method. [1] http://n2.nabble.com/Struts-2x-OpenJPA-2-0-M3-Tomcat-or-Glassfish-tp4087312p4087312.html [2] http://n2.nabble.com/Struts-2x-OpenJPA-2-0-M3-Tomcat-or-Glassfish-tp4087312p4093228.html

    Apache's JIRA Issue Tracker | 7 years ago | Jeremy Bauer
    java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "org/apache/openjpa/conf/OpenJPAConfiguration"
  6. 0

    This job was working yesterday using version 1.514. Today, it started failing, and I don't know why. This is the stacktrace: {noformat} [INFO] --- maven-surefire-plugin:2.10:test (default-test) @ api-client --- [INFO] Surefire report directory: /var/lib/jenkins/workspace/android-gerrit-verify-api-client/target/surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running JsonRpcCodecTest WARNING: no system properties value for ro.build.date.utc Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.196 sec Running JsonCodecTest Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.085 sec Results : Tests run: 5, Failures: 0, Errors: 0, Skipped: 0 [JENKINS] Recording test results java.lang.reflect.InvocationTargetException 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:616) at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239) at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158) at hudson.maven.Maven3Builder.call(Maven3Builder.java:100) at hudson.maven.Maven3Builder.call(Maven3Builder.java:66) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:636) Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "com/google/common/base/Predicate" at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:637) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:277) at java.net.URLClassLoader.access$000(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:212) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336) at com.google.common.collect.Iterators$7.computeNext(Iterators.java:649) at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143) at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138) at hudson.maven.reporters.SurefireArchiver.postExecute(SurefireArchiver.java:145) at hudson.maven.Maven3Builder$MavenExecutionListener.recordMojoEnded(Maven3Builder.java:453) at hudson.maven.Maven3Builder$MavenExecutionListener.mojoSucceeded(Maven3Builder.java:435) at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:87) at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:42) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:228) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79) ... 18 more channel stopped ERROR: Failed to parse POMs hudson.util.IOException2: java.lang.reflect.InvocationTargetException at hudson.maven.Maven3Builder.call(Maven3Builder.java:162) at hudson.maven.Maven3Builder.call(Maven3Builder.java:66) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:636) Caused by: java.lang.Exception: java.lang.reflect.InvocationTargetException at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:161) at hudson.maven.Maven3Builder.call(Maven3Builder.java:100) ... 10 more Caused by: java.lang.reflect.InvocationTargetException 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:616) at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239) at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158) ... 11 more Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "com/google/common/base/Predicate" at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:637) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:277) at java.net.URLClassLoader.access$000(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:212) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336) at com.google.common.collect.Iterators$7.computeNext(Iterators.java:649) at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143) at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138) at hudson.maven.reporters.SurefireArchiver.postExecute(SurefireArchiver.java:145) at hudson.maven.Maven3Builder$MavenExecutionListener.recordMojoEnded(Maven3Builder.java:453) at hudson.maven.Maven3Builder$MavenExecutionListener.mojoSucceeded(Maven3Builder.java:435) at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:87) at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:42) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:228) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79) ... 18 more {noformat} Where should I start with debugging this?

    Jenkins JIRA | 4 years ago | Joe Hansche
    java.lang.reflect.InvocationTargetException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.LinkageError

      loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "org/apache/openjpa/conf/OpenJPAConfiguration"

      at java.lang.ClassLoader.defineClass1()
    2. Java RT
      ClassLoader.loadClassInternal
      1. java.lang.ClassLoader.defineClass1(Native Method)
      2. java.lang.ClassLoader.defineClass(ClassLoader.java:621)
      3. java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
      4. java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
      5. java.net.URLClassLoader.access$000(URLClassLoader.java:56)
      6. java.net.URLClassLoader$1.run(URLClassLoader.java:195)
      7. java.security.AccessController.doPrivileged(Native Method)
      8. java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      9. java.lang.ClassLoader.loadClass(ClassLoader.java:307)
      10. sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      11. java.lang.ClassLoader.loadClass(ClassLoader.java:252)
      12. java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
      12 frames
    3. OpenJPA Aggregate Jar
      PersistenceProviderImpl.createEntityManagerFactory
      1. org.apache.openjpa.persistence.validation.ValidationUtils.setupValidation(ValidationUtils.java:53)
      2. org.apache.openjpa.persistence.PersistenceProviderImpl.loadValidator(PersistenceProviderImpl.java:316)
      3. org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:100)
      4. org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:151)
      5. org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:62)
      5 frames
    4. JavaEE 7
      Persistence.createEntityManagerFactory
      1. javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:150)
      2. javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:70)
      2 frames