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

Kubernetes CRD ClassNotFoundException after upgrade to 1.11.2.Final in dev mode #15250

Closed
lkrzyzanek opened this issue Feb 22, 2021 · 10 comments · Fixed by #15337
Closed

Kubernetes CRD ClassNotFoundException after upgrade to 1.11.2.Final in dev mode #15250

lkrzyzanek opened this issue Feb 22, 2021 · 10 comments · Fixed by #15337
Assignees
Labels
Milestone

Comments

@lkrzyzanek
Copy link
Contributor

Describe the bug
Upgrade 1.11.1.Final -> 1.11.2.Final breaks mvn quarkus:dev with Kubernetes CRD.
Quarkus cannot find my CRD's Spec model class used in this CRD: https://github.com/websitecd/operator/blob/main/service/src/main/java/io/websitecd/operator/crd/Website.java

Only mvn quarkus:dev is affected. Normal jar build (resp. quarkus tests) works correctly.

Expected behavior
mvn quarkus:dev should start

Actual behavior
After strart

2021-02-22 21:07:28,941 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile dev): java.lang.ClassNotFoundException: io.websitecd.operator.crd.WebsiteSpec
	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:522)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:428)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:378)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:315)
	at io.fabric8.kubernetes.client.CustomResource.getInstantiator(CustomResource.java:309)
	at io.fabric8.kubernetes.client.CustomResource.genericInit(CustomResource.java:337)
	at io.fabric8.kubernetes.client.CustomResource.initSpec(CustomResource.java:117)
	at io.fabric8.kubernetes.client.CustomResource.<init>(CustomResource.java:108)
	at io.websitecd.operator.crd.Website.<init>(Website.java:20)
	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 io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext.fromCustomResourceType(CustomResourceDefinitionContext.java:116)
	at io.fabric8.openshift.client.DefaultOpenShiftClient.customResources(DefaultOpenShiftClient.java:480)
	at io.websitecd.operator.controller.WebsiteController.initWebsiteCrd(WebsiteController.java:71)
	at io.websitecd.operator.controller.WebsiteController.onStart(WebsiteController.java:66)
	at io.websitecd.operator.controller.WebsiteController_Observer_onStart_fd71b5e0b207b7d1ef838b94eaeff75e52b8f463.notify(WebsiteController_Observer_onStart_fd71b5e0b207b7d1ef838b94eaeff75e52b8f463.zig:147)
	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:60)
	at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent-858218658.deploy_0(LifecycleEventsBuildStep$startupEvent-858218658.zig:81)
	at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent-858218658.deploy(LifecycleEventsBuildStep$startupEvent-858218658.zig:40)
	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:686)
	at io.quarkus.runtime.Application.start(Application.java:90)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:97)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:119)
	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.runner.bootstrap.StartupActionImpl$3.run(StartupActionImpl.java:134)
	at java.base/java.lang.Thread.run(Thread.java:834)

To Reproduce
Try to upgrade quarkus version in this project (module service)
https://github.com/websitecd/operator

Environment (please complete the following information):

  • Output of uname -a or ver:
  • Output of java -version: 11
  • GraalVM version (if different from Java):
  • Quarkus version or git rev: 1.11.2.Final
  • Build tool (ie. output of mvnw --version or gradlew --version): 3.6.3
@lkrzyzanek lkrzyzanek added the kind/bug Something isn't working label Feb 22, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 22, 2021

/cc @geoand

@geoand
Copy link
Contributor

geoand commented Feb 22, 2021

Does the same problem occur with 1.11.3?

@lkrzyzanek
Copy link
Contributor Author

Yes 1.11.3 is affected as well. Just wanted to highlight that the issue was introduced in 1.11.2.

@geoand
Copy link
Contributor

geoand commented Feb 22, 2021

@iocanel want to take a look?

@metacosm
Copy link
Contributor

metacosm commented Feb 23, 2021

A workaround should be available in Fabric8 kubernetes-client 5.1, which you can use by putting the kubernetes-client-bom before the quarkus-bom in your dependency-management section of your pom file. The fix might not work in all situations, though. Could you please give it a try and see if it addresses your issue, @lkrzyzanek? By the way, have you looked into https://github.com/java-operator-sdk/java-operator-sdk?

@gsmet
Copy link
Member

gsmet commented Feb 23, 2021

@metacosm how serious is this issue? Should I backport the 5.1.0 upgrade?

@lkrzyzanek
Copy link
Contributor Author

Workaround works.

pom snippet:

    <properties>
        <maven.compiler.target>11</maven.compiler.target>
        <maven.compiler.source>11</maven.compiler.source>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <maven.compiler.parameters>true</maven.compiler.parameters>
        <surefire-plugin.version>2.22.1</surefire-plugin.version>
        <compiler-plugin.version>3.8.1</compiler-plugin.version>

        <!-- Be sure that mvn clean install and also mvn quarkus:dev works !!! -->
        <quarkus.platform.version>1.11.3.Final</quarkus.platform.version>
        <fabric8-client.version>5.1.0</fabric8-client.version>
        <snakeyaml.version>1.27</snakeyaml.version>
        <fabric8.client.version>5.0.1</fabric8.client.version>

        <!-- By default just do maven install and let github to do the deploy on release -->
        <release.goal>install</release.goal>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.fabric8</groupId>
                <artifactId>kubernetes-client-bom</artifactId>
                <version>${fabric8-client.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-universe-bom</artifactId>
                <version>${quarkus.platform.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

@metacosm
Copy link
Contributor

Thanks for checking.

@metacosm
Copy link
Contributor

@metacosm how serious is this issue? Should I backport the 5.1.0 upgrade?

I'm trying to figure out what's the best way. Ideally, we'd release a 5.1.1 with a better fix and backport this.

@metacosm
Copy link
Contributor

@gsmet if all goes well, 5.1.1 should be released tomorrow. Backporting the upgrade to the 1.11 line should probably be a good idea if practical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants