Need help with plugin transition to Java11

Hi there,

KNIME 4.4 is already there for a while. In the past month, I had little time to take care about our plugins (HCS-Tools and Knime-Scripting) but now, I wanted to get the plugins up and running for KNIME 4.4.
I switched everything to Java11 but I cannot get rid of the following error message:

The package org.w3c.dom is accessible from more than one module: , java.xml

I tried several things but nothing seems to work. I hope someone can help me to troubleshoot and resolve this issue.

Best,
Antje

2 Likes

Hi Antje,

we ran into the same problem with the Palladian and Selenium Nodes.

The root issue is, that Java 11 seems pickier with duplicated classes on the class path (this is probably expressed rather naively, but I’m lacking the detailed backgrounds – more details here)

At the end, both of our node plugins (Palladian, Selenium) had a (transitive) dependency to xml-apis which duplicated standard classes org.w3c.*. After removing this (we use a Maven-Tycho build, so I just excluded them by adding an <exclusion>), the issue was fixed.

Hope this helps. Feel free to get back if you need any clarification!

Best,
Philipp

5 Likes

Hi Philipp,

I don’t use maven. Do you have any suggestion for me how to find out which dependency might cause such a duplication? I guess, in my case it has also to do with the org.w3c-classes.

Best,
Antje

I think I went through the “Open Type” window of Eclipse (cmd+shift+T) and entered one of the conflicting class names (e.g. org.w3c.Document). This would show then all occurrences of the class (and in your case there should be more than one, beside the JDK packages). The window should show you the name of the location/JAR files and you should be able to work from there and remove this.

Hope this helps!

– Philipp

1 Like

I found the Target Platform State view very helpful for this:
image
You can filter for a package and it then lists all plugins that import it and where they get it from:

What I also found, is that some libraries package all their dependencies into the same jar, which can also lead to this a problem, in that case I had to delete the org.w3c.dom classes from the jar itself.

1 Like

I tried the ‘Open Type’ window with one of the classes where the import shows up with this error message but all I get is the following window:

I also tried to look at the Target Platform State and I wish, I could copy/paste the content. The list is very long and I get several libraries which show up with supplied by [something else than 'the JRE']
for example:
nu.xom, org.apache.batik.*, org.apache.xalan,
I’m not sure how much that helps? Or would I just have to watch out for libraries I did define as dependency (like nu.xom).

You only need to look for the libraries that you have direct or transitive dependencies on,
your plugin is not exposed to any other ones.

Hi Antje,

Take a look at this PR: Update to java11 by gab1one · Pull Request #121 · knime-mpicbg/HCS-Tools · GitHub
That should fix your issues, I looked at the libraries contained in the HCS libs plugin and was able to identify the issue. The contained jchempaint and cdk binaries contain a UserDataHandler.class in the w3c.dom package which is a copy from the one contained in the JRE, I deleted the packages from the jars and now everything seems to work again

best,
Gabriel