Skip to Content.
Sympa Menu

mace-opensaml-users - Re: [OpenSAML] OpenSAML 2.2.3 general usage

Subject: OpenSAML user discussion

List archive

Re: [OpenSAML] OpenSAML 2.2.3 general usage


Chronological Thread 
  • From: Brent Putman <>
  • To:
  • Subject: Re: [OpenSAML] OpenSAML 2.2.3 general usage
  • Date: Fri, 30 Jan 2009 17:49:18 -0500



Neill Miller wrote:
> I'm trying to work with OpenSAML 2.2.3 (the Java API) and I wanted to know
> if all applications using SAML2 need to be bootstrapped (i.e. extend
> DefaultBootstrap and call the bootstrap method).

Yes, all code needs to call DefaultBootstrap.bootstrap() once before
using any of the other OpenSAML functionality. You don't however have
to extend that class, unless you have custom XMLObject provider
extensions that you wish to add.


> I get this error when I call it:
>
> org.opensaml.xml.ConfigurationException: Can not create instance of
> org.opensaml.xml.schema.impl.XSAnyBuilder
> at
> org.opensaml.xml.XMLConfigurator.createClassInstance(XMLConfigurator.java:359)
> at
> org.opensaml.xml.XMLConfigurator.initializeObjectProviders(XMLConfigurator.java:235)
> at org.opensaml.xml.XMLConfigurator.load(XMLConfigurator.java:181)
> at org.opensaml.xml.XMLConfigurator.load(XMLConfigurator.java:165)
> at org.opensaml.xml.XMLConfigurator.load(XMLConfigurator.java:142)
> at
> org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:143)
> at org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:83)
> at SAMLTest.bootstrap(SAMLTest.java:86)
> at SAMLTest.main(SAMLTest.java:168)
> Caused by: java.lang.NullPointerException
> at
> org.opensaml.xml.XMLConfigurator.createClassInstance(XMLConfigurator.java:354)
> ... 8 more
>

Hmm, in looking at the xmltooling code it seems the XMLConfigurator
instance there can't load the XSAny builder class by name, using the
former's Class's ClassLoader. You'll have to supply some more details
about your environment - Java runtime, app container, etc, how you are
supplying the OpenSAML jars to it, etc. If you're using Tomcat or some
other container which uses a hierarchical class loader structure, it's
possible you have some problem there.

In general: make sure all 3 OpenSAML jars (opensaml, openws,
xmltooling) and dependencies are present and supplied to the *same*
classloader. If for example you're implementing a Java web app, all 3
should be in the web app war's /WEB-INF/lib - not some there and some in
the container's common or shared classloader.

> Aside from the test cases in the source tree, are there any recommended
> code samples of using SAML2 in various ways?
>

There are some examples scattered throughout the User's Manual on the
wiki, though not as many as there should be probably. Someone
contributed some sample code for an SP, although it could be organized a
little better. The test cases are probably the best examples at the
moment. If you want to see an example of a full blown usage of OpenSAML
for and IdP, take a look at the Shibboleth IdP, although it's quite
involved, as you might imagine. On the wiki home page, there's a list
of some other projects that make use of OpenSAML. I know that at least
some have source code publicly available.

--Brent





Archive powered by MHonArc 2.6.16.

Top of Page