tycho icon indicating copy to clipboard operation
tycho copied to clipboard

ClassCastException: InstallableUnit

Open cdietrich opened this issue 3 years ago • 15 comments

with the current nightly i am getting

Error:  Internal error: java.lang.ClassCastException: class org.eclipse.equinox.internal.p2.metadata.InstallableUnit cannot be cast to class org.eclipse.equinox.p2.metadata.IInstallableUnit (org.eclipse.equinox.internal.p2.metadata.InstallableUnit is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @5fc3333f; org.eclipse.equinox.p2.metadata.IInstallableUnit is in unnamed module of loader org.codehaus.plexus.classworlds.realm.ClassRealm @487cd177) -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.ClassCastException: class org.eclipse.equinox.internal.p2.metadata.InstallableUnit cannot be cast to class org.eclipse.equinox.p2.metadata.IInstallableUnit (org.eclipse.equinox.internal.p2.metadata.InstallableUnit is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @5fc3333f; org.eclipse.equinox.p2.metadata.IInstallableUnit is in unnamed module of loader org.codehaus.plexus.classworlds.realm.ClassRealm @487cd177)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:120)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.ClassCastException: class org.eclipse.equinox.internal.p2.metadata.InstallableUnit cannot be cast to class org.eclipse.equinox.p2.metadata.IInstallableUnit (org.eclipse.equinox.internal.p2.metadata.InstallableUnit is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @5fc3333f; org.eclipse.equinox.p2.metadata.IInstallableUnit is in unnamed module of loader org.codehaus.plexus.classworlds.realm.ClassRealm @487cd177)
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.getPreliminaryReactorProjectUIs (TargetPlatformFactoryImpl.java:395)
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:173)
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:135)
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:1)
    at org.eclipse.tycho.p2.manager.ReactorRepositoryManagerImpl.computePreliminaryTargetPlatform (ReactorRepositoryManagerImpl.java:100)
    at org.eclipse.tycho.p2.resolver.P2DependencyResolver.computePreliminaryTargetPlatform (P2DependencyResolver.java:227)
    at org.eclipse.tycho.core.resolver.DefaultTychoResolver.resolveProject (DefaultTychoResolver.java:133)
    at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.lambda$resolveProjects$1 (TychoMavenLifecycleParticipant.java:216)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept (ForEachOps.java:183)
    at java.util.stream.WhileOps$1$1.accept (WhileOps.java:99)
    at java.util.ArrayList$ArrayListSpliterator.tryAdvance (ArrayList.java:1632)
    at java.util.stream.ReferencePipeline.forEachWithCancel (ReferencePipeline.java:127)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel (AbstractPipeline.java:502)
    at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:488)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:474)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential (ForEachOps.java:150)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential (ForEachOps.java:173)
    at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach (ReferencePipeline.java:497)
    at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.resolveProjects (TychoMavenLifecycleParticipant.java:254)
    at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead (TychoMavenLifecycleParticipant.java:134)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:253)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

cdietrich avatar Jul 30 '22 10:07 cdietrich

with the current nightly

You mean snapshot?

i am getting

Reproducer? Such issues often arise if tycho-mojos are used or tycho API inside other plugins, but the tycho-maven-plugin is not included in the build itself.

laeubi avatar Jul 30 '22 11:07 laeubi

git clone https://github.com/itemis/xtext-reference-projects.git
cd xtext-reference-projects
export EXTRA_ARGS="-Dtycho-version=3.0.0-SNAPSHOT -Ptycho_snapshots" 
./scripts/greetings-tycho-2.28-J11.sh

cdietrich avatar Jul 30 '22 11:07 cdietrich

The example seems to use some older Tycho version somewhere, I can see that the error is triggered by org.eclipse.tycho.extras.sourcefeature.SourceFeatureP2MetadataProvider that is not part of Tycho 3.x anymore.

laeubi avatar Jul 30 '22 13:07 laeubi

But where is is where ?

cdietrich avatar Jul 30 '22 13:07 cdietrich

No idea, maybe some xtend plugin is pulling in Tycho dependencies?

laeubi avatar Jul 30 '22 13:07 laeubi

I don’t think so. Will try to remove Xtend and more

cdietrich avatar Jul 30 '22 13:07 cdietrich

Either a plugin is pulling it in or a project reference it somewhere (but actually Tycho should already warn/error in this case)

laeubi avatar Jul 30 '22 13:07 laeubi

see cd_tycho_issue1216 branch

cdietrich avatar Jul 30 '22 13:07 cdietrich

problem seams to be in the feature/sourcefeature area commenting out tycho-source-feature-plugin seems to help https://repo.eclipse.org/content/repositories/tycho-snapshots/org/eclipse/tycho/extras/tycho-source-feature-plugin/3.0.0-SNAPSHOT/

is this plugin dead? what is its replacement? if it is dead, beginning from which version is it dead/the replacement available if i remove it there is no source feature produced

cdietrich avatar Jul 30 '22 13:07 cdietrich

is this plugin dead? what is its replacement? if it is dead, beginning from which version is it dead/the replacement available if i remove it there is no source feature produced

See https://github.com/eclipse/tycho/blob/master/RELEASE_NOTES.md#removal-of-tycho-source-featuresource-feature

laeubi avatar Jul 30 '22 15:07 laeubi

if it was removed, can we also remove it from the snapshot repo.

cdietrich avatar Jul 30 '22 18:07 cdietrich

tycho-source-feature is gone for quite some time now but snapshots repo maybe contain older builds.

akurtakov avatar Aug 04 '22 16:08 akurtakov

Yes this is why I wonder if we can / should purge the snapshot repo for 3.0.0

cdietrich avatar Aug 04 '22 18:08 cdietrich

At least I'm not aware of how can this be achieved.

akurtakov avatar Aug 04 '22 18:08 akurtakov

I assume an admin could do a find . - name 3.0.0-SNAPSHOT -type d | xargs rm -r

as snapshots for older versions also seem to disappear there must be a purge script already in place

cdietrich avatar Aug 04 '22 18:08 cdietrich

I think we can close this for now. Fiddling around on the repo server directly seems a bit dangerous here...

laeubi avatar Sep 07 '22 15:09 laeubi