-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
OIDC - NullPointerException #26236
Comments
/cc @pedroigor, @sberyozkin |
@beniaminp Hi, does it start in JVM mode, with |
@mkouba Hi Martin, can you please check the above stacktrace, may be you can spot something, the trace includes https://github.com/quarkusio/quarkus/blob/2.9.2.Final/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java#L225 which goes to https://github.com/quarkusio/quarkus/blob/2.9.2.Final/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/DefaultTenantConfigResolver.java#L164 |
@sberyozkin I am using the idea intelij quarkus plugin to start it. |
@beniaminp I'd like to understand if it is specific to dev mode or not, since there is So please try to build the application from the command line and check if it starts in the prod profile. |
Hi @sberyozkin. It is happening in debug mode. Unfortunately I cannot reproduce it in a simple project, it is happening on a project with closed sources and in dev mode. After some debugging, I am getting the following exception: I will run it in production mode and let you know how is going. Thank you! |
It looks like that in the prod mode I am having the same issue. If I disable the oidc everything works (except the authentication / authorization) Thanks! |
I don't see anything special. The NPE comes from the public DefaultTenantConfigResolver create(final CreationalContext creationalContext) {
final DefaultTenantConfigResolver defaultTenantConfigResolver = new DefaultTenantConfigResolver();
try {
final InjectableReferenceProvider value = this.injectProviderSupplier1.get();
defaultTenantConfigResolver.enableHttpForwardedPrefix = (boolean) value
.get((CreationalContext) CreationalContextImpl.child((InjectableReferenceProvider) value,
creationalContext));
} catch (RuntimeException ex) {
throw new RuntimeException(
"Error injecting boolean io.quarkus.oidc.runtime.DefaultTenantConfigResolver.enableHttpForwardedPrefix",
ex);
}
try {
final InjectableReferenceProvider value2 = this.injectProviderSupplier2.get();
defaultTenantConfigResolver.securityEvent = (Event) value2.get((CreationalContext) CreationalContextImpl
.child((InjectableReferenceProvider) value2, creationalContext));
} catch (RuntimeException ex2) {
throw new RuntimeException(
"Error injecting javax.enterprise.event.Event<io.quarkus.oidc.SecurityEvent> io.quarkus.oidc.runtime.DefaultTenantConfigResolver.securityEvent",
ex2);
}
try {
final InjectableReferenceProvider value3 = this.injectProviderSupplier3.get();
defaultTenantConfigResolver.tenantConfigBean = (TenantConfigBean) value3
.get((CreationalContext) CreationalContextImpl.child((InjectableReferenceProvider) value3,
creationalContext));
} catch (RuntimeException ex3) {
throw new RuntimeException(
"Error injecting io.quarkus.oidc.runtime.TenantConfigBean io.quarkus.oidc.runtime.DefaultTenantConfigResolver.tenantConfigBean",
ex3);
}
try {
final InjectableReferenceProvider value4 = this.injectProviderSupplier4.get();
defaultTenantConfigResolver.tenantConfigResolver = (Instance) value4
.get((CreationalContext) CreationalContextImpl.child((InjectableReferenceProvider) value4,
creationalContext));
} catch (RuntimeException ex4) {
throw new RuntimeException(
"Error injecting javax.enterprise.inject.Instance<io.quarkus.oidc.TenantConfigResolver> io.quarkus.oidc.runtime.DefaultTenantConfigResolver.tenantConfigResolver",
ex4);
}
try {
final InjectableReferenceProvider value5 = this.injectProviderSupplier5.get();
defaultTenantConfigResolver.tenantResolver = (Instance) value5.get((CreationalContext) CreationalContextImpl
.child((InjectableReferenceProvider) value5, creationalContext));
} catch (RuntimeException ex5) {
throw new RuntimeException(
"Error injecting javax.enterprise.inject.Instance<io.quarkus.oidc.TenantResolver> io.quarkus.oidc.runtime.DefaultTenantConfigResolver.tenantResolver",
ex5);
}
try {
final InjectableReferenceProvider value6 = this.injectProviderSupplier6.get();
defaultTenantConfigResolver.tokenIntrospectionCache = (Instance) value6
.get((CreationalContext) CreationalContextImpl.child((InjectableReferenceProvider) value6,
creationalContext));
} catch (RuntimeException ex6) {
throw new RuntimeException(
"Error injecting javax.enterprise.inject.Instance<io.quarkus.oidc.TokenIntrospectionCache> io.quarkus.oidc.runtime.DefaultTenantConfigResolver.tokenIntrospectionCache",
ex6);
}
try {
final InjectableReferenceProvider value7 = this.injectProviderSupplier7.get();
defaultTenantConfigResolver.tokenStateManager = (Instance) value7
.get((CreationalContext) CreationalContextImpl.child((InjectableReferenceProvider) value7,
creationalContext));
} catch (RuntimeException ex7) {
throw new RuntimeException(
"Error injecting javax.enterprise.inject.Instance<io.quarkus.oidc.TokenStateManager> io.quarkus.oidc.runtime.DefaultTenantConfigResolver.tokenStateManager",
ex7);
}
try {
final InjectableReferenceProvider value8 = this.injectProviderSupplier8.get();
defaultTenantConfigResolver.userInfoCache = (Instance) value8.get((CreationalContext) CreationalContextImpl
.child((InjectableReferenceProvider) value8, creationalContext));
} catch (RuntimeException ex8) {
throw new RuntimeException(
"Error injecting javax.enterprise.inject.Instance<io.quarkus.oidc.UserInfoCache> io.quarkus.oidc.runtime.DefaultTenantConfigResolver.userInfoCache",
ex8);
}
defaultTenantConfigResolver.verifyResolvers();
return defaultTenantConfigResolver;
} |
Thanks @beniaminp @mkouba @beniaminp I honestly don't know how I can help without a reproducer. Can you create a |
Hey @sberyozkin . I tried in a new project with the same settings and it apparently work. Probably is something about my specific project (it is quite big). Thanks! |
@beniaminp Sounds good, thanks, yes, please try to narrow down |
Hey @sberyozkin. I upgraded to java16 an run with -XX:+ShowCodeDetailsInExceptionMessages and I got an explanation for the NPE. I think that it is related to Thanks! |
It should be located in |
Thanks @mkouba ! Also, when the Arc container is trying to get the DefaultTenantConfigResolver it has an error: Maybe you can see the problem faster then me :). Thanks! |
The problem looks to be in
Somehow cannot be converted to boolean because some |
|
@beniaminp just out of curiosity, could you try to replace |
@sberyozkin I think that |
Thanks, I can replace it as Martin suggested if it can help to fix it |
Actually, I don't think this would help. Testing my fix for #26236 (comment) right now... |
- this build step should consume RuntimeConfigSetupCompleteBuildItem because DefaultTenantConfigResolver injects a runtime config property - resolves quarkusio#26236
- this build step should consume RuntimeConfigSetupCompleteBuildItem because DefaultTenantConfigResolver injects a runtime config property - resolves quarkusio#26236
- this build step should consume RuntimeConfigSetupCompleteBuildItem because DefaultTenantConfigResolver injects a runtime config property - resolves quarkusio#26236
I tested the change and unfortunately it did not work, I get the same error. and I am not sure why it cannot find the ConfigProperty yet. Thanks! |
That's not good :-(. We really need a reproducer. @beniaminp What extensions does your app use? |
I tried to reproduce it on an empty project, but everything works fine. |
That's unfortunate. I'm afraid we can't do more without a reproducer...
Yes, you would have to use programmatic lookup and lazy injection, i.e. something like |
We finally manage to find the problem. It looks like quarkus does not play nice with it. At least, now we know :). |
Ah, that's some good news! Yes, quarkus is using |
- this build step should consume RuntimeConfigSetupCompleteBuildItem because DefaultTenantConfigResolver injects a runtime config property - resolves quarkusio#26236 (cherry picked from commit b43a7be)
Hello!
I am using quarkus:2.9.2.Final and configured oidc with the following properties:
with all the variables for url, client and secret configured.
When I am trying to start it I get the following error:
I do not event know where to start to investigate it.
One thing that I noticed was that if I disabled the oidc, the application starts without error (if I set
quarkus.oidc.enabled=false
)And clue from where to start?
Thank you!
The text was updated successfully, but these errors were encountered: