Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compatible with dropwizard 2 #50

Closed
naveg opened this issue Mar 9, 2020 · 15 comments
Closed

Not compatible with dropwizard 2 #50

naveg opened this issue Mar 9, 2020 · 15 comments

Comments

@naveg
Copy link

naveg commented Mar 9, 2020

The latest version of dropwizard (2.0.2 at the time of writing) uses jersey 2.30. dropwizard-pac4j depends on jersey225-pac4j, and as a result is not compatible.

A good solution might be to release separate artifacts targeting different dropwizard versions, similar to what jax-rs-pac4j does

@victornoel
Copy link
Member

@naveg normally, at least as a workaround, you should already be able to use the maven dependency management to

  • exclude jersey225-pac4j
  • add jersey-pac4j to the classpath

If you can confirm this works, then some solution should be findable in a more generic manner here I suppose.

@naveg
Copy link
Author

naveg commented Mar 9, 2020

Hmm - I tried that but wound up with a different problem:

java.lang.NoClassDefFoundError: org/glassfish/jersey/server/model/Parameter$Source
        at org.pac4j.jax.rs.jersey.features.Pac4JValueFactoryProvider$Pac4JProfileValueFactoryProvider.<init>(Pac4JValueFactoryProvider.java:62)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)

Before your suggestion I was getting this error, which makes sense (AbstractContainerRequestValueFactory is removed in jersey 2.26)

java.lang.NoClassDefFoundError: org/glassfish/jersey/server/internal/inject/AbstractContainerRequestValueFactory
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at org.pac4j.jax.rs.jersey.features.Pac4JValueFactoryProvider$Binder.<init>(Pac4JValueFactoryProvider.java:169)
        at org.pac4j.jax.rs.jersey.features.Pac4JValueFactoryProvider$Binder.<init>(Pac4JValueFactoryProvider.java:153)
        at org.pac4j.dropwizard.Pac4jBundle.run(Pac4jBundle.java:98)
        at org.pac4j.dropwizard.Pac4jBundle.run(Pac4jBundle.java:35)

@victornoel
Copy link
Member

@naveg ha, I suppose the latest fixes for working with jersey 2.30 is not out yet, see pac4j/jax-rs-pac4j#74. Maybe you could try using the snapshot version to validate it works as expected?

@naveg
Copy link
Author

naveg commented Mar 9, 2020

A new error message must be progress...

org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl(requiredType=Pac4JValueFactoryProvider$Pac4JProfileValueFactoryProvider,parent=Pac4JValueFactoryProvider$ProfileInjectionResolver,qualifiers={},position=0,optional=false,self=false,unqualified=null,617304845)
        at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:51)
        at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:188)
        at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:205)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:334)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:463)

Looks very similar to some errors posted in pac4j/jax-rs-pac4j#45

@leleuj
Copy link
Member

leleuj commented Mar 10, 2020

Keep me posted if a new release is necessary. I plan some major work on jax-rs-pac4j and dropwizard-pac4j (pac4j v4 upgrade) before spring.

@victornoel
Copy link
Member

@naveg I'm not exactly sure what's happening there, sorry
@leleuj apparently there is still a bug if I understand well… as always I can't take care of it, sorry about that.

@leleuj
Copy link
Member

leleuj commented Mar 10, 2020

If someone has the solution, we can fix that now. Otherwise, I'll investigate in a few months...

@sidkalluri
Copy link

I'm using jersey 2.29 and I notice the same issue

@richeyh
Copy link
Contributor

richeyh commented Mar 26, 2020

#51
opened though its having build issues(over flowing the log limit in travis) due to hk2 injection issues in the jersey-pac4j library, but it adds full support for Dropwizard 2.x

@leleuj
Copy link
Member

leleuj commented Mar 27, 2020

@richeyh thanks for the pull request. We'll need to schedule the Dropwizard v2.x upgrade vs the pac4j v4 upgrade.

@TheWizz
Copy link

TheWizz commented Dec 14, 2020

Any news on the Dropwizard v2.x compatibility front?

@leleuj
Copy link
Member

leleuj commented Dec 15, 2020

I didn't get any update for my last comment: #51 (comment)

I expect a contribution on this...

@TheWizz
Copy link

TheWizz commented Dec 15, 2020

Thanks. I'm not there yet with DW2, but may be able to help out once I take the plunge. Watching #51 meanwhile.

-JM

@richeyh
Copy link
Contributor

richeyh commented Dec 15, 2020

yeah i can open the PR the compatibility issue was dealt with on our end via some exclusions and versions bumps.

<dependency>
    <groupId>org.pac4j</groupId>
    <artifactId>dropwizard-pac4j</artifactId>
    <version>3.0.0</version>
    <exclusions>
        <exclusion>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.pac4j</groupId>
            <artifactId>jersey225-pac4j</artifactId>
        </exclusion>
    </exclusions>
</dependency>

<!-- http HeaderClient in specified config.yaml -->
<dependency>
    <groupId>org.pac4j</groupId>
    <artifactId>pac4j-http</artifactId>
    <version>3.8.2</version>
    <scope>runtime</scope>
</dependency>

was the snippet to get around this ill go ahead and update the pr though

@leleuj
Copy link
Member

leleuj commented Dec 17, 2020

v5 of dropwizard-pac4j will be based on Dropwizard v2.x.

@leleuj leleuj closed this as completed Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants