jbosstools / jbosstools-quarkus

Quarkus tooling for Eclipse
https://tools.jboss.org
Apache License 2.0
17 stars 20 forks source link

ClassCastException when creating a new quarkus project #244

Open CluelessAardvark opened 3 months ago

CluelessAardvark commented 3 months ago

environment: freshly installed and untouched eclipse 2024-6 on linux mint 22 with default jdk (build 21.0.4+7-Ubuntu-1ubuntu224.04)

steps to reproduce:

  1. download the eclipse installer (https://www.eclipse.org/downloads/packages/installer)
  2. start the installer (and update it if necessary)
  3. click eclipse IDE for enterprise java and web developers
  4. chose 2026-06 (default java 21 is pre selected) and install
  5. launch eclipse and chose an empty workspace
  6. open help -> eclipse marketplace
  7. search for quarkus -> quarkus tools 4.29.1.Final -> install -> follow the instructions, accept licenses, trust certs -> restart eclipse to finalize
  8. click 'no' for the usage statistics when asked
  9. in the project explorer (left side) click 'create a project' -> quarkus -> quarkus project -> next
  10. chose a project name (e.g. qtest), leave everything else untouched (quarkus stream 3.13 final, type maven) -> finish

now maven tries to build the project and fails with

Errors occurred during the build.
Errors running builder 'Maven Project Builder' on project 'qtest'.
class org.eclipse.jdt.internal.core.JavaNature cannot be cast to class org.eclipse.jdt.core.IJavaProject (org.eclipse.jdt.internal.core.JavaNature and org.eclipse.jdt.core.IJavaProject are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @1535ad53)

the error log gives a complete stack trace:

java.lang.ClassCastException: class org.eclipse.jdt.internal.core.JavaNature cannot be cast to class org.eclipse.jdt.core.IJavaProject (org.eclipse.jdt.internal.core.JavaNature and org.eclipse.jdt.core.IJavaProject are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @1535ad53)
    at org.jboss.tools.quarkus.lsp4e.internal.qute.QuteProjectListener.configureProject(QuteProjectListener.java:101)
    at org.jboss.tools.quarkus.lsp4e.internal.qute.QuteProjectListener.handleEvent(QuteProjectListener.java:152)
    at org.eclipse.core.internal.resources.Workspace.broadcastEvent(Workspace.java:453)
    at org.eclipse.core.internal.resources.Resource.refreshLocal(Resource.java:1600)
    at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.refreshResources(MavenBuilderImpl.java:325)
    at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:196)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:164)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$1(MavenBuilder.java:109)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:458)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:292)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$0(MavenBuilder.java:100)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:458)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:339)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:278)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:83)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:192)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1077)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:296)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:352)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:441)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:444)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:555)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:503)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:585)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:207)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:300)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
lyahim commented 3 months ago

Hi,

I've faced with same issue.

Br, Mihaly

CluelessAardvark commented 3 months ago

there is also an error in the log everytime i start eclipse with pretty much the same stacktrace:

eclipse.buildId=4.32.0.20240606-1231
java.version=21.0.4
java.vendor=Ubuntu
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product

org.eclipse.ui
Error
Tue Aug 13 09:20:40 CEST 2024
Unable to execute early startup code for the org.eclipse.ui.IStartup extension contributed by the 'org.jboss.tools.quarkus.lsp4e' plug-in.

java.lang.ClassCastException: class org.eclipse.jdt.internal.core.JavaNature cannot be cast to class org.eclipse.jdt.core.IJavaProject (org.eclipse.jdt.internal.core.JavaNature and org.eclipse.jdt.core.IJavaProject are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @e5cd0b1)
    at org.jboss.tools.quarkus.lsp4e.internal.qute.QuteProjectListener.configureProject(QuteProjectListener.java:101)
    at org.jboss.tools.quarkus.lsp4e.internal.qute.QuteProjectListener.<init>(QuteProjectListener.java:49)
    at org.jboss.tools.quarkus.lsp4e.internal.startup.qute.QuteStartup.earlyStartup(QuteStartup.java:24)
    at org.eclipse.ui.internal.EarlyStartupRunnable.runEarlyStartup(EarlyStartupRunnable.java:79)
    at org.eclipse.ui.internal.EarlyStartupRunnable.run(EarlyStartupRunnable.java:55)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
    at org.eclipse.ui.internal.Workbench$39.run(Workbench.java:2706)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)