Pantvaidya, Vishwajit wrote:
I am using an open source kit that embeds xml sec java 1.2.1 with xml beans version 1.0.x. The kit uses a different version of xml beans than we do – but the 2 versions do not seem to be too different. When we try to use it the kit with our xml beans version I get the following exception at the line “XMLSignature sig = new XMLSignature(element, null)” –

_org.apache.xml.security.c14n.InvalidCanonicalizerException_: Unknown canonicalizer. No handler installed for URI

      at org.apache.xml.security.c14n.Canonicalizer.<init>(Unknown Source)

at org.apache.xml.security.c14n.Canonicalizer.getInstance(Unknown Source)

      at org.apache.xml.security.signature.SignedInfo.<init>(Unknown Source)

at org.apache.xml.security.signature.XMLSignature.<init>(Unknown Source)

The moment I switch back to the original xml beans version, the error goes away. I have rebuilt most of the actual xml beans that came with the kit using our xml beans version – but the error persists.

I have debugged the code upto the point of the exception and I see that with both xml beans versions, the xml itself does have the canonicalizer uri – but the Element. getAttributeNS call returns null when our xml beans is used and then we get the exception.

Any idea why/when would this happen?

It sounds as if the DOM tree is not namespace aware in the xml beans case. It must be namespace aware, for example you should invoke DocumentBuilderFactory.setNamespaceAware(true) before parsing the document.

--Sean

Reply via email to