Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java 8 to openJdk 11 com.sun.org.apache.xml.internal.* types not accessible

Tags:

java

I am migrating my project from java 8 to openJDK 11. In my code I use the classes

import com.sun.org.apache.xml.internal.dtm.DTM;
import com.sun.org.apache.xml.internal.dtm.DTMManager;
import com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM;
import com.sun.org.apache.xml.internal.utils.XMLStringFactory;
import com.sun.org.apache.xpath.internal.objects.XMLStringFactoryImpl

I am using eclipse. I am getting the error that the types are not accessible. I also tried this post with the last import How to tell eclipse to add-exports when compiling

But it did not work. Any idea how could we fix this? Does the error mean that the packages have become internal and should be replaced in the code?

like image 702
Rasha Elsayed Avatar asked Sep 03 '25 10:09

Rasha Elsayed


1 Answers

I had a similar issue where I needed to update a reference to com.sun.org.apache.xml.internal.serializer.OutputPropertiesFactory, and found I could change it to:

import org.apache.xml.serializer.OutputPropertiesFactory;

if I included the right Xalan apache xml dependency:

    <dependency>
        <groupId>xalan</groupId>
        <artifactId>xalan</artifactId>
        <version>2.7.2</version>
    </dependency>
like image 134
Sean Avatar answered Sep 04 '25 22:09

Sean