Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.LinkageError from quarkus:dev, using entities from external jars #6978

Closed
tgippi opened this issue Feb 3, 2020 · 2 comments
Closed
Labels
kind/bug Something isn't working
Milestone

Comments

@tgippi
Copy link

tgippi commented Feb 3, 2020

Describe the bug
Quarkus startup with mvn quarkus:dev fails with java.lang.LinkageError, as soon as we use quarkus.index-dependency for external dependencies which contain javax.persistence annotated classes (e.g. JPA Entities).
It doesn't happen when we run the packaged jar file directly by using java -jar target/getting-started-1.0-SNAPSHOT-runner.jar

Expected behavior
Startup with mvn quarkus:dev should not fail with java.lang.LinkageError

Actual behavior
Quarkus fails to start when we use mvn quarkus:dev, complaining about java.lang.LinkageError.

To Reproduce
Steps to reproduce the behavior:

  1. git clone [email protected]:tgippi/quarkus-issue.git
  2. mvn quarkus:dev

Configuration

quarkus.datasource.url=jdbc:h2:mem:test
quarkus.datasource.driver=org.h2.Driver

quarkus.index-dependency.axon-messaging.group-id=org.axonframework
quarkus.index-dependency.axon-messaging.artifact-id=axon-messaging
quarkus.index-dependency.axon-eventsourcing.group-id=org.axonframework
quarkus.index-dependency.axon-eventsourcing.artifact-id=axon-eventsourcing
quarkus.index-dependency.axon-configuration.group-id=org.axonframework
quarkus.index-dependency.axon-configuration.artifact-id=axon-configuration

Screenshots

2020-02-03 20:42:53,467 ERROR [io.qua.application] (main) Failed to start application: java.lang.LinkageError: loader constraint violation: loader 'app' wants to load interface org.axonframework.common.jpa.EntityManagerProvider. A different interface with the same name was previously loaded by io.quarkus.runner.RuntimeClassLoader @15b3e5b. (org.axonframework.common.jpa.EntityManagerProvider is in unnamed module of loader io.quarkus.runner.RuntimeClassLoader @15b3e5b, parent loader java.net.URLClassLoader @548ad73b)
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at org.axonframework.config.AggregateConfigurer.jpaMappedConfiguration(AggregateConfigurer.java:183)
        at org.acme.quickstart.AxonStarter.startup(AxonStarter.java:28)
        at org.acme.quickstart.AxonStarter_Observer_startup_f43ab41051de39ca1e534f6cd06115c3c9b219b8.notify(AxonStarter_Observer_startup_f43ab41051de39ca1e534f6cd06115c3c9b219b8.zig:111)
        at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:282)
        at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:267)
        at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:69)
        at io.quarkus.arc.runtime.LifecycleEventRunner.fireStartupEvent(LifecycleEventRunner.java:23)
        at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:108)
        at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent36.deploy_0(LifecycleEventsBuildStep$startupEvent36.zig:58)
        at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent36.deploy(LifecycleEventsBuildStep$startupEvent36.zig:77)
        at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:185)
        at io.quarkus.runtime.Application.start(Application.java:87)
        at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:167)
        at io.quarkus.dev.DevModeMain.doStart(DevModeMain.java:178)
        at io.quarkus.dev.DevModeMain.start(DevModeMain.java:96)
        at io.quarkus.dev.DevModeMain.main(DevModeMain.java:67)

2020-02-03 20:42:53,476 ERROR [io.qua.dev.DevModeMain] (main) Failed to start Quarkus: java.lang.RuntimeException: Failed to start quarkus
        at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:215)
        at io.quarkus.runtime.Application.start(Application.java:87)
        at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:167)
        at io.quarkus.dev.DevModeMain.doStart(DevModeMain.java:178)
        at io.quarkus.dev.DevModeMain.start(DevModeMain.java:96)
        at io.quarkus.dev.DevModeMain.main(DevModeMain.java:67)
Caused by: java.lang.LinkageError: loader constraint violation: loader 'app' wants to load interface org.axonframework.common.jpa.EntityManagerProvider. A different interface with the same name was previously loaded by io.quarkus.runner.RuntimeClassLoader @15b3e5b. (org.axonframework.common.jpa.EntityManagerProvider is in unnamed module of loader io.quarkus.runner.RuntimeClassLoader @15b3e5b, parent loader java.net.URLClassLoader @548ad73b)
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at org.axonframework.config.AggregateConfigurer.jpaMappedConfiguration(AggregateConfigurer.java:183)
        at org.acme.quickstart.AxonStarter.startup(AxonStarter.java:28)
        at org.acme.quickstart.AxonStarter_Observer_startup_f43ab41051de39ca1e534f6cd06115c3c9b219b8.notify(AxonStarter_Observer_startup_f43ab41051de39ca1e534f6cd06115c3c9b219b8.zig:111)
        at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:282)
        at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:267)
        at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:69)
        at io.quarkus.arc.runtime.LifecycleEventRunner.fireStartupEvent(LifecycleEventRunner.java:23)
        at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:108)
        at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent36.deploy_0(LifecycleEventsBuildStep$startupEvent36.zig:58)
        at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent36.deploy(LifecycleEventsBuildStep$startupEvent36.zig:77)
        at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:185)
        ... 5 more

Environment (please complete the following information):

  • Output of uname -a or ver: Linux tobi-Z97-HD3 4.15.0-76-generic #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  • Output of java -version: openjdk version "11.0.6" 2020-01-14 OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1) OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode, sharing)
  • GraalVM version (if different from Java): None
  • Quarkus version or git rev: 1.2.0.Final

Additional context
Not sure if it is exactly the same issue #5354, so I opened a new one.
However, using the latest version 1.2.0.Final won't fix it for the reproducer project in #5354.

@tgippi tgippi added the kind/bug Something isn't working label Feb 3, 2020
@tgippi
Copy link
Author

tgippi commented Feb 6, 2020

I've just tested it on the 1.3 branch. It seems the issue has been fixed there (I guess #6411 has fixed it?)

@stuartwdouglas
Copy link
Member

This was a known problem that should be fixed by the classloader change (I think it is a duplicate of #5354)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants