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

java.lang.ClassCastException: class o.e.w.c.c.i.i.ReferencedComponentXMIResourceImpl cannot be cast to class o.e.j.c.c.r.x.JptXmlResource #24

Open
fs-chris opened this issue Feb 2, 2023 · 5 comments

Comments

@fs-chris
Copy link

fs-chris commented Feb 2, 2023

I'm getting the following ClassCastException when trying to change Maven settings.

eclipse.buildId=4.26.0.20221201-1200
java.version=17.0.5
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product

org.eclipse.m2e.core
Error
Thu Feb 02 08:47:56 CET 2023
Could not update project abc configuration

java.lang.ClassCastException: class org.eclipse.wst.common.componentcore.internal.impl.ReferencedComponentXMIResourceImpl cannot be cast to class org.eclipse.jpt.common.core.resource.xml.JptXmlResource (org.eclipse.wst.common.componentcore.internal.impl.ReferencedComponentXMIResourceImpl is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @4febb6e6; org.eclipse.jpt.common.core.resource.xml.JptXmlResource is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @8108420)
	at org.eclipse.jpt.common.core.internal.resource.xml.AbstractJptXmlResourceProvider.buildXmlResource(AbstractJptXmlResourceProvider.java:122)
	at org.eclipse.jpt.common.core.internal.resource.xml.AbstractJptXmlResourceProvider.getXmlResource(AbstractJptXmlResourceProvider.java:107)
	at org.eclipse.m2e.wtp.jpa.internal.configurators.JpaProjectConfigurator.configureFacets(JpaProjectConfigurator.java:136)
	at org.eclipse.m2e.wtp.jpa.internal.configurators.JpaProjectConfigurator.configure(JpaProjectConfigurator.java:110)
	at org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping.configure(AbstractLifecycleMapping.java:123)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$6(ProjectConfigurationManager.java:494)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:364)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:274)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:488)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$4(ProjectConfigurationManager.java:416)
	at java.base/java.util.Collection.removeIf(Collection.java:576)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration0(ProjectConfigurationManager.java:410)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$3(ProjectConfigurationManager.java:340)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:364)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:274)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:213)
	at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1102)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:339)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:326)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:308)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:296)
	at org.eclipse.m2e.apt.ui.preferences.AnnotationProcessingSettingsPage$3.runInWorkspace(AnnotationProcessingSettingsPage.java:269)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

@mcrose
Copy link

mcrose commented Mar 30, 2023

same problem, but when I import an existing project

Eclipse
Version: 2023-03 (4.27.0)
Build id: 20230309-1520
java.runtime.name=OpenJDK Runtime Environment
java.runtime.version=17.0.6+10
java.specification.name=Java Platform API Specification
java.specification.vendor=Oracle Corporation
java.specification.version=17
java.vendor=Eclipse Adoptium
java.vendor.url=https://adoptium.net/
java.vendor.url.bug=https://github.com/adoptium/adoptium-support/issues
java.vendor.version=Temurin-17.0.6+10
java.version=17.0.6
java.version.date=2023-01-17
java.vm.compressedOopsMode=32-bit
java.vm.info=mixed mode
java.vm.name=OpenJDK 64-Bit Server VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Oracle Corporation
java.vm.specification.version=17
java.vm.vendor=Eclipse Adoptium
java.vm.version=17.0.6+10
os.arch=amd64
os.name=Windows 11
os.version=10.0

@mickaelistria mickaelistria transferred this issue from eclipse-m2e/m2e-core Mar 31, 2023
@fbricon fbricon changed the title java.lang.ClassCastException: class org.eclipse.wst.common.componentcore.internal.impl.ReferencedComponentXMIResourceImpl cannot be cast to class org.eclipse.jpt.common.core.resource.xml.JptXmlResource java.lang.ClassCastException: class o.e.w.c.c.i.i.ReferencedComponentXMIResourceImpl cannot be cast to class o.e.j.c.c.r.x.JptXmlResource Mar 31, 2023
@fbricon
Copy link
Contributor

fbricon commented Mar 31, 2023

Try disabling the JPA configurator in the workspace settings:
Screenshot 2023-03-31 at 09 16 06

Alternatively, you can add <m2e.jpa.activation>false</m2e.jpa.activation> in your pom properties section.

@mcrose
Copy link

mcrose commented Mar 31, 2023

Try disabling the JPA configurator in the workspace settings: Screenshot 2023-03-31 at 09 16 06

Alternatively, you can add <m2e.jpa.activation>false</m2e.jpa.activation> in your pom properties section.

worked!
thanks

I added to the pom.xml so I could removed later

@mhagnumdw
Copy link

Tks @fbricon

Try disabling the JPA configurator in the workspace settings

What is lost by this?

Is there any plan to support Jakarta Persistence 3.0?

@fbricon
Copy link
Contributor

fbricon commented Mar 5, 2024

The configurator automatically sets the JPA Facet. Without it you'd have to do it manually.

I haven't checked JPA support in Eclipse in a while. I don't know if 3.0 is supported, you need to ask in https://github.com/eclipse-dali/webtools.dali

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

4 participants