question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

quarkus-spring-web breaks startup of camel-quarkus-activemq in kubernetes environment

See original GitHub issue

Describe the bug Before writing any classes. starting with quarkus-container-image-jib, quarkus-kubernetes, camel-quarkus-activemq builds successfully and starts up successfully.

However when adding this extension to the pom quarkus-spring-web my quarkus app still builds successfully and pushes to my local kubernetes registry but it fails to start up and I get ClassNotFoundException: java.lang.ClassNotFoundException: org.springframework.beans.factory.InitializingBean

Expected behavior Startup to be successful in kubernetes environment

Actual behavior Startup fails and I get the following exception after adding quarkus-spring-web

C:\Users\Front2\camel-amq-kub>kubectl logs deployments/camel-amq-kub

Exception in thread "main" java.lang.ExceptionInInitializerError
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at java.base/java.lang.Class.newInstance(Class.java:584)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:60)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
        at com.alrawas.Main.main(Main.java:18)
Caused by: java.lang.RuntimeException: Failed to start quarkus
        at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:436)
        ... 8 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/beans/factory/InitializingBean
        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 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 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.apache.camel.component.jms.JmsComponent.createConfiguration(JmsComponent.java:1213)
        at org.apache.camel.component.jms.JmsComponent.<init>(JmsComponent.java:72)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at java.base/java.lang.Class.newInstance(Class.java:584)
        at org.apache.camel.quarkus.core.CamelRecorder.bind(CamelRecorder.java:83)
        at io.quarkus.deployment.steps.CamelRegistryProcessor$bindBeansToRegistry1314779611.deploy_0(CamelRegistryProcessor$bindBeansToRegistry1314779611.zig:113)
        at io.quarkus.deployment.steps.CamelRegistryProcessor$bindBeansToRegistry1314779611.deploy(CamelRegistryProcessor$bindBeansToRegistry1314779611.zig:40)
        at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:416)
        ... 8 more
Caused by: java.lang.ClassNotFoundException: org.springframework.beans.factory.InitializingBean
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        ... 46 more

To Reproduce Steps to reproduce the behavior:

  1. execute this command to create a new project mvn io.quarkus:quarkus-maven-plugin:1.7.2.Final:create -DprojectGroupId=org.acme -DprojectArtifactId=camel-amq-kub

  2. add the first 3 non problematic extensions mvn quarkus:add-extension -Dextensions="camel-quarkus-activemq, quarkus-kubernetes, quarkus-container-image-jib"

  3. add your kubernetes registry properties in application.properties

  4. run mvn clean package -Dquarkus.kubernetes.deploy -Dquarkus.profile=kub -DskipTests and check logs using kubectl logs deployments/camel-amq-kub. Up to this point you should see no exceptions.

  5. add the following extension to the pom

    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-spring-web</artifactId>
    </dependency> 
  1. do step 4 again. you should see the exception now.

Configuration


quarkus.container-image.group=alrawasabed
quarkus.container-image.registry=localhost:5000
quarkus.container-image.insecure=true
quarkus.kubernetes.service-type=node-port

%kub.brokerURL=tcp://host.docker.internal:61616

Environment (please complete the following information):

  • Output of uname -a or ver: Microsoft Windows [Version 10.0.18362.1016]
  • Output of java -version:
OpenJDK Runtime Environment GraalVM CE 20.2.0 (build 11.0.8+10-jvmci-20.2-b03)
OpenJDK 64-Bit Server VM GraalVM CE 20.2.0 (build 11.0.8+10-jvmci-20.2-b03, mixed mode, sharing)
  • Quarkus version or git rev: 1.7.2.Final
  • Build tool (ie. output of mvnw --version or gradlew --version):
Maven home: C:\Users\Front2\.sdkman\candidates\maven\current\bin\..
Java version: 11.0.8, vendor: GraalVM Community, runtime: C:\Users\Front2\.sdkman\candidates\java\current
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
lburgazzolicommented, Sep 9, 2020

it is the first time I see this but yes camel-jms and camel-activemq which is based on it have a dependency on spring as they use spring-jms.

We need to investigate what triggers this issue.

In the meantime, a workaround could be to use camel-sjms or camel-sjms2 as they are based on the jms specs without dependency on spring. An example can be found here https://github.com/apache/camel-quarkus/tree/master/integration-tests/messaging

0reactions
geoandcommented, Oct 19, 2020

Unfortunately a BuildItem is executed way too late for that to be possible.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Define Environment Variables for a Container - Kubernetes
This page shows how to define environment variables for a container in a Kubernetes Pod. Before you begin. You need to have a...
Read more >
Configure Liveness, Readiness and Startup Probes
This page shows how to configure liveness, readiness and startup probes for containers. The kubelet uses liveness probes to know when to ...
Read more >
Overview - Kubernetes
This page is an overview of Kubernetes. Kubernetes is a portable, extensible, open source platform for managing containerized workloads and ...
Read more >
StatefulSets - Kubernetes
Parallel pod management tells the StatefulSet controller to launch or terminate all Pods in parallel, and to not wait for Pods to become...
Read more >
Disruptions | Kubernetes
how long it takes a new instance to start up; the type of controller; the cluster's resource capacity. Pod disruption conditions. FEATURE STATE: ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found