[OpenSAML] openSaml and Eclipse

437 views
Skip to first unread message

Bailo, John

unread,
Sep 15, 2008, 2:12:10 PM9/15/08
to mace-open...@internet2.edu

 

I’m having some trouble getting my openSAML2 build environment to work in Eclipse.

 

I’ve added the opensaml-2.1.0 jar as an External Jar to my project.

 

I’ve also added all the jars inside the \lib folder and I checked each jar in my Project/Java Build Path/Order and Export tab

 

I am using two lines of code so far in the POST method of a servlet:

 

        messageContext = new BasicSAMLMessageContext();

         

       

        messageContext.setInboundMessageTransport(

                  new HttpServletRequestAdapter(request));

 

 

However, after I submit the POST from a jsp form, I receive this error, as if the secondary jar cannot be found:

 

java.lang.NoClassDefFoundError: org/opensaml/ws/transport/InTransport
        java.lang.Class.getDeclaredConstructors0(Native Method)
        java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
        java.lang.Class.getConstructor0(Class.java:2671)
        java.lang.Class.newInstance0(Class.java:321)
        java.lang.Class.newInstance(Class.java:303)
        org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
        org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
        org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
        org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
        java.lang.Thread.run(Thread.java:595)

 

CONFIDENTIALITY NOTICE: The information in this Internet email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorized. 

Anil Saldhana

unread,
Sep 15, 2008, 2:17:36 PM9/15/08
to mace-open...@internet2.edu
My classpath file
-------------------

 <classpathentry kind="var" path="M2_REPO/opensaml/opensaml/2.1.0/opensaml-2.1.0.jar"/>
  <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar"/>
   <classpathentry kind="var" path="M2_REPO/opensaml/xmltooling/1.0.1/xmltooling-1.0.1.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.5.0/slf4j-api-1.5.0.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.5.0/slf4j-log4j12-1.5.0.jar"/>
        <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar"/>
        <classpathentry kind="var" path="M2_REPO/apache-xmlsec/xmlsec/1.3.0/xmlsec-1.3.0.jar"/>
        <classpathentry kind="var" path="M2_REPO/apache-logging/commons-logging-api/1.0.3/commons-logging-api-1.0.3.jar"/>
        <classpathentry kind="var" path="M2_REPO/apache-velocity/velocity/1.5/velocity-1.5.jar"/>
        <classpathentry kind="var" path="M2_REPO/apache-collections/commons-collections/3.1/commons-collections-3.1.jar"/>
        <classpathentry kind="var" path="M2_REPO/apache-lang/commons-lang/2.1/commons-lang-2.1.jar"/>
        <classpathentry kind="var" path="M2_REPO/opensaml/openws/1.1.0/openws-1.1.0.jar"/>
        <classpathentry kind="var" path="M2_REPO/joda-time/joda-time/1.5.2/joda-time-1.5.2.jar"/>



Basically add all the jars that are present in the opensaml 2.1 distribution (lib directory).

Bailo, John

unread,
Sep 15, 2008, 3:15:16 PM9/15/08
to mace-open...@internet2.edu

What I did instead is to copy all the SAML jars into the \lib folder of my project jar and it seems to work for now (though I wouldn’t want to do this every time!).    The servlet now responds, but I get a new error:

 

12:04:46,726 ERROR [[samlpost]] Servlet.service() for servlet samlpost threw exception

java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

 

In this case, when I look inside the slf4j-api-1.5.0.jar I do not see this class   Org.slf4j.spi does not have a StaticLoggerBinder class.

 

Mazza, Glen R.

unread,
Sep 16, 2008, 9:40:13 AM9/16/08
to mace-open...@internet2.edu

John, you’ll probably want to look at Mavenizing your projects[1] so you don’t need to worry (nearly as much) about dependencies—Maven will take care of it for you.  For your problem below you need a specific logger[2] (you can choose among several) in addition to the opensaml jar.  I use slf4j-jdk14-1.5.2.

 

HTH,

Glen

 

[1] http://www.jroller.com/gmazza/date/20080417 (Creating a Maven project from scratch)

[2] http://www.jroller.com/gmazza/date/20080916 (Step #3 specifically)

 


Anil Saldhana

unread,
Sep 16, 2008, 10:12:52 AM9/16/08
to mace-open...@internet2.edu
There is a regression in Maven surefire plugin 2.4.2 where the forked jvm does not get the system properties (so your Java endorsement does not work). This is fixed in v2.4.3 of surefire.

I just spent few hours pulling my hair on this one.
http://anilsaldhana.blogspot.com/2008/09/surefire-plugin-fails-to-do-java.html

FYI for anyone that may face this.

Bailo, John

unread,
Sep 16, 2008, 11:58:35 AM9/16/08
to mace-open...@internet2.edu

I am trying to develop a servlet Service provider along the lines of the pseudocode here:

 

https://spaces.internet2.edu/display/OpenSAML/OSTwoUserManualPsedocodeSP

 

The pseudocode shows:

 

messageContext.setInboundMessageTransport(new HttpServletRequestAdapter(new SAML2HttpRequestWrapper(@http request@)));

 

But the sample code ( HTTPPostDecoderTest.java) shows

 

messageContext.setInboundMessageTransport(new HttpServletRequestAdapter(httpRequest));

 

What would be appropriate for receiving a SAML 1 object via a FORM POST?

 

Also, I don’t see any source code or API doc for org.opensaml.ws.transport.http.HttpServletRequestAdapter.   Is that available?

 

 

 

 

Bailo, John

unread,
Sep 16, 2008, 12:01:28 PM9/16/08
to mace-open...@internet2.edu

Thank you!


Short term I seem to have gotten the logger to work by downloading and adding slf4j-simple-1.5.3.jar to my Manifest.MF classpath.

Brent Putman

unread,
Sep 16, 2008, 5:51:29 PM9/16/08
to mace-open...@internet2.edu


Bailo, John wrote:

I am trying to develop a servlet Service provider along the lines of the pseudocode here:

 

https://spaces.internet2.edu/display/OpenSAML/OSTwoUserManualPsedocodeSP


Just FYI, that was contributed by someone from the user community, not the OpenSAML dev team.  I haven't looked it over in detail, so I'm not saying there's anything wrong with it.  From what I see it looks fine as a rough outline. Just clarifying.



 

The pseudocode shows:

 

messageContext.setInboundMessageTransport(new HttpServletRequestAdapter(new SAML2HttpRequestWrapper(@http request@)));


Yeah, that SAML2HttpRequestWrapper class is not an OpenSAML class.  Must be from the contributer's local code, so I don't know what it does. 


 

But the sample code ( HTTPPostDecoderTest.java) shows

 

messageContext.setInboundMessageTransport(new HttpServletRequestAdapter(httpRequest));


This is the standard way to do message decoding from an HttpServletRequest.



 

What would be appropriate for receiving a SAML 1 object via a FORM POST?


Same basic pattern, but you would need to use the appropriate SAML 1 decoder, for example the org.opensaml.saml1.binding.decoding.HTTPPostDecoder.


 

Also, I don’t see any source code or API doc for org.opensaml.ws.transport.http.HttpServletRequestAdapter.   Is that available?

 


Yes, the Java OpenSAML 2 library stack is comprised of 3 libraries java-opensaml2, java-openws, java-xmltooling.  That particular class is in openws.  See:


https://spaces.internet2.edu/display/OpenSAML/SourceAccess

http://www.opensaml.org/docs/



Bailo, John

unread,
Sep 17, 2008, 2:49:00 PM9/17/08
to mace-open...@internet2.edu

I’m trying to add the [java-openws] repo from

https://spaces.internet2.edu/display/OpenSAML/SourceAccess

to my subeclipse plugin.   When I add the location

http://svn.middleware.georgetown.edu/view/java-openws/

 

I get the message:

    Repository has been moved

svn: Repository moved permanently to '/view/java-openws/'; please relocate

 

Any suggestions?

 




Chad La Joie

unread,
Sep 17, 2008, 2:52:48 PM9/17/08
to mace-open...@internet2.edu
Per the instructions on the page you like the SVN URL for a project is:

https://svn.middleware.georgetown.edu/[REPO_NAME]

you have the wrong URL.

--
SWITCH
Serving Swiss Universities
--------------------------
Chad La Joie, Software Engineer, Net Services
Werdstrasse 2, P.O. Box, 8021 Zürich, Switzerland
phone +41 44 268 15 75, fax +41 44 268 15 68
chad....@switch.ch, http://www.switch.ch

Reply all
Reply to author
Forward
0 new messages