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

"Multiple consumers for the same endpoint" after renaming packages in extensions/servlet/deployment/src/test/java #24

Closed
ppalaga opened this issue Jul 2, 2019 · 8 comments
Assignees

Comments

@ppalaga
Copy link
Contributor

ppalaga commented Jul 2, 2019

Steps to reproduce:

  1. Make sure you have Fix #6 Rename packages from io.quarkus.camel to org.apache.camel.quarkus #23 merged in your current branch
  2. Go to extensions/servlet/deployment module and rename the packages in src/test/java from io.quarkus.camel to org.apache.camel.quarkus . See this branch: https://github.com/ppalaga/camel-quarkus/commits/i6.2
  3. mvn clean test from the top directory of the repo fails in the camel-quarkus-servlet-deployment module:
[INFO] Running org.apache.camel.quarkus.component.servlet.test.MinimalConfigTest
2019-07-02 13:33:19,038 INFO  [io.qua.dep.QuarkusAugmentor] (main) Beginning quarkus augmentation
2019-07-02 13:33:20,084 INFO  [io.qua.dep.QuarkusAugmentor] (main) Quarkus augmentation completed in 1046ms
2019-07-02 13:33:20,287 INFO  [org.apa.cam.imp.con.FastTypeConverterRegistry] (main) Type converters loaded (core: 183, classpath: 20)
2019-07-02 13:33:20,584 INFO  [org.apa.cam.qua.cor.run.sup.FastCamelContext] (main) Apache Camel 3.0.0-M2 (CamelContext: camel-1) is starting
2019-07-02 13:33:20,584 INFO  [org.apa.cam.imp.DefaultManagementStrategy] (main) JMX is disabled
2019-07-02 13:33:20,592 INFO  [org.apa.cam.qua.cor.run.sup.FastCamelContext] (main) StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
2019-07-02 13:33:20,602 INFO  [org.apa.cam.qua.cor.run.sup.FastCamelContext] (main) Route: route1 started and consuming from: servlet:/custom?servletName=my-servlet
2019-07-02 13:33:20,603 INFO  [org.apa.cam.qua.cor.run.sup.FastCamelContext] (main) Route: route2 started and consuming from: servlet:/hello?matchOnUriPrefix=true
2019-07-02 13:33:20,603 INFO  [org.apa.cam.qua.cor.run.sup.FastCamelContext] (main) Route: route3 started and consuming from: servlet:/rest-get?httpMethodRestrict=GET
2019-07-02 13:33:20,604 INFO  [org.apa.cam.qua.cor.run.sup.FastCamelContext] (main) Route: route4 started and consuming from: servlet:/rest-post?httpMethodRestrict=POST
org.apache.camel.FailedToStartRouteException: Failed to start route route5 because of Multiple consumers for the same endpoint is not allowed: servlet:/hello?matchOnUriPrefix=true
        at org.apache.camel.impl.AbstractCamelContext.doStartOrResumeRouteConsumers(AbstractCamelContext.java:3879)
        at org.apache.camel.impl.AbstractCamelContext.doStartRouteConsumers(AbstractCamelContext.java:3855)
        at org.apache.camel.impl.AbstractCamelContext.safelyStartRouteServices(AbstractCamelContext.java:3775)
        at org.apache.camel.impl.AbstractCamelContext.doStartOrResumeRoutes(AbstractCamelContext.java:3539)
        at org.apache.camel.impl.AbstractCamelContext.doStartCamel(AbstractCamelContext.java:3391)
        at org.apache.camel.impl.AbstractCamelContext.lambda$doStart$2(AbstractCamelContext.java:3188)
        at org.apache.camel.impl.AbstractCamelContext.doWithDefinedClassLoader(AbstractCamelContext.java:3205)
        at org.apache.camel.impl.AbstractCamelContext.doStart(AbstractCamelContext.java:3186)
        at org.apache.camel.support.service.ServiceSupport.start(ServiceSupport.java:86)
        at org.apache.camel.impl.AbstractCamelContext.start(AbstractCamelContext.java:3102)
        at org.apache.camel.quarkus.core.runtime.support.FastCamelRuntime.doStart(FastCamelRuntime.java:139)
        at org.apache.camel.quarkus.core.runtime.support.FastCamelRuntime.start(FastCamelRuntime.java:101)
        at org.apache.camel.quarkus.core.runtime.CamelTemplate.start(CamelTemplate.java:67)
        at io.quarkus.deployment.steps.CamelInitProcessor$createRuntimeInitTask12.deploy_0(CamelInitProcessor$createRuntimeInitTask12.zig:92)
        at io.quarkus.deployment.steps.CamelInitProcessor$createRuntimeInitTask12.deploy(CamelInitProcessor$createRuntimeInitTask12.zig:36)
        at io.quarkus.runner.ApplicationImpl1.doStart(ApplicationImpl1.zig:66)
        at io.quarkus.runtime.Application.start(Application.java:84)
        at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:118)
        at io.quarkus.test.QuarkusUnitTest.beforeAll(QuarkusUnitTest.java:235)
        at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$invokeBeforeAllCallbacks$8(ClassTestDescriptor.java:361)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.invokeBeforeAllCallbacks(ClassTestDescriptor.java:361)
        at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.before(ClassTestDescriptor.java:197)
        at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.before(ClassTestDescriptor.java:77)
        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.util.ArrayList.forEach(ArrayList.java:1257)
        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:170)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:142)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:117)
        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:344)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:417)

Here is the full log on Travis attached to my fork: https://travis-ci.org/ppalaga/camel-quarkus/builds/553249660?utm_source=github_status&utm_medium=notification

There are different errors when the packages in integration tests are renamed. Let me report them here. In separate comments.

@ppalaga
Copy link
Contributor Author

ppalaga commented Jul 2, 2019

Renaming the packages in integration-tests/core like this https://github.com/ppalaga/camel-quarkus/commits/i6.3 leads to

[INFO] Running org.apache.camel.quarkus.it.core.CamelInfinispanTest
13:55:46,237 INFO  [org.inf.fac.GlobalComponentRegistry] ISPN000128: Infinispan version: Infinispan 'N/A' 10.0.0.Beta3
13:55:46,648 INFO  [org.inf.ser.hot.tes.HotRodTestingUtil] Start server in port 11232
13:55:46,672 WARN  [org.inf.man.DefaultCacheManager] ISPN000434: Direct usage of the ___defaultcache name to retrieve the default cache is deprecated
13:55:46,672 WARN  [org.inf.man.DefaultCacheManager] ISPN000454: Calling getCache with a cache override is no longer supported. Please invoke createCache first and then getCache. Cache name was default
13:55:48,036 INFO  [io.qua.dep.QuarkusAugmentor] Beginning quarkus augmentation
13:55:48,218 INFO  [org.jbo.threads] JBoss Threads version 3.0.0.Beta4
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.603 s <<< FAILURE! - in org.apache.camel.quarkus.it.core.CamelInfinispanTest
[ERROR] testInfinispan  Time elapsed: 0.027 s  <<< ERROR!
org.junit.jupiter.api.extension.TestInstantiationException: 
TestInstanceFactory [io.quarkus.test.junit.QuarkusTestExtension] failed to instantiate test class [org.apache.camel.quarkus.it.core.CamelInfinispanTest]: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.resteasy.server.common.deployment.ResteasyServerCommonProcessor#build threw an exception: java.lang.RuntimeException: Multiple classes ( org.apache.camel.quarkus.it.core.CamelApplication,org.apache.camel.quarkus.it.core.CamelApplication) have been annotated with @ApplicationPath which is currently not supported
        at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.invokeTestInstanceFactory(ClassTestDescriptor.java:314)
        at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.instantiateTestClass(ClassTestDescriptor.java:289)
        at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.instantiateTestClass(ClassTestDescriptor.java:281)
        at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.instantiateAndPostProcessTestInstance(ClassTestDescriptor.java:269)
        at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$testInstancesProvider$2(ClassTestDescriptor.java:259)
        at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$testInstancesProvider$3(ClassTestDescriptor.java:263)
        at java.util.Optional.orElseGet(Optional.java:267)
        at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$testInstancesProvider$4(ClassTestDescriptor.java:262)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:98)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:97)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:68)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$1(NodeTestTask.java:107)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:107)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:75)
        at java.util.ArrayList.forEach(ArrayList.java:1257)
        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 java.util.ArrayList.forEach(ArrayList.java:1257)
        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:170)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:142)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:117)
        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:344)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:417)
Caused by: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.resteasy.server.common.deployment.ResteasyServerCommonProcessor#build threw an exception: java.lang.RuntimeException: Multiple classes ( org.apache.camel.quarkus.it.core.CamelApplication,org.apache.camel.quarkus.it.core.CamelApplication) have been annotated with @ApplicationPath which is currently not supported
        at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:132)
        at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:241)
        at io.quarkus.test.junit.QuarkusTestExtension.createTestInstance(QuarkusTestExtension.java:311)
        at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.invokeTestInstanceFactory(ClassTestDescriptor.java:299)
        ... 47 more
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.resteasy.server.common.deployment.ResteasyServerCommonProcessor#build threw an exception: java.lang.RuntimeException: Multiple classes ( org.apache.camel.quarkus.it.core.CamelApplication,org.apache.camel.quarkus.it.core.CamelApplication) have been annotated with @ApplicationPath which is currently not supported
        at io.quarkus.builder.Execution.run(Execution.java:108)
        at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:121)
        at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:104)
        at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:98)
        ... 50 more
Caused by: java.lang.RuntimeException: Multiple classes ( org.apache.camel.quarkus.it.core.CamelApplication,org.apache.camel.quarkus.it.core.CamelApplication) have been annotated with @ApplicationPath which is currently not supported
        at io.quarkus.resteasy.server.common.deployment.ResteasyServerCommonProcessor.createMultipleApplicationsException(ResteasyServerCommonProcessor.java:574)
        at io.quarkus.resteasy.server.common.deployment.ResteasyServerCommonProcessor.build(ResteasyServerCommonProcessor.java:163)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:507)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:398)
        at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1538)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1429)
        at java.lang.Thread.run(Thread.java:748)
        at org.jboss.threads.JBossThread.run(JBossThread.java:479)

See https://travis-ci.org/ppalaga/camel-quarkus/builds/553258298?utm_source=github_status&utm_medium=notification

@ppalaga
Copy link
Contributor Author

ppalaga commented Jul 2, 2019

@lburgazzoli can you please assign to me?

@ppalaga
Copy link
Contributor Author

ppalaga commented Jul 2, 2019

Update: Debugging the first variant of the problem shows that three instances of org.apache.camel.quarkus.component.servlet.test.MinimalConfigTest.Routes get passed to org.apache.camel.quarkus.core.runtime.support.FastCamelRuntime.setBuilders(List<RoutesBuilder>)

Clearly, there should be only one instance.

image

Let me investigate why the three are created.

@ppalaga
Copy link
Contributor Author

ppalaga commented Jul 2, 2019

With this tree https://github.com/ppalaga/camel-quarkus/commits/i6.4 , the MinimalConfigTest.Routes() constructor is called three times from

io.quarkus.deployment.steps.CamelInitProcessor$createInitTask8.deploy_0(CamelInitProcessor$createInitTask8.zig:52)
io.quarkus.deployment.steps.CamelInitProcessor$createInitTask8.deploy_0(CamelInitProcessor$createInitTask8.zig:68)
io.quarkus.deployment.steps.CamelInitProcessor$createInitTask8.deploy_0(CamelInitProcessor$createInitTask8.zig:84)

I assume CamelInitProcessor$createInitTask8.deploy_0 is a generated byte code. Any advice @aloubyansky how I could figure out why those three calls are generated instead of one?

@aloubyansky
Copy link
Contributor

I am going to check it out.

@ppalaga
Copy link
Contributor Author

ppalaga commented Jul 3, 2019

So given that the current PR is blocked by changes that need to get merged to Quarkus (@aloubyansky may want to paste the exact PR links), I think we should merge #23 now. WDYT @lburgazzoli ?

@lburgazzoli
Copy link
Contributor

See also quarkusio/quarkus#3268

@ppalaga
Copy link
Contributor Author

ppalaga commented Aug 1, 2019

The issue is solved after upgrading to Quarkus 0.20.0, all test packages will be renamed after #103 is merged. I think we can close this one.

@ppalaga ppalaga added this to the No fix/wont't fix milestone Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants