NPE while marshalling an object

Brent Putman putmanb at georgetown.edu
Wed Jun 17 13:49:30 EDT 2015



On 6/17/15 9:55 AM, Stephen.CTR.Chappell at faa.gov wrote:
>
>  
>
> xmlObjectRegistry.getMarshallerFactory().getMarshaller(assertion).marshall(assertion);
> // assertion is an org.opensaml.saml.saml1.core.Assertion
>
>  
>
> which yields this:
>
>  
>
> java.lang.NullPointerException
>
>                 at
> org.opensaml.core.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:74)
>
>  
>
> It looks like the OpenSAML parser pool is not initialized properly?
>

Yes, based on the line number, that's what the error would seem to
indicate.


> I am calling InitializationService.initialize() where I previously
> calling DefaultBootstrap.bootstrap().
>

That should be all that is required.  Are you sure you are initializing
the library early enough that the init is in effect before the above
call is being made?  That is the only obvious issue I can think of.


> Is there some additional configuration or initialization that needs
> to be done before I can use the marshallers?
>

Nope, that should be all.

Do you have any sort of weird or complex classloader environment here? 
That is the only non-obvious issue I can think of, that you have
multiple classloaders and things are happening/stored in the wrong
places, indexed by wrong Class literals, etc. If this is a web app,
where are you putting all the OpenSAML jars + deps, relative to the
application code that's calling it?  And where is the call to
InitializationService.initialize() happening?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/dev/attachments/20150617/b82e9082/attachment.html>


More information about the dev mailing list