java.lang.ClassNotFoundException: org.opensaml.DefaultBootstrap -
i using opensaml authenticate saml response identity provider (idp). first step, converting dom response idp opensaml xmlobject. using following code:
base64 base64 = new base64(); byte[] base64decodedresponse = base64.decode(responsemessage); bytearrayinputstream = new bytearrayinputstream(base64decodedresponse); documentbuilderfactory documentbuilderfactory = documentbuilderfactory.newinstance(); documentbuilderfactory.setnamespaceaware(true); documentbuilder docbuilder = documentbuilderfactory.newdocumentbuilder(); document document = docbuilder.parse(is); element element = document.getdocumentelement(); unmarshallerfactory unmarshallerfactory = configuration.getunmarshallerfactory(); unmarshaller unmarshaller = unmarshallerfactory.getunmarshaller(element); if (unmarshaller == null) throw new illegalstateexception("could not obtain saml unmarshaller"); xmlobject obj = unmarshaller.unmarshall(element); if (obj == null || !(obj instanceof response)) throw new illegalstateexception("unmarshaller return not saml response");
this code gave me illegalstateexception: not obtain saml unmarshaller. on googling found : opensaml error receiving correct unmarshaller pegerto suggested bootstrapping unmarshaller registers. so, added following code:
try { defaultbootstrap.bootstrap(); generator = new securerandomidentifiergenerator(); } catch (exception ex) { ex.printstacktrace(); }
now giving:
jun 19, 2015 2:58:30 pm org.apache.catalina.core.standardwrappervalve invoke severe: servlet.service() servlet [jsp] in context path [/testsaml] threw exception [javax.servlet.servletexception: java.lang.noclassdeffounderror: org/opensaml/defaultbootstrap] root cause java.lang.classnotfoundexception: org.opensaml.defaultbootstrap
i have import org.opensaml.defaultbootstrap;
in code , added opensaml-2.2.3.jar in classpath.
can me error?
thanks!
solved!
the jar files should in web-inf/lib/ folder. web application project.
Comments
Post a Comment