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

BeanArchiveProcessor#build threw an exception: Local name must not be null #43825

Closed
rodcheater opened this issue Oct 11, 2024 · 5 comments · Fixed by #44063
Closed

BeanArchiveProcessor#build threw an exception: Local name must not be null #43825

rodcheater opened this issue Oct 11, 2024 · 5 comments · Fixed by #44063
Labels
area/undertow kind/bug Something isn't working
Milestone

Comments

@rodcheater
Copy link
Contributor

Describe the bug

I am wanting to migrate a large existing codebase from Tomcat to Quarkus. When I do ./gradlew :quarkusAppPartsBuild I get this error:

2024-10-11 12:53:42,970 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.arc.deployment.BeanArchiveProcessor#build threw an exception: java.lang.IllegalArgumentException: Local name must not be null
        at org.jboss.jandex.DotName.<init>(DotName.java:137)
        at org.jboss.jandex.DotName.createSimple(DotName.java:77)
        at io.quarkus.deployment.index.IndexingUtil.indexClass(IndexingUtil.java:151)
        at io.quarkus.arc.deployment.BeanArchiveProcessor.build(BeanArchiveProcessor.java:94)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
        at java.base/java.lang.Thread.run(Thread.java:1583)
        at org.jboss.threads.JBossThread.run(JBossThread.java:483)

        at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:331)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:252)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:58)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:113)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:435)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:56)
        at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:138)
        at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:93)
        at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:131)
        at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.arc.deployment.BeanArchiveProcessor#build threw an exception: java.lang.IllegalArgumentException: Local name must not be null
...

I can see from the debugger that the null name comes from the list of additional bean classes, but I don’t know where that list comes from.

How would I go about diagnosing this error?

Expected behavior

The build succeeds.

Actual behavior

The build fails.

How to Reproduce?

I doubt that I could reproduce this outside of my existing codebase, not without knowing what the issue is.

Output of uname -a or ver

Darwin Rods-MacBook-Pro.local 24.0.0 Darwin Kernel Version 24.0.0: Tue Sep 24 23:35:10 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T6031 arm64

Output of java -version

openjdk version "21.0.4" 2024-07-16 OpenJDK Runtime Environment Homebrew (build 21.0.4) OpenJDK 64-Bit Server VM Homebrew (build 21.0.4, mixed mode, sharing)

Quarkus version or git rev

3.15.1

Build tool (ie. output of mvnw --version or gradlew --version)

Gradle 8.9

Additional information

No response

@rodcheater rodcheater added the kind/bug Something isn't working label Oct 11, 2024
@mkouba
Copy link
Contributor

mkouba commented Oct 14, 2024

I can see from the debugger that the null name comes from the list of additional bean classes, but I don’t know where that list comes from.

The list is built from AdditionalBeanBuildItems procuded by build steps from extensions. We should probably throw an NPE when a AdditionalBeanBuildItem is created for a null value. Or at least ignore the null values...

I doubt that I could reproduce this outside of my existing codebase, not without knowing what the issue is.

Could you at least share the list of extensions used in your app?

@mkouba mkouba added area/arc Issue related to ARC (dependency injection) and removed triage/needs-triage labels Oct 14, 2024
Copy link

quarkus-bot bot commented Oct 14, 2024

/cc @Ladicek (arc), @manovotn (arc)

@mkouba
Copy link
Contributor

mkouba commented Oct 14, 2024

@rodcheater You can try to build the Quarkus from this branch: https://github.com/mkouba/quarkus/tree/issue-43825 and then use version 999-SNAPSHOT to build your project. Then you should see a NPE thrown from the extension that attempts to produce an invalid AdditionalBeanBuildItem.

@rodcheater
Copy link
Contributor Author

Thanks for your help @mkouba; I was able to diagnose the issue. Turns out the issue was in the Undertow extension and it’s because I had some servlets with <jsp-file> rather than <servlet-class> entries in my web.xml. The missing servlet class name was being included in the list of additional build bean items.

Here’s the stacktrace I got; root cause is adding a null servlet class name at line 82 of extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/WebXmlParsingBuildStep.java.

	[error]: Build step io.quarkus.undertow.deployment.WebXmlParsingBuildStep#createWebMetadata threw an exception: java.lang.NullPointerException
	at java.base/java.util.Objects.requireNonNull(Objects.java:233)
	at java.base/java.util.ImmutableCollections.listFromArray(ImmutableCollections.java:192)
	at java.base/java.util.List.of(List.java:1172)
	at java.base/java.util.ImmutableCollections.listCopy(ImmutableCollections.java:174)
	at java.base/java.util.List.copyOf(List.java:1193)
	at io.quarkus.arc.deployment.AdditionalBeanBuildItem$Builder.build(AdditionalBeanBuildItem.java:153)
	at io.quarkus.undertow.deployment.WebXmlParsingBuildStep.lambda$createWebMetadata$0(WebXmlParsingBuildStep.java:96)
	at io.quarkus.deployment.ApplicationArchiveImpl.apply(ApplicationArchiveImpl.java:94)
	at io.quarkus.undertow.deployment.WebXmlParsingBuildStep.createWebMetadata(WebXmlParsingBuildStep.java:61)
	at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
	at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
	at java.base/java.lang.Thread.run(Thread.java:1583)
	at org.jboss.threads.JBossThread.run(JBossThread.java:499)

@mkouba mkouba added area/undertow and removed area/arc Issue related to ARC (dependency injection) labels Oct 22, 2024
@mkouba
Copy link
Contributor

mkouba commented Oct 22, 2024

Thanks for your help @mkouba; I was able to diagnose the issue. Turns out the issue was in the Undertow extension and it’s because I had some servlets with <jsp-file> rather than <servlet-class> entries in my web.xml. The missing servlet class name was being included in the list of additional build bean items.

@rodcheater Thanks for your analysis! It seems that servlet-class is not mandatory. Would you care to send a pull request with a fix - simply ignore the servlet metadata if the servlet class is empty?

rodcheater added a commit to rodcheater/quarkus that referenced this issue Oct 24, 2024
Avoids writing a null bean name to the bean archive, which causes a
later build failure.

Fixes quarkusio#43825
rodcheater added a commit to rodcheater/quarkus that referenced this issue Oct 24, 2024
Avoids writing a null bean name to the bean archive, which causes a
later build failure.

Fixes quarkusio#43825
@quarkus-bot quarkus-bot bot added this to the 3.17 - main milestone Oct 24, 2024
@gsmet gsmet modified the milestones: 3.17 - main, 3.16.1 Oct 28, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue Oct 28, 2024
Avoids writing a null bean name to the bean archive, which causes a
later build failure.

Fixes quarkusio#43825

(cherry picked from commit df4696b)
@gsmet gsmet modified the milestones: 3.16.1, 3.15.2 Nov 13, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue Nov 13, 2024
Avoids writing a null bean name to the bean archive, which causes a
later build failure.

Fixes quarkusio#43825

(cherry picked from commit df4696b)
bschuhmann pushed a commit to bschuhmann/quarkus that referenced this issue Nov 16, 2024
Avoids writing a null bean name to the bean archive, which causes a
later build failure.

Fixes quarkusio#43825
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/undertow kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants