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

Azure DevOps Build_JDK11_Linux Job build should set PATH for java 11 instead of 8 binary to be used #2012

Closed
vorburger opened this issue Apr 11, 2019 · 3 comments
Labels
triage/out-of-date This issue/PR is no longer valid or relevant

Comments

@vorburger
Copy link
Contributor

#1986 is passing the Windows_Build Job (which, presumably is Java 8?) but fails in the Build_JDK11_Linux Job due to what I suspect is a configuration issue of a detail of how the CI jobs are set up - and which could affect other similar tests like what #1986 does in the future as well (e.g. this will likely also affect #2005):

Basically what #1986 does is that it builds a test app Quarkus JAR - using Maven which calls Gradle. Both of these (seem to) run under Java 11 - as they should, for that job; so far, all good. Now the (new) IT of #1986 attempts to test this built JAR, by simply (literally) exec-ing java -jar .../gradle-it-runner.jar. Note that it doesn't pick a java - so whatever comes first on PATH will run .. which seems right - a test like that one should not have to worry about Java 8 vs 11 test job environments, agreed? Now, as the full stack trace from the test failure below illustrates, it seems that java on Build_JDK11_Linux is actually Java 8 and not Java 11 - and that's wrong.

The DevOps Build_JDK11_Linux Job build should set PATH for a Java 11 instead of 8 java binary.

@stalep @cescoffier @gsmet who actually maintains that CI and can help with this?

[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ quarkus-gradle-plugin-integration-test-run ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running io.quarkus.gradle.it.GradleRunIntegrationTest
[main] INFO ch.vorburger.exec.ManagedProcess - Starting Program [java, -jar, ../gradle-it/build/gradle-it-runner.jar] (in working directory /home/vsts/work/1/s/devtools/gradle-it-run/.)
[main] INFO ch.vorburger.exec.ManagedProcess - Thread will wait for "Listening on: http" to appear in Console output of process Program [java, -jar, ../gradle-it/build/gradle-it-runner.jar] (in working directory /home/vsts/work/1/s/devtools/gradle-it-run/.) for max. 13000ms
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: Exception in thread "main" java.lang.ExceptionInInitializerError
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: Caused by: java.lang.RuntimeException: Failed to start quarkus
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at io.quarkus.runner.ApplicationImpl1.<clinit>(Unknown Source)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	... 1 more
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: Caused by: java.lang.UnsupportedClassVersionError: org/acme/quickstart/GreetingService has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at java.lang.ClassLoader.defineClass1(Native Method)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at java.security.AccessController.doPrivileged(Native Method)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at org.acme.quickstart.GreetingService_Bean.<init>(Unknown Source)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at io.quarkus.arc.setup.Default_ComponentsProvider.getComponents(Unknown Source)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at io.quarkus.arc.ArcContainerImpl.<init>(ArcContainerImpl.java:95)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at io.quarkus.arc.Arc.initialize(Arc.java:34)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at io.quarkus.arc.runtime.ArcDeploymentTemplate.getContainer(ArcDeploymentTemplate.java:49)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	at io.quarkus.deployment.steps.ArcAnnotationProcessor$build4.deploy(Unknown Source)
[Exec Stream Pumper] ERROR ch.vorburger.exec.ManagedProcess - java: 	... 2 more
[Exec Default Executor] ERROR ch.vorburger.exec.LoggingExecuteResultHandler - Program [java, -jar, ../gradle-it/build/gradle-it-runner.jar] (in working directory /home/vsts/work/1/s/devtools/gradle-it-run/.) failed unexpectedly
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
	at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
	at org.apache.commons.exec.DefaultExecutor.access$200(DefaultExecutor.java:48)
	at org.apache.commons.exec.DefaultExecutor$1.run(DefaultExecutor.java:200)
	at java.base/java.lang.Thread.run(Thread.java:834)
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 9.254 s <<< FAILURE! - in io.quarkus.gradle.it.GradleRunIntegrationTest
[ERROR] testHelloEndpoint  Time elapsed: 9.233 s  <<< ERROR!
ch.vorburger.exec.ManagedProcessException: 
Asked to wait for "Listening on: http" from Program [java, -jar, ../gradle-it/build/gradle-it-runner.jar] (in working directory /home/vsts/work/1/s/devtools/gradle-it-run/.), but it already exited! (without that message in console), last 100 lines of console:
Exception in thread "main" java.lang.ExceptionInInitializerError
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
Caused by: java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.runner.ApplicationImpl1.<clinit>(Unknown Source)
	... 1 more
Caused by: java.lang.UnsupportedClassVersionError: org/acme/quickstart/GreetingService has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at org.acme.quickstart.GreetingService_Bean.<init>(Unknown Source)
	at io.quarkus.arc.setup.Default_ComponentsProvider.getComponents(Unknown Source)
	at io.quarkus.arc.ArcContainerImpl.<init>(ArcContainerImpl.java:95)
	at io.quarkus.arc.Arc.initialize(Arc.java:34)
	at io.quarkus.arc.runtime.ArcDeploymentTemplate.getContainer(ArcDeploymentTemplate.java:49)
	at io.quarkus.deployment.steps.ArcAnnotationProcessor$build4.deploy(Unknown Source)
	... 2 more
	at ch.vorburger.exec.ManagedProcess.startAndWaitForConsoleMessageMaxMs(ManagedProcess.java:278)
	at io.quarkus.gradle.it.GradleRunIntegrationTest.testHelloEndpoint(GradleRunIntegrationTest.java:44)
	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 org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:628)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:117)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:184)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:180)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:127)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
	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 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: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)

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   GradleRunIntegrationTest.testHelloEndpoint:44 » ManagedProcess Asked to wait f...
[INFO] 
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
@vorburger
Copy link
Contributor Author

So looking at https://github.com/quarkusio/quarkus/blob/master/azure-pipelines.yml, we see jdkVersionOption: '1.11' ... using vmImage: 'Ubuntu 16.04' and in that we run (a container?) imageName: 'quarkus-jdk11:$(build.buildId)' ...

... via https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/maven we can find https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks/MavenV3 ... if I understand that doc correctly, and it really works like described, then because javaHomeOption defaults to JDKVersion there should be a JAVA_HOME that is set appropriately - I guess we could try to launch the test using $JAVA_HOME/bin/java instead of just java (from PATH) ...

A regular exec won't interpolate $JAVA_HOME, so I may need to do something like sh -c ... - will try.

PS: This is an ugly workaround which ideally should not be needed at all - I've therefore opened an issue for a future (probably MUCH later?) real solution: microsoft/azure-pipelines-tasks#10103.

@vorburger
Copy link
Contributor Author

A regular exec won't interpolate $JAVA_HOME, so I may need to do something like sh -c ... - will try.

Duh; I'm stupid - I can just do that in (Java) code, of course. Incl. catering for if there is no JAVA_HOME set.

vorburger added a commit to vorburger/quarkus that referenced this issue Apr 12, 2019
…rkusio#2012)

This should fix the test failure on environments where the
wrong `java` is on the `PATH`, such as in Azure; for details, see
microsoft/azure-pipelines-tasks#10103.
vorburger added a commit to vorburger/quarkus that referenced this issue Apr 12, 2019
…rkusio#2012)

This should fix the test failure on environments where the
wrong `java` is on the `PATH`, such as in Azure; for details, see
microsoft/azure-pipelines-tasks#10103.
@vorburger
Copy link
Contributor Author

vorburger commented Apr 12, 2019

I've successfully worked around this in the proposed new QuarkusJavaLauncher in 8836a9e in #1986 by reading JAVA_HOME and prefixing java with it - that's the short term fix for this issue (which works and takes care of the problem described in this issue; the PR #1986 is now battling with other problems); the longer term fix is microsoft/azure-pipelines-tasks#10103.

Leaving this issue open only as a reminder that the QuarkusJavaLauncher test utility should probably be moved somewhere else (where?) than quarkus-gradle-plugin-integration-test-run so that similar other ITs in the future can re-use that mechanism.

vorburger added a commit to vorburger/quarkus that referenced this issue Jun 10, 2019
…rkusio#2012)

This should fix the test failure on environments where the
wrong `java` is on the `PATH`, such as in Azure; for details, see
microsoft/azure-pipelines-tasks#10103.
@gsmet gsmet closed this as completed Nov 13, 2019
@gsmet gsmet added the triage/out-of-date This issue/PR is no longer valid or relevant label Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/out-of-date This issue/PR is no longer valid or relevant
Projects
None yet
Development

No branches or pull requests

2 participants