Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » java.lang.Error: Unresolved compilation problems:(The package javax.xml.parsers is accessible from more than one module: <unnamed>, java.xml)
java.lang.Error: Unresolved compilation problems: [message #1858413] Sat, 01 April 2023 17:23 Go to next message
James Poli is currently offline James PoliFriend
Messages: 27
Registered: January 2022
Junior Member
Hello,
I'm upgrading our Eclipse plug-ins from the Eclipse 2021-09 building with Java 11 to Eclipse 2023-03 building with Java 17. I had to include the CVS Team plug-in from Eclipse 2021-09 since many developers here still use CVS on older versions of our code.
I've been able to "Launch and Eclipse application" in the PDE, but when I create a site and install the plug-ins on Eclipse 2023-03, I get the errors below.
After a google search, I found several hits indicating I've likely got a third-party jar on the classpath containing the same package name classes, javax.xml.parsers. But, after using the dependency analysis in Eclipse, I've only found the same classes in an Eclipse plug-in javax.xml (javax.xml_1.3.4.v201005080400.jar) (in base Eclipse) pulled in transitively via org.apache.ant (1.10.12.v20211102-1452) plug-in, which we use.
I need help understanding why Eclipse doesn't get the same error when using Ant functionality. Do I need to include something on configuring the JVM when running with Java 17? Perhaps including the CVS Team plug-in from a previous Eclipse release is causing the issue?
Any insight is appreciated.
Regards, Jim

---- ERRORS ----
java.lang.Error: Unresolved compilation problems:
The package javax.xml.parsers is accessible from more than one module: <unnamed>, java.xml
The package javax.xml.parsers is accessible from more than one module: <unnamed>, java.xml
The package org.w3c.dom is accessible from more than one module: <unnamed>, java.xml
The package org.w3c.dom is accessible from more than one module: <unnamed>, java.xml
The package org.w3c.dom is accessible from more than one module: <unnamed>, java.xml
The package org.xml.sax is accessible from more than one module: <unnamed>, java.xml
Re: java.lang.Error: Unresolved compilation problems: [message #1858414 is a reply to message #1858413] Sat, 01 April 2023 17:39 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I tried installing CVS recently and nominally succeeded, but unfortunately the platform does not maintain major version compatibility and so some API that check out relies on is missing.

See https://github.com/eclipse-platform/eclipse.platform.team/issues/29

While it was agreed that the broken API was a gratuitous break, it doesn't look like anyone is going to fix it.

So if you want to use CVS in Eclipse you need an older Eclipse. (Or use a non-Ecipse CVS such as Tortoise.)

Regards

Ed Willink
Re: java.lang.Error: Unresolved compilation problems: [message #1858432 is a reply to message #1858414] Mon, 03 April 2023 07:48 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Considering Ed's remark these efforts might be moot, but still let me ask:

Did you see this in the exception message:
Quote:
Unresolved compilation problems


So rather than asking what went wrong in the final installation, you should rather inspect the process by which you created the plug-in jar. Obviously, the plug-in sources did not compile cleanly.

Questions:




Re: java.lang.Error: Unresolved compilation problems: [message #1858450 is a reply to message #1858432] Mon, 03 April 2023 15:29 Go to previous messageGo to next message
James Poli is currently offline James PoliFriend
Messages: 27
Registered: January 2022
Junior Member
Thanks for the quick replies. FWIW, what I'd done is hack; sorry in advance.

Yes, I see the message:
java.lang.Error Unresolved compilation problems package javax.xml.parsers is accessible from more than one module <unnamed> java.xml

!ENTRY org.eclipse.ui 4 0 2023-03-31 10:40:00.122
!MESSAGE Unhandled event loop exception
!STACK 0

Document cannot be resolved to a type
DocumentBuilderFactory cannot be resolved
ParserConfigurationException cannot be resolved to a type
SAXException cannot be resolved to a type
NodeList cannot be resolved to a type
Element cannot be resolved to a type
Element cannot be resolved to a type

at com.sas.tools.ifabsde.playpen.IFABSConfigChecker.<init>(IFABSConfigChecker.java:14)
...

---- Answers ----


    1. I used JavaSE-17.
    2. I installed the CVS Client plug-in via the p2 repository for Eclipse 2021-09 in Eclipse 2023-03. The Eclipse compiler does not show any compilation errors. The CVS client APIs have stayed the same.
    3. I created the plug-in jar via the PDE. I abandoned Eclipse Tycho build since it is having issues resolving two p2 repositories, one for Eclipse 2023-03 and 2021-09 (required to include the CVS plug-in used by our plug-in).
    4. I don't have any compilation errors. I see the exception when I install my PDE-built plug-in on Eclipse 2023-03 with the CVS plug-in from Eclipse 2021-09.
    5. I'll read it.

Re: java.lang.Error: Unresolved compilation problems: [message #1858451 is a reply to message #1858450] Mon, 03 April 2023 15:45 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
James Poli wrote on Mon, 03 April 2023 17:29
Thanks for the quick replies. FWIW, Yes, I see the message:
java.lang.Error Unresolved compilation problems package javax.xml.parsers is accessible from more than one module <unnamed> java.xml

!ENTRY org.eclipse.ui 4 0 2023-03-31 10:40:00.122
!MESSAGE Unhandled event loop exception
!STACK 0
[...]
at com.sas.tools.ifabsde.playpen.IFABSConfigChecker.<init>(IFABSConfigChecker.java:14)


How does IFABSConfigChecker enter the picture? How does an error in that class relate to the CVS plug-in?
Re: java.lang.Error: Unresolved compilation problems: [message #1858453 is a reply to message #1858451] Mon, 03 April 2023 16:42 Go to previous messageGo to next message
James Poli is currently offline James PoliFriend
Messages: 27
Registered: January 2022
Junior Member
Line, 14 of this class, is an import:
import javax.xml.parsers.DocumentBuilderFactory;

This class is invoked from a Wizard after a user selects a CVS branch containing a project to checkout. Its responsibility is to verify a user is compiling in Eclipse against the same JDK and compliance as the nightly build. FYI, I've included the full stack trace below.

---- FULL STACK TRACE ----

at com.sas.tools.ifabsde.playpen.IFABSConfigChecker.<init>(IFABSConfigChecker.java:14)
at com.sas.tools.ifabsde.widgets.NewPlaypenComposite.<init>(NewPlaypenComposite.java:70)
at com.sas.tools.ifabsde.wizards.NewPlaypenWizardPage.createControl(NewPlaypenWizardPage.java:45)
at org.eclipse.jface.wizard.Wizard.createPageControls(Wizard.java:178)
at org.eclipse.jface.wizard.WizardDialog.createPageControls(WizardDialog.java:744)
at org.eclipse.jface.wizard.WizardDialog.createContents(WizardDialog.java:636)
at org.eclipse.jface.window.Window.create(Window.java:431)
at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1094)
at org.eclipse.jface.window.Window.open(Window.java:788)
at com.sas.tools.ifabsde.actions.NewPlaypenAction.run(NewPlaypenAction.java:26)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:239)
at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:218)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:580)
at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:414)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4256)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4054)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3642)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
Re: java.lang.Error: Unresolved compilation problems: [message #1858454 is a reply to message #1858453] Mon, 03 April 2023 18:12 Go to previous messageGo to next message
James Poli is currently offline James PoliFriend
Messages: 27
Registered: January 2022
Junior Member
I'm looking closer at Stephan's link https://stackoverflow.com/questions/51094274/eclipse-cant-find-xml-related-classes-after-switching-build-path-to-jdk-10/53824670#53824670.

I'm picking up javax.xml from the JDK for compilation via the Module Dependencies tab in the Java Build Path), and my sub-project compiles fine. However, at runtime via transitive dependency of required plug-ins in my plugins.xml, I suspect I'm picking up Eclipse's javax.xml plug-in (javax.xml_1.3.4.v201005080400.jar), causing the error. I need to learn more about Java Modules.
Re: java.lang.Error: Unresolved compilation problems: [message #1858469 is a reply to message #1858454] Tue, 04 April 2023 11:36 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Quote:
I'm picking up javax.xml from the JDK for compilation via the Module Dependencies tab in the Java Build Path), and my sub-project compiles fine. However, at runtime...


This doesn't look right. The exception happens at runtime only because a class file was not cleanly compiled. You need to find the compilation step where this error is reported. What is the exact flow from IFABSConfigChecker.java to IFABSConfigChecker.class to the jar file containing it?
Re: java.lang.Error: Unresolved compilation problems: [message #1858473 is a reply to message #1858469] Tue, 04 April 2023 12:44 Go to previous messageGo to next message
James Poli is currently offline James PoliFriend
Messages: 27
Registered: January 2022
Junior Member
Weird, I don't see any errors in the Markers view or when I open the source file using the Eclipse internal compiler. I may have a compilation error turned off. I can use javap -v on the resulting class file. I was planning to attach several .png images Eclipse, but the formatting tools only take an Image Url. I'm about at my wits end with this, and thanks for helping me. I can't get past the fact that I could debug the code in the Eclipse PDE. Then when I create an installable plug-in, I get the error?
Re: java.lang.Error: Unresolved compilation problems: [message #1858476 is a reply to message #1858473] Tue, 04 April 2023 13:24 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
It definitely is ecj (Eclipse Compiler for Java) which created the class file that throws the exception.
So my guess would be that the plugin in your update site contains a different classfile than the workspace where this plug-in is being developed. Therefor: how do you create the update site?
Re: java.lang.Error: Unresolved compilation problems: [message #1858479 is a reply to message #1858476] Tue, 04 April 2023 14:02 Go to previous messageGo to next message
James Poli is currently offline James PoliFriend
Messages: 27
Registered: January 2022
Junior Member
Well, Stephan, you are correct. The class file in the install site jar for the project is smaller than the class file built into the project. In the good old days, I created the jars, features, and site with Eclipse Tycho. Eclipse Tycho had issues with two separate P2 repositories, one for Eclipse 2023-03 and one for Eclipse 2021-12, to pick the CVS client packaged in it. Right now, I do build all of the projects in the workspace. Then, open the site.xml, select the Site Map tab at the bottom of the center window, and press the Build All button.
Re: java.lang.Error: Unresolved compilation problems: [message #1858519 is a reply to message #1858479] Wed, 05 April 2023 16:40 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
James Poli wrote on Tue, 04 April 2023 16:02
.... Right now, I do build all of the projects in the workspace. Then, open the site.xml, select the Site Map tab at the bottom of the center window, and press the Build All button.


It seems that "Build All" uses a different configuration than your workspace, and in that configuration the code is seen as illegal.

I don't know about the wizardry around site.xml, but when you export your plugin using an Export wizard in category "Plug-in Development" (either "Deployable features" or "Deployable plug-ins and fragments") then the "Options" tab of the wizard has an option "[x] Use class files compiled in the workspace", which should then avoid the bogus recompilation.
Re: java.lang.Error: Unresolved compilation problems: [message #1858535 is a reply to message #1858519] Thu, 06 April 2023 12:49 Go to previous message
James Poli is currently offline James PoliFriend
Messages: 27
Registered: January 2022
Junior Member
Thanks, Stephan. That does work.

At this point, I've gone back to the Eclipse Maven Tycho build. I need to learn more about PDE Wizardry with the site.xml; I saw it in a book, and it works for a simple use case.

I've got everything working. Thanks again for all your insight and help.
Previous Topic:how to install "import java." and "import javax.
Next Topic:2022-12 Eclipse Failing to Generate Jar - Every other time
Goto Forum:
  


Current Time: Fri Mar 29 14:41:56 GMT 2024

Powered by FUDForum. Page generated in 0.04238 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top