Problems trying to migrate/build using OpenSAML3 (3.3.0) with Eclipse and Maven

o haya ohaya at yahoo.com
Sun Feb 24 12:12:24 EST 2019


 Hi,
Sorry to bother you all, but I have been struggling with this point now (trying to migrate my Java+OpenSAML app to 3.x), and I have been stuck with this current problem.
I cannot seem to find the correct imports for "Configuration" and for "SecurityConfiguration".
If I include the xmltooling in the dependencies, Eclipse suggests/lets me add:
import org.opensaml.xml.Configurationimport org.opensaml.xml.security.SecurityConfiguration
but, if I do that, then I get a different error:
Description    Resource    Path    Location    Type
Type mismatch: cannot convert from org.opensaml.xml.XMLObjectBuilderFactory to org.opensaml.core.xml.XMLObjectBuilderFactory    SAMLWriter.java    /SAMLWriter/src/main/java    line 459    Java Problem

That error is happening on this line:
    private static XMLObjectBuilderFactory builderFactory;

    public static XMLObjectBuilderFactory getSAMLBuilder() throws ConfigurationException{

        if(builderFactory == null) {
              builderFactory = Configuration.getBuilderFactory();                   // <<<<< ERROR IS HERE...
        }
        return builderFactory;
    }


I think that I am either importing the wrong classes for Configuration and SecurityConfiguration (like I should be importing and using some classes from org.opensaml.core.xml instead of from org.opensaml.xml?), or maybe for OpenSAML 3.x, I should be using some other class/method to create the builderFactory?

If anyone can point me to how to get past this it would be appreciated!!
Thanks,Jim



    On Saturday, February 23, 2019, 8:26:46 PM EST, o haya <ohaya at yahoo.com> wrote:  
 
 Hi Brent,

Thanks for all the info, esp. the links for the Javadocs - I had been looking for those, but wasn't able to find them earlier.  I'll try to resolve what I can and post back here on the ones that I can't find.

Thanks,
Jim

--------------------------------------------
On Sat, 2/23/19, Brent Putman <putmanb at georgetown.edu> wrote:

 Subject: Re: Problems trying to migrate/build using OpenSAML3 (3.3.0) with Eclipse and Maven
 To: dev at shibboleth.net
 Date: Saturday, February 23, 2019, 4:53 PM
 
 
    
 
    
    On 2/23/19
 12:59 PM, o haya wrote:
 
    
    
      Hi,
 
 I am trying to migrate the application that I had written (a
 modified version of SAMLWriter.java) earlier using OpenSAML
 2.6.6, now, to OpenSAML 3.3.0 using Eclipse and Maven.
    
    
 
    
    Well, as I said before you don't have to use
 Maven, nor Eclipse. 
      Use what you are comfortable with.
 
    
    
 
    
    
      
 
 I am not that familiar with Maven, but anyway, I added
 dependencies in the pom.xml:
    
    
 
    
    The use of dependencyManagement is a little overkill
 for a single
      project like this, but it's not wrong. I don't
 see any other
      obvious problems.
 
    
    
 
    
      
 But, when I do Run As ==> Maven Build ==> clean
 install -U, I am getting some errors that I haven't been
 able to resolve so far:
 
 - Configuration cannot be resolved
 
 - IdentifierGenerator cannot be resolved to a type
 
 - SecureRandomIdentifierGenerator cannot be resolved to a
 type
 
 - SecurityConfiguration cannot be resolved to a type
 
 - SecurityHelper cannot be resolved
 
 - The constructor BasicX509Credential() is undefined
 
 - XMLHelper cannot be resolved
 
    
    
 
    
    3.x is not 2.x.  At the very least all the package
 names changed,
      so any existing 'import' statements are
 wrong.  In many cases the
      code itself was refactored or rewritten, so classes
 and methods
      don't exist anymore, or have different names, or
      method/constructor arguments are different, etc.
    Some of the "cannot be resolved" ones are
 likely simply package
      changes.  Some of those classes don't exist
 anymore however, like
      XMLHelper, SecurityHelper, they were replaced by other
 things.
 
    
    The Javadocs are your friend:
    https://wiki.shibboleth.net/confluence/display/OS30/APIDocumentation
 
    
    For usage examples, the best thing is to look at the
 unit tests
      in the various projects.
 
    
    
 
    
    
      
 
 
 For the BasicX509Credential() error, this is the line that
 it is flagging in my code:
 
                                    BasicX509Credential
 credential = new BasicX509Credential();
    
    
 
    
    IIRC there is no longer a no-arg ctor for that
 class.  It takes a
      mandatory X509Certificate and optional PrivateKey. 
 That's a good
      example of the kind of things that changed.
 
    
    
 
    
    
      
 
 
 
 As I said, I am not that familiar with Maven, so I am not
 sure if I need to add some other dependencies in the pom, or
 do I need to modify code that uses those types that are
 getting the errors?
    
    
 
    
    Yes, definitely many types have been
 added/removed/modified, so
      the corresponding 2.x code definitely must change.
    Wrt dependencies, you definitely need java-support
 from our
      projects, although if you're using Maven that will
 be resolved as
      a transitive dependency, as will all the other deps. 
 If not using
      Maven then you'd have to manually include all the
 right jars in
      your project.
 
    
    
 
    
    
      
 
 
 Also, as I said I have the dependencies configured for
 opensaml version 3.3.0, but is there not a 3.4.2 in Maven?
 
 
    
    
 
    
    Yes, 3.4.2 is the latest.
 
    
    
 
    
    
 
  -- 
 To unsubscribe from this list send an email to
 dev-unsubscribe at shibboleth.net
 -----Inline Attachment Follows-----
 
   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/dev/attachments/20190224/6bc649ca/attachment.html>


More information about the dev mailing list