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

NPE on getting execution environment #1745

Closed
dhendriks opened this issue Nov 27, 2022 · 6 comments · Fixed by #1746
Closed

NPE on getting execution environment #1745

dhendriks opened this issue Nov 27, 2022 · 6 comments · Fixed by #1746
Milestone

Comments

@dhendriks
Copy link
Contributor

I'm trying to migrate Eclipse ESCET from Tycho 2.7.1 to 3.0.0. Locally, the build succeeds. On Jenkins, it fails, with the following error:

13:17:29  [DEBUG] [main] Computing preliminary target platform for MavenProject: org.eclipse.escet:org.eclipse.escet.chi.codegen:0.8.0-SNAPSHOT @ /home/jenkins/agent/workspace/T_build_359-upgrade-to-tycho-3-0/chi/org.eclipse.escet.chi.codegen/.polyglot.META-INF
13:17:29  [DEBUG] Using execution environment 'org.eclipse.justj.openjdk.hotspot.jre.full-17' configured in target-platform-configuration <executionEnvironment>
13:17:29  [ERROR] Internal error: java.lang.NullPointerException -> [Help 1]
13:17:29  org.apache.maven.InternalErrorException: Internal error: java.lang.NullPointerException
13:17:29      at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:120)
13:17:29      at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
13:17:29      at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
13:17:29      at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
13:17:29      at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
13:17:29      at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
13:17:29      at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
13:17:29      at java.lang.reflect.Method.invoke (Method.java:568)
13:17:29      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
13:17:29      at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
13:17:29      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
13:17:29      at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
13:17:29  Caused by: java.lang.NullPointerException
13:17:29      at java.util.Objects.requireNonNull (Objects.java:208)
13:17:29      at java.util.Optional.of (Optional.java:113)
13:17:29      at java.util.stream.FindOps$FindSink$OfRef.get (FindOps.java:194)
13:17:29      at java.util.stream.FindOps$FindSink$OfRef.get (FindOps.java:191)
13:17:29      at java.util.stream.FindOps$FindOp.evaluateSequential (FindOps.java:150)
13:17:29      at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
13:17:29      at java.util.stream.ReferencePipeline.findFirst (ReferencePipeline.java:647)
13:17:29      at org.eclipse.tycho.core.ee.ExecutionEnvironmentUtils.getExecutionEnvironment (ExecutionEnvironmentUtils.java:89)
13:17:29      at org.eclipse.tycho.core.ee.ExecutionEnvironmentConfigurationImpl.isCustomProfile (ExecutionEnvironmentConfigurationImpl.java:112)
13:17:29      at org.eclipse.tycho.p2.target.ee.ExecutionEnvironmentResolutionHandler.adapt (ExecutionEnvironmentResolutionHandler.java:34)
13:17:29      at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:138)
13:17:29      at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:1)
13:17:29      at org.eclipse.tycho.p2.manager.ReactorRepositoryManagerImpl.computePreliminaryTargetPlatform (ReactorRepositoryManagerImpl.java:99)
13:17:29      at org.eclipse.tycho.p2.resolver.P2DependencyResolver.computePreliminaryTargetPlatform (P2DependencyResolver.java:229)
13:17:29      at org.eclipse.tycho.core.resolver.DefaultTychoResolver.resolveProject (DefaultTychoResolver.java:135)
13:17:29      at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.lambda$resolveProjects$3 (TychoMavenLifecycleParticipant.java:254)
13:17:29      at java.util.stream.ForEachOps$ForEachOp$OfRef.accept (ForEachOps.java:183)
13:17:29      at java.util.stream.WhileOps$1$1.accept (WhileOps.java:99)
13:17:29      at java.util.ArrayList$ArrayListSpliterator.tryAdvance (ArrayList.java:1602)
13:17:29      at java.util.stream.ReferencePipeline.forEachWithCancel (ReferencePipeline.java:129)
13:17:29      at java.util.stream.AbstractPipeline.copyIntoWithCancel (AbstractPipeline.java:527)
13:17:29      at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:513)
13:17:29      at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:499)
13:17:29      at java.util.stream.ForEachOps$ForEachOp.evaluateSequential (ForEachOps.java:150)
13:17:29      at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential (ForEachOps.java:173)
13:17:29      at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
13:17:29      at java.util.stream.ReferencePipeline.forEach (ReferencePipeline.java:596)
13:17:29      at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.resolveProjects (TychoMavenLifecycleParticipant.java:292)
13:17:29      at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead (TychoMavenLifecycleParticipant.java:142)
13:17:29      at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:264)
13:17:29      at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
13:17:29      at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
13:17:29      at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
13:17:29      at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
13:17:29      at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
13:17:29      at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
13:17:29      at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
13:17:29      at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
13:17:29      at java.lang.reflect.Method.invoke (Method.java:568)
13:17:29      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
13:17:29      at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
13:17:29      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
13:17:29      at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

I don't know what happens internally in Tycho, but an NPE sounds like a bug.

@laeubi
Copy link
Member

laeubi commented Nov 27, 2022

What I see is this in the log:

Using execution environment 'org.eclipse.justj.openjdk.hotspot.jre.full-17' configured in target-platform-configuration <executionEnvironment>

and it seems this one can maybe not be mapped but thats hard to tell from the log snippet, there should be some more output regarding EE found.

To further debug this, you might want to compare if there are local "toolchains.xml" and what are on the build server.

@dhendriks
Copy link
Contributor Author

How can I try out a snapshot?

Configuring this, I get:

[WARNING] The POM for org.eclipse.tycho:tycho-build:jar:4.0.0-SNAPSHOT is missing, no dependency information available
[WARNING] Failed to read extensions descriptor [anonymized]\git\escet\.mvn\extensions.xml: Plugin org.eclipse.tycho:tycho-build:4.0.0-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact org.eclipse.tycho:tycho-build:jar:4.0.0-SNAPSHOT
...
[ERROR] Unresolveable build extension: Plugin org.eclipse.tycho:tycho-maven-plugin:4.0.0-SNAPSHOT or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.eclipse.tycho:tycho-maven-plugin:jar:4.0.0-SNAPSHOT @ 
...

Also, going to https://repo.eclipse.org/content/repositories/tycho-snapshots in a browser, I get a HTTP 503 error. This is the URL given at both https://github.com/eclipse-tycho/tycho/blob/master/CONTRIBUTING.md and https://wiki.eclipse.org/Getting_Tycho.

@dhendriks
Copy link
Contributor Author

It seems repo.eclipse.org is down entirely. https://www.eclipsestatus.io/ lists a major outage.

@laeubi
Copy link
Member

laeubi commented Nov 28, 2022

Yes the repo is sadly down, whe hope its getting fixed somewhere today.

@HannesWell
Copy link
Member

Is there already an integration test-case for this bug? I encountered it as well since Tycho 3.0 and can confirm that it is fixed with the latest Tycho 4.0-SNAPSHOT.
The issue can be reproduced simply if one has justj-jre for Java-11 in the target-platform, a simple Bundle that requires a Java-SE 11 BREE and a target-platform-configuration with <executionEnvironment>org.eclipse.justj.openjdk.hotspot.jre.full-11</executionEnvironment> as described here:

I can provide an integration test so that we can ensure the issues does not happen again and Tycho works well with JustJ.

In general I wonder if we can't simply the use of JustJ and somehow detect automatically that the JustJ JRE should be used?
Additionally I get warnings like
[WARNING] Using JavaSE-17 to fulfill requested profile of JavaSE-11 this might lead to faulty dependency resolution, consider define a suitable JDK in the toolchains.xml
and wonder if Tycho can't just use the JDK in the JustJ artifact, if possible?

github-actions bot pushed a commit that referenced this issue Mar 14, 2023
@laeubi
Copy link
Member

laeubi commented Mar 14, 2023

Is there already an integration test-case for this bug?

I'm not aware of that

I can provide an integration test so that we can ensure the issues does not happen again and Tycho works well with JustJ.

That would be useful indeed.

In general I wonder if we can't simply the use of JustJ and somehow detect automatically that the JustJ JRE should be used?

See

and wonder if Tycho can't just use the JDK in the JustJ artifact, if possible?

See

github-actions bot pushed a commit that referenced this issue Mar 14, 2023
laeubi added a commit that referenced this issue Mar 15, 2023
@laeubi laeubi added this to the 4.0 milestone Jun 24, 2023
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

Successfully merging a pull request may close this issue.

3 participants