1 Reply Latest reply: Mar 23, 2012 2:37 PM by smullan RSS

    javax.xml.crypto.URIReferenceException

    923432
      Hi, i have a problem please help
      so
           it woks without any problem :
      Reference ref = fac.newReference("*http://.../test.gif*", fac.newDigestMethod(DigestMethod.SHA1, null));
           SignedInfo si = fac.newSignedInfo(
                     fac.newCanonicalizationMethod(
                     CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS,
                     (C14NMethodParameterSpec)null),
                     fac.newSignatureMethod(SignatureMethod.RSA_SHA1, null),
                     Collections.singletonList(ref));

      but when i use local file dir :

      Reference ref = fac.newReference("*file:///d:/test.gif*", fac.newDigestMethod(DigestMethod.SHA1, null)); returns this problem :

      Exception in thread "main" javax.xml.crypto.dsig.XMLSignatureException: javax.xml.crypto.URIReferenceException: java.lang.NullPointerException
           at org.jcp.xml.dsig.internal.dom.DOMReference.dereference(Unknown Source)
           at org.jcp.xml.dsig.internal.dom.DOMReference.digest(Unknown Source)
           at org.jcp.xml.dsig.internal.dom.DOMXMLSignature.digestReference(Unknown Source)
           at org.jcp.xml.dsig.internal.dom.DOMXMLSignature.sign(Unknown Source)
           at smartWindowsSert.createXmlSignature(smartWindowsSert.java:166)
           at smartWindowsSert.main(smartWindowsSert.java:110)
      Caused by: javax.xml.crypto.URIReferenceException: java.lang.NullPointerException
           at org.jcp.xml.dsig.internal.dom.DOMURIDereferencer.dereference(Unknown Source)
           ... 6 more
      Caused by: java.lang.NullPointerException
           at com.sun.org.apache.xml.internal.security.utils.resolver.implementations.ResolverDirectHTTP.engineCanResolve(Unknown Source)
           at com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolver.canResolve(Unknown Source)
           at com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolver.getInstance(Unknown Source)
           ... 7 more
      javax.xml.crypto.URIReferenceException: java.lang.NullPointerException
           at org.jcp.xml.dsig.internal.dom.DOMURIDereferencer.dereference(Unknown Source)
           at org.jcp.xml.dsig.internal.dom.DOMReference.dereference(Unknown Source)
           at org.jcp.xml.dsig.internal.dom.DOMReference.digest(Unknown Source)
           at org.jcp.xml.dsig.internal.dom.DOMXMLSignature.digestReference(Unknown Source)
           at org.jcp.xml.dsig.internal.dom.DOMXMLSignature.sign(Unknown Source)
           at smartWindowsSert.createXmlSignature(smartWindowsSert.java:166)
           at smartWindowsSert.main(smartWindowsSert.java:110)
      Caused by: java.lang.NullPointerException
           at com.sun.org.apache.xml.internal.security.utils.resolver.implementations.ResolverDirectHTTP.engineCanResolve(Unknown Source)
           at com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolver.canResolve(Unknown Source)
           at com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolver.getInstance(Unknown Source)
           ... 7 more


      Who can help me ?

      thanks