quarkus: java.lang.NullPointerException: Cannot invoke "org.jboss.jandex.ClassInfo.classAnnotations()" because "classInfo" is null
Describe the bug
Enabling quarkus.security.jaxrs.default-roles-allowed=admin or quarkus.security.jaxrs.deny-unannotated-endpoints=true causes:
java.lang.NullPointerException: Cannot invoke "org.jboss.jandex.ClassInfo.classAnnotations()" because "classInfo" is null
at io.quarkus.security.spi.SecurityTransformerUtils.hasSecurityAnnotation(SecurityTransformerUtils.java:47)
at io.quarkus.resteasy.deployment.ResteasyBuiltinsProcessor.setUpDenyAllJaxRs(ResteasyBuiltinsProcessor.java:64)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:833)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Resulted in: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.resteasy.deployment.ResteasyBuiltinsProcessor#setUpDenyAllJaxRs threw an exception: java.lang.NullPointerException: Cannot invoke "org.jboss.jandex.ClassInfo.classAnnotations()" because "classInfo" is null
at io.quarkus.security.spi.SecurityTransformerUtils.hasSecurityAnnotation(SecurityTransformerUtils.java:47)
at io.quarkus.resteasy.deployment.ResteasyBuiltinsProcessor.setUpDenyAllJaxRs(ResteasyBuiltinsProcessor.java:64)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:833)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
at io.quarkus.builder.Execution.run(Execution.java:123)
at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:160)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:331)
at io.quarkus.runner.bootstrap.AugmentActionImpl.reloadExistingApplication(AugmentActionImpl.java:265)
at io.quarkus.runner.bootstrap.AugmentActionImpl.reloadExistingApplication(AugmentActionImpl.java:60)
at io.quarkus.deployment.dev.IsolatedDevModeMain.restartApp(IsolatedDevModeMain.java:220)
at io.quarkus.deployment.dev.IsolatedDevModeMain.restartCallback(IsolatedDevModeMain.java:203)
at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:537)
at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:437)
at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$4.handle(VertxHttpHotReplacementSetup.java:152)
at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$4.handle(VertxHttpHotReplacementSetup.java:139)
at io.vertx.core.impl.ContextBase.lambda$null$0(ContextBase.java:137)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
at io.vertx.core.impl.ContextBase.lambda$executeBlocking$1(ContextBase.java:135)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:833)
Resulted in: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.resteasy.deployment.ResteasyBuiltinsProcessor#setUpDenyAllJaxRs threw an exception: java.lang.NullPointerException: Cannot invoke "org.jboss.jandex.ClassInfo.classAnnotations()" because "classInfo" is null
at io.quarkus.security.spi.SecurityTransformerUtils.hasSecurityAnnotation(SecurityTransformerUtils.java:47)
at io.quarkus.resteasy.deployment.ResteasyBuiltinsProcessor.setUpDenyAllJaxRs(ResteasyBuiltinsProcessor.java:64)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:833)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:335)
... 18 more
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
No response
Output of uname -a or ver
No response
Output of java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
No response
Build tool (ie. output of mvnw --version or gradlew --version)
No response
Additional information
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 57 (25 by maintainers)
do you have someone to help please ? its just the absolute minimum of the quarkus panache stack required to injtect the bug. its really sad to see that you dont have this everyday usefull kind of starter project allready going. so every bug reporter has to create a new project to start and help you with fixing you stuff. instead spend a little effort on a OUT OF THE BOX working starter demo project that everyone can use and checkout. integrate this in the template markdown as you have a pretti sufuscicated on already with all kinds of extra steps here and there. why not deliverying the solution to the customers that will bring you valuable but report information as quarkus is full of them, as i spend here so much time i feel like to need to get an extra paycheck from redhead, even tho its open source…
You can get your IDE to locate that class by adding
compileOnly("io.quarkus:quarkus-security-spi")I would start with a project generated from https://code.quarkus.io/?e=jdbc-h2&e=resteasy&e=smallrye-openapi&e=hibernate-orm-panache&e=hibernate-orm-rest-data-panache&extension-search=origin:platform rest
This is using classic RESTEasy. Looking at
ResteasyBuiltinsProcessor.setUpDenyAllJaxRs(), where thenullcomes from, it seems there are JAX-RS resources that are not in the combined index. That sounds weird, but looking atResteasyServerCommonProcessor.build(), it seems that sometimes we discover JAX-RS classes from the combined index and sometimes from ArC’s bean archive index. I have no idea why we do that.In any case, to help debugging this, it would be helpful to put a breakpoint at line 64 of
ResteasyBuiltinsProcessor.setUpDenyAllJaxRs()(the line that callshasSecurityAnnotation(classInfo), conditioned onclassInfo == null, and look where the class with givenclassNamecomes from.