NPE while marshalling an object
Stephen.CTR.Chappell at faa.gov
Stephen.CTR.Chappell at faa.gov
Thu Jun 18 07:59:19 EDT 2015
InitializationService.initialize() is being called in the constructor of my service's main class; the marshalling code is called from a method in the class. I don't have any weird or non-standard classloading anywhere, so I'm pretty sure it is not an order-of-operations thing.
What I do think it could be is that I'm missing dependencies. In v2, I only needed a single opensaml dependency in my pom file. Is the same true in v3? I had only opensaml-core listed, and have just added opensaml-xmlsec-api, opensaml-profile-api, opensaml-security-api, opensaml-storage-api, and opensaml-saml-api, but I'm still having the same issue. Did I miss a library? Or am I going up the wrong tree here?
Thanx,
Stephen W. Chappell
From: dev [mailto:dev-bounces at shibboleth.net] On Behalf Of Brent Putman
Sent: Wednesday, June 17, 2015 1:50 PM
To: dev at shibboleth.net
Subject: Re: NPE while marshalling an object
On 6/17/15 9:55 AM, Stephen.CTR.Chappell at faa.gov<mailto: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/20150618/542b8cf2/attachment.html>
More information about the dev
mailing list