OpenSAML needs a couple of configuration files in order to work. The library is provided with a default set of these files that is sufficient for mot uses. Before starting the use the library the configurations must be loaded. This is done using the bootstrap function.
try { DefaultBootstrap.bootstrap(); } catch (ConfigurationException e) { throw new RuntimeException("Bootstrapping failed"); }
If you do not do this before you start using the library, you might run into exceptions like.
Exception in thread "main" java.lang.NullPointerException at no.steras.opensaml.Main.main(Main.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
What to do if DefaultBootstrap gives an InputStream cannot be null?
ReplyDeleteException in thread "main" java.lang.IllegalArgumentException: InputStream cannot be null
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:117)
at org.opensaml.xml.parse.BasicParserPool$DocumentBuilderProxy.parse(BasicParserPool.java:671)
at org.opensaml.xml.parse.BasicParserPool.parse(BasicParserPool.java:215)
at org.opensaml.xml.XMLConfigurator.load(XMLConfigurator.java:141)
at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:199)
at org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:91)
at com.ccs.saml.metadata.SamlMetadataGenerator.main(SamlMetadataGenerator.java:34)
Do I need to put a config-file somewhere specific?
If so, which file and where should I put it?
Try this
Deletehttp://stackoverflow.com/questions/4956087/opensaml-bootstrap-nets-me-inputstream-cannot-be-null
Hi, I am using above code { DefaultBootstrap.bootstrap();} but when I deployed to server this exception is throwing:
DeleteException in thread "main" java.lang.ClassCastException: org.opensaml.core.xml.schema.impl.XSAnyBuilder cannot be cast to org.opensaml.xml.XMLObjectBuilder
inside lib. location is :
at org.opensaml.xml.XMLConfigurator.load(XMLConfigurator.java:182)
at org.opensaml.xml.XMLConfigurator.load(XMLConfigurator.java:166)
at org.opensaml.xml.XMLConfigurator.load(XMLConfigurator.java:143)
at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:224)
at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:207)
at org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:100)
Couldn't identify the reason, can you guys help on this. please.
Thanks, after adding openws.jar and creating a good X509 certificate, I now got it working.
ReplyDeletewhen I used above code for the initialization of SAML, it is throwing below exception, any idea or help:
ReplyDeleteException in thread "main" java.lang.ClassCastException: org.opensaml.core.xml.schema.impl.XSAnyBuilder cannot be cast to org.opensaml.xml.XMLObjectBuilder
at org.opensaml.xml.XMLConfigurator.initializeObjectProviders(XMLConfigurator.java:236)
at org.opensaml.xml.XMLConfigurator.load(XMLConfigurator.java:182)
at org.opensaml.xml.XMLConfigurator.load(XMLConfigurator.java:166)
at org.opensaml.xml.XMLConfigurator.load(XMLConfigurator.java:143)
at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:224)
at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:207)
at org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:100)
at se.cambio.platform.auth.metadata.util.SAMLUtil.createSAMLObject(SAMLUtil.java:14)