Caused by: java.lang.ClassCastException: org.jcp.xml.dsig.internal.dom.DOMXMLSignatureFactory cannot be cast to javax.xml.crypto.dsig.XMLSignatureFactory

1,652 views
Skip to first unread message

paul...@gmail.com

unread,
Jun 3, 2014, 4:26:01 AM6/3/14
to fusef...@googlegroups.com
I have clean fuse installation. With clean I mean "unzip; start karaf".
And I have a simplest bundle with exactly one class as an activator:

package xmlsectest;
import javax.xml.crypto.dsig.XMLSignatureFactory;
import org.osgi.framework.*;
public class PrintCL implements @Override
    public void start(BundleContext context) throws Exception {
        XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM");
        System.out.println(fac.toString());
    }
    @Override
    public void stop(BundleContext context) throws Exception {
    }
}

when trying to start this bundle I have (don't mind line numbers in PrintCL, as I reformatted a class before paste here to save space).

Caused by: java.lang.ClassCastException: org.jcp.xml.dsig.internal.dom.DOMXMLSignatureFactory cannot be cast to javax.xml.crypto.dsig.XMLSignatureFactory
        at javax.xml.crypto.dsig.XMLSignatureFactory.findInstance(XMLSignatureFactory.java:202)[187:org.apache.santuario.xmlsec:1.5.6]
        at javax.xml.crypto.dsig.XMLSignatureFactory.getInstance(XMLSignatureFactory.java:186)[187:org.apache.santuario.xmlsec:1.5.6]
        at xmlsectest.PrintCL.start(PrintCL.java:11)[247:xmlsec.test:0.0.1]
        at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)[org.apache.felix.framework-4.0.3.redhat-610379.jar:]
        at org.apache.felix.framework.Felix.doActivateBundle(Felix.java:2387)[org.apache.felix.framework-4.0.3.redhat-610379.jar:]

nagaraj...@gmail.com

unread,
Jun 7, 2016, 8:10:31 PM6/7/16
to fusefabric, paul...@gmail.com
Root cause of the problem is xmlsec jars has javax packages. We used the xmlsec-2.0.0 jars and it worked. We got the hint from the Santuario xmlsec jar issue https://issues.apache.org/jira/browse/SANTUARIO-358. I also noticed that latest CXF version 3.1.6 contains xmlsec-2.0.6.jar which doesn't contain the javax packages which is the real solution to this problem.
Please use latest cxf package (>3.0) which contains latest xmlsec jars.
Reply all
Reply to author
Forward
0 new messages