quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.44k stars 2.58k forks source link

Quarkus Webjars ClassTooLargeException #40870

Closed christophmertins closed 1 month ago

christophmertins commented 2 months ago

Describe the bug

I have a issue with integrating a large webjar. OpenUI5 is containing a lot of small js files contained in jars.

This is the test dependency.

    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-webjars-locator</artifactId>
    </dependency>

    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>openui5</artifactId>
      <version>1.120.10</version>
    </dependency>
2024-05-28 15:34:51,344 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.deployment.steps.MainClassBuildStep#build threw an exception: org.objectweb.asm.ClassTooLargeException: Class too large: io/quarkus/deployment/steps/StaticResourcesProcessor$runtimeInit1742689569
        at org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:622)
        at io.quarkus.gizmo.ClassCreator.writeTo(ClassCreator.java:246)
        at io.quarkus.gizmo.ClassCreator.close(ClassCreator.java:257)
        at io.quarkus.deployment.recording.BytecodeRecorderImpl.writeBytecode(BytecodeRecorderImpl.java:571)
        at io.quarkus.deployment.steps.MainClassBuildStep.writeRecordedBytecode(MainClassBuildStep.java:501)
        at io.quarkus.deployment.steps.MainClassBuildStep.build(MainClassBuildStep.java:275)
        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:337)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:254)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:60)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:112)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:433)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:55)
        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.deployment.steps.MainClassBuildStep#build threw an exception: org.objectweb.asm.ClassTooLargeException: Class too large: io/quarkus/deployment/steps/StaticResourcesProcessor$runtimeInit1742689569
        at org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:622)
        at io.quarkus.gizmo.ClassCreator.writeTo(ClassCreator.java:246)
        at io.quarkus.gizmo.ClassCreator.close(ClassCreator.java:257)
        at io.quarkus.deployment.recording.BytecodeRecorderImpl.writeBytecode(BytecodeRecorderImpl.java:571)
        at io.quarkus.deployment.steps.MainClassBuildStep.writeRecordedBytecode(MainClassBuildStep.java:501)
        at io.quarkus.deployment.steps.MainClassBuildStep.build(MainClassBuildStep.java:275)
        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.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:333)
        ... 9 more
Caused by: org.objectweb.asm.ClassTooLargeException: Class too large: io/quarkus/deployment/steps/StaticResourcesProcessor$runtimeInit1742689569
        at org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:622)
        at io.quarkus.gizmo.ClassCreator.writeTo(ClassCreator.java:246)
        at io.quarkus.gizmo.ClassCreator.close(ClassCreator.java:257)
        at io.quarkus.deployment.recording.BytecodeRecorderImpl.writeBytecode(BytecodeRecorderImpl.java:571)
        at io.quarkus.deployment.steps.MainClassBuildStep.writeRecordedBytecode(MainClassBuildStep.java:501)
        at io.quarkus.deployment.steps.MainClassBuildStep.build(MainClassBuildStep.java:275)
        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)

Version 1.115.0 of the openui5 dependency works, only version 1.120.10 is open

Expected behavior

Deliver the static ressources

Actual behavior

error message

How to Reproduce?

  1. Create a POM with the 2 dependencies included.
  2. Access a ressource in the webjar e.g. "/webjars/openui5/resources/sap-ui-core.js"

Output of uname -a or ver

No response

Output of java -version

Java version: 21.0.1, vendor: Eclipse Adoptium

Quarkus version or git rev

3.10.2

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

maven 3.9.5

Additional information

No response

geoand commented 2 months ago

cc @phillip-kruger

phillip-kruger commented 2 months ago

That is a big zip file. Can you try and use the files you need from npmjs ? Use mvnpm.org rather than webjars (mvnpm jars are smaller) and also know that the extension name has changed:

<dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-web-dependency-locator</artifactId>
    </dependency>
christophmertins commented 1 month ago

Removed the dependency and moved that in a separate project. So not fixed for me in Quarkus, but I have a work around.