on 12-30-2008 6:17 AM
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.
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());
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.