cancel
Showing results for 
Search instead for 
Did you mean: 

SAP App Server 7 does not recognize DOM mechanism of XML security provider

Former Member
0 Kudos

Hi all,

I am trying to do XML signature by Java servlet, and am using Sun WSDP 2.0 (WebServices Developers Pack) for this purpose.

SAP Netweaver 7.0 (which implements Servlet API version 2.3) on Windows2003

JRE 1.4.2

SAP Developers Studio

SWSDP 2.0

Code snippet:

import javax.xml.crypto.dsig.XMLSignatureFactory; 
 
..
XMLSignatureFactory sigFactory = 
XMLSignatureFactory.getInstance("DOM", new org.jcp.xml.dsig.internal.dom.XMLDSigRI());

This gives an exception:

javax.xml.crypto.NoSuchMechanismException: Cannot find DOM mechanism type

This means that the SAP app server cannot get DOM mechanism from the provider (org.jcp.xml.dsig.internal.dom.XMLDSigRI).

I tried the same code in a stand-alone Java program, and it worked perfectly. Again, the same program when loaded on tomcat also worked. I tried with JWSDP 1.5 and the results were same (ie. worked on tomcat, worked in a stand-alone java program, but failed in SAP app server).

Does anyone know or have any idea of this issue? Why is the SAP app server rejecting the DOM mechanism of other provider? Is this a bug?

--

To recreate this issue, just download the xmldsig.jar for the package JWSDP2.0 (or 1.5) and write the above 2 lines in the servlet.

--

Thanks in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

This problem is solved. I am putting the reply here so that others who stumble upon this error can benefit.

Add the following line to explicitly include the provider before the getInstance

Security.addProvider(new org.jcp.xml.dsig.internal.dom.XMLDSigRI());

XMLSignatureFactory sigFactory = 
XMLSignatureFactory.getInstance("DOM", new org.jcp.xml.dsig.internal.dom.XMLDSigRI());