Skip to Content.
Sympa Menu

mace-opensaml-users - Re: [OpenSAML] Bootstrap Initialization Error

Subject: OpenSAML user discussion

List archive

Re: [OpenSAML] Bootstrap Initialization Error


Chronological Thread 
  • From: lakshmi narasimhan <>
  • To:
  • Subject: Re: [OpenSAML] Bootstrap Initialization Error
  • Date: Wed, 28 Oct 2009 17:07:16 +0000
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=fu2Aq4/NyQHjOV2YKxq14AHLCYElUIGunBd7dY149/D6XbG9xYA3MdDajFndPS5agy XWPZMAVruq9W+JXn2npjBhxjr7HQGnozZ0ZiKCBUTb5PbHNp8diVzdRim/taZemahYkZ YazmxC6ROKQjYPu0Y/JkYB/jPnchv9QUO+JD4=

Hello,

I've a catch for XMLParsing but unfortunately am not getting any
exception to help me diagnose where it is failing exactly. Could
someone please share a sample 'valid' SAML file, so I can use that and
test my code? I just want to make sure that my SAML assertion doesn't
have anything weird(Even if there is any problem with the SAML, I
believe an XML Parsing exception would be thrown anyways) that could
prevent the Document object from getting created successfully. For
your reference, here's my JSP code:

=================================================================
<%@page
import="java.io.StringReader"%>
<%@page
import="java.io.UnsupportedEncodingException"%>

<%@page
import="org.opensaml.saml2.core.Response"%>
<%@page
import="org.opensaml.xml.util.Base64"%>
<%@page
import="org.opensaml.xml.parse.BasicParserPool"%>
<%@page
import="org.opensaml.xml.io.UnmarshallingException"%>
<%@page
import="org.opensaml.xml.parse.XMLParserException" %>
<%@page
import="org.opensaml.xml.io.UnmarshallerFactory" %>
<%@page
import="org.opensaml.xml.io.Unmarshaller"%>
<%@page
import="org.opensaml.Configuration"%>
<%@page
import="org.opensaml.DefaultBootstrap"%>
<%@page
import="util.Base64Coder"%>
<%@page
import="org.w3c.dom.Document"%>
<%@page
import="org.w3c.dom.Element"%>
<%@page
import="java.io.InputStream"%>
<%@page
import="java.io.ByteArrayInputStream"%>
<%@page
import="javax.xml.parsers.DocumentBuilderFactory"%>

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>

<%
Response samlResponse = null;

String samlResponseB64Str =
(String)request.getParameter("samlResponse");
Document doc;

try{
DefaultBootstrap.bootstrap();

// Base64 Decode
String samlResponseStr = new
String(Base64.decode(samlResponseB64Str),"UTF-8");

BasicParserPool pp = new BasicParserPool();
pp.setNamespaceAware(true);

doc = pp.parse(new StringReader(samlResponseStr));
out.println("<br/> <br/> Document is: "+doc);

//Element responseRoot = doc.getDocumentElement();

//UnmarshallerFactory unmfactory =
Configuration.getUnmarshallerFactory();
//Unmarshaller unm = v.getUnmarshaller(responseRoot);

//samlResponse = (Response) unm.unmarshall(responseRoot);

}catch (UnmarshallingException ex){
ex.printStackTrace();
}
catch (XMLParserException ex){
ex.printStackTrace();
}
catch (UnsupportedEncodingException ex){
ex.printStackTrace();
}
%>
===================================================================

Would appreciate any suggestion to overcome this.

Cheers!
Laks.

On 10/28/09, Chad La Joie
<>
wrote:
> Are you getting exceptions of some kind? I don't see any try/catch
> there but most of those methods throw exceptions.
>
> lakshmi narasimhan wrote:
>> Hi,
>>
>> I'm able to get over the bootstrap initialization problem. However, when I
>> try to parse the Base64-decoded SAML, the document object is coming up as
>> null. Here's the code snippet which I'm using for this purpose:
>>
>> String samlResponseB64Str = (String)session.getAttribute("samlToken");
>> DefaultBootstrap.bootstrap();
>>
>> // Decodage URL encoding with Base64
>> String samlResponseStr = new
>> String(Base64.decode(samlResponseB64Str),"UTF-8");
>> out.println("<br/> Base64 decode of SAML: "+samlResponseStr);
>>
>> // Get parser pool manager
>> BasicParserPool pp = new BasicParserPool();
>> pp.setNamespaceAware(true);
>>
>> Document doc = pp.parse(new StringReader(samlResponseStr));
>> out.println("Document is: "+doc);
>>
>> Any thoughts please?
>>
>> Thanks,
>> Laks.
>>
>>
>> On Wed, Oct 28, 2009 at 4:03 AM, Chad La Joie
>> <>
>> wrote:
>>
>>> This comes from having an older version of Xalan or Xerces on your
>>> classpath somewhere. You'll need to examine your classpath and make sure
>>> that you have only one version, and that that version is up to date.
>>>
>>>
>>>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm trying to parse a SAML token and while initializing
>>>> bootstrap(DefaultBootstrap.bootstrap();), I'm encountering the error
>>>> message
>>>> pasted below. I'm using xalan-2.7.0.jar in my classpath. I tried using
>>>> xalan-2.6.0.jar too but was getting the same error message. Any
>>>> suggestions
>>>> would be gratefully received.
>>>>
>>>> java.lang.NoSuchMethodError:
>>>> org.apache.xpath.compiler.FunctionTable.installFunction(Ljava/lang/String;Lorg/apache/xpath/Expression;)I
>>>> org.apache.xml.security.Init.init(Init.java:215)
>>>>
>>>>
>>>> org.opensaml.DefaultBootstrap.initializeXMLSecurity(DefaultBootstrap.java:97)
>>>> org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:71)
>>>>
>>>>
>>>> org.apache.jsp.service_005fprovider_jsp._jspService(service_005fprovider_jsp.java:121)
>>>>
>>>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
>>>>
>>>>
>>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
>>>>
>>>>
>>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
>>>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
>>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
>>>>
>>>> Thanks,
>>>> Laks.
>>>>
>>> --
>>> SWITCH
>>> Serving Swiss Universities
>>> --------------------------
>>> Chad La Joie, Software Engineer, Net Services
>>> Werdstrasse 2, P.O. Box, 8021 Zürich, Switzerland
>>> phone +41 44 268 15 75, fax +41 44 268 15 68
>>> ,
>>> http://www.switch.ch
>>>
>>>
>>
>
> --
> SWITCH
> Serving Swiss Universities
> --------------------------
> Chad La Joie, Software Engineer, Net Services
> Werdstrasse 2, P.O. Box, 8021 Zürich, Switzerland
> phone +41 44 268 15 75, fax +41 44 268 15 68
> ,
> http://www.switch.ch
>
>



Archive powered by MHonArc 2.6.16.

Top of Page