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

NoSuchMethodException: org.apache.camel.service.lra.LRASagaRoutes.<init>() #1840

Closed
ppalaga opened this issue Sep 25, 2020 · 4 comments · Fixed by #1873
Closed

NoSuchMethodException: org.apache.camel.service.lra.LRASagaRoutes.<init>() #1840

ppalaga opened this issue Sep 25, 2020 · 4 comments · Fixed by #1873
Labels
bug Something isn't working
Milestone

Comments

@ppalaga
Copy link
Contributor

ppalaga commented Sep 25, 2020

Happens also in JVM mode

2020-09-25 14:30:12,688 ERROR [io.qua.application] (main) Failed to start application (with profile test): java.lang.RuntimeException: java.lang.RuntimeException: org.apache.camel.RuntimeCamelException: java.lang.NoSuchMethodException: org.apache.camel.service.lra.LRASagaRoutes.<init>()
        at org.apache.camel.quarkus.core.CamelContextRecorder.addRoutes(CamelContextRecorder.java:87)
        at io.quarkus.deployment.steps.CamelContextProcessor$runtime-2011798157.deploy_0(CamelContextProcessor$runtime-2011798157.zig:77)
        at io.quarkus.deployment.steps.CamelContextProcessor$runtime-2011798157.deploy(CamelContextProcessor$runtime-2011798157.zig:40)
        at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:587)
        at io.quarkus.runtime.Application.start(Application.java:90)
        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.run(StartupActionImpl.java:212)
        at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:232)
        at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:504)
        at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:537)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$7(ClassBasedTestDescriptor.java:359)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:359)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:189)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:78)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:132)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
        at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
        at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220)
        at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188)
        at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:150)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:124)
        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
Caused by: java.lang.RuntimeException: org.apache.camel.RuntimeCamelException: java.lang.NoSuchMethodException: org.apache.camel.service.lra.LRASagaRoutes.<init>()
        at org.apache.camel.quarkus.core.CamelContextRecorder.addRoutes(CamelContextRecorder.java:96)
        at org.apache.camel.quarkus.core.CamelContextRecorder.addRoutes(CamelContextRecorder.java:83)
        ... 49 more
Caused by: org.apache.camel.RuntimeCamelException: java.lang.NoSuchMethodException: org.apache.camel.service.lra.LRASagaRoutes.<init>()
        at org.apache.camel.support.ObjectHelper.newInstance(ObjectHelper.java:222)
        at org.apache.camel.impl.engine.DefaultInjector.newInstance(DefaultInjector.java:65)
        at org.apache.camel.impl.engine.DefaultInjector.newInstance(DefaultInjector.java:44)
        at org.apache.camel.quarkus.core.CamelContextRecorder.addRoutes(CamelContextRecorder.java:94)
        ... 50 more
Caused by: java.lang.NoSuchMethodException: org.apache.camel.service.lra.LRASagaRoutes.<init>()
        at java.base/java.lang.Class.getConstructor0(Class.java:3349)
        at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2553)
        at org.apache.camel.support.ObjectHelper.newInstance(ObjectHelper.java:220)
        ... 53 more

Workaround: add the following to application properties:

quarkus.camel.routes-discovery.exclude-patterns = org/apache/camel/service/lra/LRASagaRoutes
@ppalaga
Copy link
Contributor Author

ppalaga commented Oct 5, 2020

I'd introduce a RoutesBuilderClassExcludeBuildItem unless anybody has a better idea.

@jamesnetherton
Copy link
Contributor

I'd introduce a RoutesBuilderClassExcludeBuildItem unless anybody has a better idea.

Is LRASagaRoutes a fundamental component of camel-lra? If it is, excluding it is just a hack to make the build successful. I.e we should perhaps consider pulling support for the extension until the underlying problem(s) are fixed.

@ppalaga
Copy link
Contributor Author

ppalaga commented Oct 5, 2020

camel-lra instantiates LRASagaRoutes programmatically, providing a LRASagaService to the LRASagaRoutes(LRASagaService sagaService) constructor. I think it is really not a good idea to let Camel Quarkus Core to instantiate it. Of course unless we redesign camel-lra to suit better what Camel Quarkus expects. Yes, we will perhaps need to change camel-lra anyway, when porting to native. The solution with RoutesBuilderClassExcludeBuildItem only aims at improving the UX of camel-lra in JVM mode, so that it is there for Camel K.

I was also thinking of excluding all RoutesBuilder classes which do not have a no-args constructor. I do not think it is a good idea because RoutesBuilders may lack no-args constructors for other reasons too - e.g. by mistake.

@jamesnetherton
Copy link
Contributor

camel-lra instantiates LRASagaRoutes programmatically, providing a LRASagaService to the LRASagaRoutes(LRASagaService sagaService) constructor. I think it is really not a good idea to let Camel Quarkus Core to instantiate it

Ok, understood. Then I guess RoutesBuilderClassExcludeBuildItem makes sense 👍

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

Successfully merging a pull request may close this issue.

2 participants