question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not working with `okta-jwt-verifier-java`

See original GitHub issue

When I package a shadowJar contains okta-jwt-verifier-java as my extension, it will throws:

        at java.base/java.lang.Thread.run(Thread.java:866)
Caused by: java.lang.IllegalStateException: No `interface com.okta.jwt.AccessTokenVerifier$Builder` implementation found on the classpath. Have you remembered to include the okta-jwt-verifier-impl.jar in your runtime classpath?
        at com.okta.jwt.JwtVerifiers.lambda$loadService$1(JwtVerifiers.java:60)
        at <unknown class>.get(Unknown Source)
        at java.base/java.util.Optional.orElseThrow(Optional.java:408)
        at com.okta.jwt.JwtVerifiers.loadService(JwtVerifiers.java:60)
        at com.okta.jwt.JwtVerifiers.accessTokenVerifierBuilder(JwtVerifiers.java:51)
        at id.attestation.plugins.auth.FacebookAuthService.<init>(FacebookAuthService.java:22)
        at java.base/java.lang.J9VMInternals.newInstanceImpl(Native Method)
        at java.base/java.lang.Class.newInstance(Class.java:2288)
        at org.pf4j.DefaultExtensionFactory.create(DefaultExtensionFactory.java:38)
        ... 30 common frames omitted

I find okta-jwt-verifier-java use java.util.ServiceLoader to load implement class: https://github.com/okta/okta-jwt-verifier-java/blob/master/api/src/main/java/com/okta/jwt/JwtVerifiers.java#L60

And also all services files already bundled in shadow jar file:

my-plugin-all.jar:

META-INF/
META-INF/MANIFEST.MF
...
META-INF/okta/
META-INF/okta/version.properties
com/
com/okta/
com/okta/jwt/
com/okta/jwt/impl/
com/okta/jwt/impl/jjwt/
com/okta/jwt/impl/jjwt/BaseVerifierBuilderSupport.class
com/okta/jwt/impl/jjwt/TokenVerifierSupport.class
com/okta/jwt/impl/jjwt/TokenVerifierSupport$OktaJwtHandler.class
com/okta/jwt/impl/jjwt/ClaimsValidator$CompositeClaimsValidator.class
com/okta/jwt/impl/jjwt/ClaimsValidator.class
com/okta/jwt/impl/jjwt/ClaimsValidator$ContainsAudienceClaimsValidator.class
com/okta/jwt/impl/jjwt/IssuerMatchingSigningKeyResolver.class
com/okta/jwt/impl/jjwt/models/
com/okta/jwt/impl/jjwt/models/JwkKeys.class
com/okta/jwt/impl/jjwt/models/JwkKey.class
com/okta/jwt/impl/jjwt/JjwtAccessTokenVerifierBuilder.class
com/okta/jwt/impl/jjwt/RemoteJwkSigningKeyResolver.class
com/okta/jwt/impl/jjwt/JjwtIdTokenVerifier.class
com/okta/jwt/impl/jjwt/JjwtAccessTokenVerifier.class
com/okta/jwt/impl/jjwt/JjwtIdTokenVerifierBuilder.class
com/okta/jwt/impl/http/
com/okta/jwt/impl/http/HttpClient.class
com/okta/jwt/impl/http/OktaCommonsHttpClient.class
com/okta/jwt/impl/DefaultJwt.class
...
META-INF/services/com.okta.jwt.AccessTokenVerifier$Builder
META-INF/services/com.okta.jwt.IdTokenVerifier$Builder
META-INF/services/com.okta.commons.http.RequestExecutorFactory
META-INF/services/io.jsonwebtoken.CompressionCodec
META-INF/services/io.jsonwebtoken.io.Serializer
META-INF/services/io.jsonwebtoken.io.Deserializer
META-INF/services/com.fasterxml.jackson.core.JsonFactory
META-INF/services/com.fasterxml.jackson.core.ObjectCodec
...

What’s wrong with me? How do I resolve this issue ?

Thanks.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
abcfy2commented, Nov 13, 2021

Thank you very much. pf4j is an owsome project. Hope this will get better and better.

0reactions
abcfy2commented, Nov 28, 2021

Yes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Okta JWT Verifier for Java - GitHub
The above are the basic steps for verifying an access token locally. The steps are not tied directly to a framework so you...
Read more >
Validate Access Tokens | Okta Developer
This guide on tokens shows you how to verify a token's signature, manage key rotation, and how to use a refresh token to...
Read more >
Pitfall When Using Java Okta SDK JWT Verifier - Medium
I have found it interesting that two independent teams working on integrating with Okta via Oauth2 have run into this same problem when ......
Read more >
Okta Java create jwt verifier throws exception - Stack Overflow
The problem: Have been following the ...
Read more >
@okta/jwt-verifier - npm
Start using @okta/jwt-verifier in your project by running `npm i @okta/jwt-verifier`. There are 51 other projects in the npm registry using ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found