Nope, nothing more from me. Glad you got it working.
/charlie From: [email protected] [mailto:[email protected]] On Behalf Of Ajas Mohammed Sent: Tuesday, April 21, 2009 4:07 PM To: [email protected] Subject: Re: [ACFUG Discuss] CF 7 java Object Instantiation Exception. Perhaps init issue here? Hi Charlie / Brooks, Sorry for the delay in response. Brooks, I did end up splitting the big chunk into simpler statements like this SignatureElement = docElement.getElementsByTagNameNS(SignatureSpecNS,"Signature").item(0); Charlie, Good explanation and thats what I thought about my init method, that its calling with right parameters and it should be fine. Anyway, I read somewhere that easy way to resolve init issue is by doing some array creation etc. See my sample code below because I use that and now my error is gone. Or Perhaps, I needed to instantiate Init = CreateObject("Java", "org.apache.xml.security.Init"); before calling another class which was giving the error. Like you said, sometimes it has to do with missing class. Here is the new code which is working fine now without errors unless I am missing something obvious which you can point me to. Let me know if you see something weird in this code. Charlie, if you wanna say something about that array code below then thats fine. I would love to know your take on it. :-) <cfscript> xmlResponse= tokenXML; docElement= XmlParse(variables.xmlResponse).getDocumentElement(); SignatureConstants=CreateObject("Java", "org.apache.xml.security.utils.Constants"); SignatureSpecNS=SignatureConstants.SignatureSpecNS; xmlSignatureClass = CreateObject("Java","org.apache.xml.security.signature.XMLSignature"); SignatureElement = docElement.getElementsByTagNameNS(SignatureSpecNS,"Signature").item(0); Init = CreateObject("Java", "org.apache.xml.security.Init"); emptyArray = ArrayNew(1); initMethod=Init.GetClass().GetMethod("init",emptyArray); initMethod.invoke(Init,emptyArray); xmlSignature = xmlSignatureClass.init(SignatureElement,""); keyInfo=xmlSignature.getKeyInfo(); X509CertificateResolverCN = "org.apache.xml.security.keys.keyresolver.implementations.X509CertificateRes olver"; keyResolver=CreateObject("Java",X509CertificateResolverCN).init(); keyInfo.registerInternalKeyResolver(keyResolver); x509cert = keyInfo.getX509Certificate(); isValid = xmlSignature.checkSignatureValue(x509cert); </cfscript> Thanks, <Ajas Mohammed /> http://ajashadi.blogspot.com We cannot become what we need to be, remaining what we are. No matter what, find a way. Because thats what winners do. You can't improve what you don't measure. Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives. On Wed, Apr 15, 2009 at 8:29 AM, <[email protected]> wrote: You have a very compound statement on the line with the error. Could you break it into several simpler statements. I suspect that the instantation error is occurring in the inner object's item method (maybe). It looks to me like this could be three simple statements. Ajas Mohammed <[email protected]> Sent by: [email protected] 04/13/2009 02:47 PM Please respond to [email protected] To [email protected] cc Subject [ACFUG Discuss] CF 7 java Object Instantiation Exception. Perhaps init issue here? Hi there, I am getting an error(code in red) Object Instantiation Exception. I believe it has to do with init call because i remember CF's init is different from Java's style of callling constructors. Can anybody recommend an alternative ? FYI, if i remove code in red till the end and I do print values of other variables like docElement and SignatureSpecNS, then I can see there values. If you need any further information, let me know. <cfscript> xmlResponse= tokenXML; // this is full xml stored in variable here docElement= XmlParse(variables.xmlResponse).getDocumentElement(); SignatureConstants=CreateObject("Java", "org.apache.xml.security.utils.Constants"); SignatureSpecNS=SignatureConstants.SignatureSpecNS; xmlSignatureClass = CreateObject("Java","org.apache.xml.security.signature.XMLSignature"); xmlSignature = xmlSignatureClass.init(docElement.getElementsByTagNameNS(SignatureSpecNS,"Si gnature").item(0),""); // this lines gives error. see details below //Exceptions 13:00:53.053 - Object Exception - in **** line 85 Object Instantiation Exception. keyInfo=xmlSignature.getKeyInfo(); X509CertificateResolverCN = CreateObject("Java","org.apache.xml.security.keys.keyresolver.implementation s.X509CertificateResolverClass"); keyResolver=CreateObject("Java",X509CertificateResolverCN).init(); keyInfo.registerInternalKeyResolver(keyResolver); x509cert = keyInfo.getX509Certificate(); </cfscript> Thanks <Ajas Mohammed /> http://ajashadi.blogspot.com <http://ajashadi.blogspot.com/> We cannot become what we need to be, remaining what we are. No matter what, find a way. Because thats what winners do. You can't improve what you don't measure. Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives. ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by FusionLink <http://www.fusionlink.com> ------------------------------------------------------------- ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -------------------------------------------------------------
