on 12-26-2008 2:39 PM
Hi all,
I am trying to write a servlet which will do XML signature et al. For the same, I am using JWSDP 2.0 (Java WebServices Developers Pack) on JRE 1.4.2_5. The servlet is hosted on SAP Netweaver 7 platform on Windows.
I am getting an exception:
javax.xml.crypto.NoSuchMechanismException: Cannot find DOM mechanism type
in the "XMLSignatureFactory.getInstance" line. I looked up in the documentation of XMLSignatureFactory and it says that the DOM mechanism should be provided by the provider argument - org.jcp.xml.dsig.internal.dom.XMLDSigRI in this case.
import javax.xml.crypto.dsig.XMLSignatureFactory;
..
XMLSignatureFactory sigFactory =
XMLSignatureFactory.getInstance("DOM", new org.jcp.xml.dsig.internal.dom.XMLDSigRI());
..
I tried the above 2 lines in a stand-alone Java client and they work without any issues.
I also used JWSDP 1.5 and the result was same.
This means that the servlet API or container for SAP is creating some issues to make this fail.
I tried to add the "org.jcp.xml.dsig.internal.dom.XMLDSigRI" in the jre/lib/security/java.security, but then the server0 does not start-up.
Any hints/pointers to resolve this issue?
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 |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.