Hi Vivek,
and my impression is that your problems are due to the fact that some
forks of Xalan and Xerces are now parts of JDK. This is called they are
"endorsed" technologies.
What you probably need is to substitute standard Xalan and Xerces
implementations with the ones you prefer using the following JVM option:
-Djava.endorsed.dirs=_paths_to_dirs_that_contain_your_xalan_and_xerces_separated_by_path.separator_
, or by placing them into your <java-home>\lib\endorsed directory (the
latter approach seems a bit too invasive to me).
Please see more here: https://xml.apache.org/xalan-j/faq.html , section
"I'm having a problem running Xalan-Java on JDK/JRE 1.4 or higher".
And you can find more on the "endorsed" concept here:
https://docs.oracle.com/javase/8/docs/technotes/guides/standards/ .
This "endorsed" concept is currently said to be deprecated starting with
Java 9. There is a related discussion here:
https://stackoverflow.com/questions/28983922/alternative-for-deprecated-endorsed-standards-override-mechanism-and-extension-m
. To be frank, I have no experience in dealing with this issue after
Java 8...
Cheers,
Sergey
On 15.07.2019 11:20, Vivek Routhu wrote:
Hi Team,
Currently I am using the below 3 jars for XML reading , writing and
transferring XSLT to HTML conversion.
* xalan.jar
* xerces.jar
* xercesImpl.jar
In the code I have added the below XMLConstants.
TransformerFactory tf = TransformerFactory.newInstance();
tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
After adding I am facing below error.
Exception in thread "main"
java.lang.IllegalArgumentException: Not supported:
http://javax.xml.XMLConstants/property/accessExternalDTD
at
org.apache.xalan.processor.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:571)
*Case 1:*
So I have gone through the internet and updated
*xerces.jar,xercesImpl.jar *with *xerces-xercesImpl-2.11.jar*
Now I have these below jars in my project.
* xerces-xercesImpl-2.11
* xalan.jar
Again I have run the same code I am getting same error. If I remove
the xalan.jar from the lib it is working fine.
*Case 2:*
**
And if I update the xalan-2.7.2.jar also I am getting same error like
above.
* xerces-xercesImpl-2.11
* xalan-2.7.2
Could you please clarify on the below
1. Is there any relation between xerces-xercesImpl -2.11 and xalan jars?
2. I am using java_8.0_202 version is there anything referring in the
java?
3. can I remove the xalan jar from the whole project?
Any help will be much appreciated. Thanks in advance.
Please let me know if you need any further inputs.
Thanks & Regards,
Vivek.