0

we are using XMLSignatureFactory to get instance like below. which was working fine in JDK 12 but now when upgrading to JDK17 giving below error in runtime. Any one please can provide input.

String providerName = System.getProperty("jsr105Provider", "org.jcp.xml.dsig.internal.dom.XMLDSigRI");
        try {
            return XMLSignatureFactory.getInstance("DOM", (Provider) Class.forName(providerName).newInstance());

}.......

Caused by: java.lang.IllegalAccessException: class com.test.OutboundMessageHandlerImpl cannot access class org.jcp.xml.dsig.internal.dom.XMLDSigRI (in module java.xml.crypto) because module java.xml.crypto does not export org.jcp.xml.dsig.internal.dom to unnamed module @6580cfdd
Gaurav
  • 33
  • 8

1 Answers1

1

Java 17 is stricter with reflections/introspection.

As a quick-fix you can add --add-opens java.xml.crypto/org.jcp.xml.dsig.internal.dom=ALL-UNNAMED as vm options when running the application. But you should upgrade the package to a version which is java 17 compatible if possible.

Berdie
  • 11
  • 3