'How to find the jaxp version used in any JDK? [closed]
Currently am using JDK 1.8. Need to know what is jaxp version available. To avoid sonar violation , trying set below properties , resulting in "org.xml.sax.SAXNotRecognizedException: Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized." SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schemaFactory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, ""); schemaFactory.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, ""); referring below https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html#schemafactory also checked many blogs stating jaxp version 1.5 above should support is the information found . Any suggesting will help me to debug more .
Solution 1:[1]
There is no such thing as a "javax version". You have misread the page you linked to. What it actually says is:
Note: Use of the following
XMLConstantsrequires JAXP 1.5, which was added to Java in 7u40 and Java 8:
JAXP != javax
JAXP 1.5 actually refers to a specification. And as stated in the text I just quoted, Java 8 supports the relevant features of the JAXP 1.5 specification.
So if you want to use the constants listed in the OWASP cheatsheet, you need to build your code for Java 7u40 or Java 8 or later, and run it on a JVM that provides a JAXP 1.5 or later implementation.
(In fact Java 8 supports JAXP 1.6 ... according to https://docs.oracle.com/javase/8/docs/technotes/guides/xml/jaxp/index.html)
If you are getting runtime errors saying that the those properties are not supported, that implies that you have configured your application to use an XML implementation (provider) that doesn't support JAXP 1.5. But you haven't said anything about that ...
It is possible that these Q&As are relevant:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
