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

Error log about log4j2 when building native or runnin using quarkus:dev #91

Closed
manofthepeace opened this issue Dec 8, 2023 · 19 comments · Fixed by #92
Closed

Error log about log4j2 when building native or runnin using quarkus:dev #91

manofthepeace opened this issue Dec 8, 2023 · 19 comments · Fixed by #92
Assignees
Labels
enhancement New feature or request

Comments

@manofthepeace
Copy link

I am developing an app that uses quarkus-poi, when I run (or perform a native build) I get the following

ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...

Adding the following dependency to my pom fixes the issue.

<dependency>
  <groupId>org.jboss.logmanager</groupId>
  <artifactId>log4j2-jboss-logmanager</artifactId>
</dependency>

Is that something that could be done within that project as written here; https://quarkus.io/guides/logging#add-a-logging-adapter-to-your-application

This step is unnecessary for libraries that are dependencies of a Quarkus extension where the extension handles it automatically.

@melloware
Copy link
Contributor

@gastaldi thoughts?

@melloware melloware added the enhancement New feature or request label Dec 8, 2023
@manofthepeace manofthepeace changed the title error log about lo4j2 when building native or junnin suing quarkus:dev error log about lo4j2 when building native or runnin using quarkus:dev Dec 8, 2023
@gastaldi
Copy link
Member

gastaldi commented Dec 8, 2023

I think it's just a matter of adding this dependency to quarkus-poi runtime's pom.xml?

@melloware
Copy link
Contributor

i think so too

@gastaldi
Copy link
Member

gastaldi commented Dec 8, 2023

Sounds good to me. Want to provide a PR?

@melloware
Copy link
Contributor

On it

@gastaldi
Copy link
Member

gastaldi commented Dec 8, 2023

BTW can you confirm log4j2 is required by poi?

@melloware melloware self-assigned this Dec 8, 2023
@gastaldi gastaldi changed the title error log about lo4j2 when building native or runnin using quarkus:dev Error log about log4j2 when building native or runnin using quarkus:dev Dec 8, 2023
@manofthepeace
Copy link
Author

[INFO] +- io.quarkiverse.poi:quarkus-poi:jar:2.0.4:compile
[INFO] |  +- io.quarkus:quarkus-awt:jar:3.6.1:compile
[INFO] |  +- org.apache.poi:poi:jar:5.2.4:compile
[INFO] |  |  +- commons-codec:commons-codec:jar:1.16.0:compile
[INFO] |  |  +- org.apache.commons:commons-collections4:jar:4.4:compile
[INFO] |  |  +- org.apache.commons:commons-math3:jar:3.6.1:compile
[INFO] |  |  +- commons-io:commons-io:jar:2.15.0:compile
[INFO] |  |  +- com.zaxxer:SparseBitSet:jar:1.3:compile
[INFO] |  |  \- org.apache.logging.log4j:log4j-api:jar:2.20.0:compile

@gastaldi
Copy link
Member

gastaldi commented Dec 8, 2023

Thank you

melloware added a commit to melloware/quarkus-poi that referenced this issue Dec 8, 2023
@melloware
Copy link
Contributor

PR Submitted

melloware added a commit to melloware/quarkus-poi that referenced this issue Dec 8, 2023
@manofthepeace
Copy link
Author

Wow, that was fast. Thank you guys!

@gastaldi
Copy link
Member

gastaldi commented Dec 8, 2023

Wow, that was fast. Thank you guys!

Just as Quarkus meant to be ;)

@melloware
Copy link
Contributor

@manofthepeace try 2.0.5 when you get a chance.

@manofthepeace
Copy link
Author

@melloware unfortunately something is off with the new version, When I compile native I get this, which fails the compilation;

Error: Discovered unresolved method during parsing: org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.putArchiveEntry(org.apache.commons.compress.archivers.zip.ZipArchiveEntry). This error is reported at image build time because class org.apache.poi.openxml4j.opc.internal.marshallers.ZipPartMarshaller is registered for linking at image build time by command line and command line.
Error encountered while parsing org.apache.poi.openxml4j.opc.ZipPackage.saveImpl(ZipPackage.java:575)
Parsing context:
   at org.apache.poi.openxml4j.opc.OPCPackage.save(OPCPackage.java:1532)
   at org.apache.poi.openxml4j.opc.OPCPackage.close(OPCPackage.java:506)
   at org.apache.poi.util.IOUtils.closeQuietly(IOUtils.java:486)
   at org.apache.poi.xssf.usermodel.XSSFWorkbook.close(XSSFWorkbook.java:642)
   at java.io.FileDescriptor.closeAll(FileDescriptor.java:352)
   at java.io.FileInputStream.close(FileInputStream.java:524)
   at sun.nio.cs.StreamDecoder.implClose(StreamDecoder.java:424)
   at sun.nio.cs.StreamDecoder.lockedClose(StreamDecoder.java:264)
   at sun.nio.cs.StreamDecoder.close(StreamDecoder.java:249)
   at java.io.InputStreamReader.close(InputStreamReader.java:203)
   at java.io.BufferedReader.implClose(BufferedReader.java:636)
   at java.io.BufferedReader.close(BufferedReader.java:621)
   at io.netty.util.internal.PlatformDependent$4.run(PlatformDependent.java:261)
   at io.netty.util.internal.PlatformDependent$4.run(PlatformDependent.java:231)
   at com.oracle.svm.core.jdk.Target_java_security_AccessController.executePrivileged(SecuritySubstitutions.java:129)
   at sun.java2d.loops.GraphicsPrimitive.<clinit>(GraphicsPrimitive.java:341)
   at static root method.(Unknown Source)

Detailed message:

com.oracle.svm.core.util.UserError$UserException: Discovered unresolved method during parsing: org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.putArchiveEntry(org.apache.commons.compress.archivers.zip.ZipArchiveEntry). This error is reported at image build time because class org.apache.poi.openxml4j.opc.internal.marshallers.ZipPartMarshaller is registered for linking at image build time by command line and command line.
Error encountered while parsing org.apache.poi.openxml4j.opc.ZipPackage.saveImpl(ZipPackage.java:575)
Parsing context:
   at org.apache.poi.openxml4j.opc.OPCPackage.save(OPCPackage.java:1532)
   at org.apache.poi.openxml4j.opc.OPCPackage.close(OPCPackage.java:506)
   at org.apache.poi.util.IOUtils.closeQuietly(IOUtils.java:486)
   at org.apache.poi.xssf.usermodel.XSSFWorkbook.close(XSSFWorkbook.java:642)
   at java.io.FileDescriptor.closeAll(FileDescriptor.java:352)
   at java.io.FileInputStream.close(FileInputStream.java:524)
   at sun.nio.cs.StreamDecoder.implClose(StreamDecoder.java:424)
   at sun.nio.cs.StreamDecoder.lockedClose(StreamDecoder.java:264)
   at sun.nio.cs.StreamDecoder.close(StreamDecoder.java:249)
   at java.io.InputStreamReader.close(InputStreamReader.java:203)
   at java.io.BufferedReader.implClose(BufferedReader.java:636)
   at java.io.BufferedReader.close(BufferedReader.java:621)
   at io.netty.util.internal.PlatformDependent$4.run(PlatformDependent.java:261)
   at io.netty.util.internal.PlatformDependent$4.run(PlatformDependent.java:231)
   at com.oracle.svm.core.jdk.Target_java_security_AccessController.executePrivileged(SecuritySubstitutions.java:129)
   at sun.java2d.loops.GraphicsPrimitive.<clinit>(GraphicsPrimitive.java:341)
   at static root method.(Unknown Source)

Detailed message:

    at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:85)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:248)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:814)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:592)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:550)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:538)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:720)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:142)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:97)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Discovered unresolved method during parsing: org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.putArchiveEntry(org.apache.commons.compress.archivers.zip.ZipArchiveEntry). This error is reported at image build time because class org.apache.poi.openxml4j.opc.internal.marshallers.ZipPartMarshaller is registered for linking at image build time by command line and command line.
Error encountered while parsing org.apache.poi.openxml4j.opc.ZipPackage.saveImpl(ZipPackage.java:575)
Parsing context:
   at org.apache.poi.openxml4j.opc.OPCPackage.save(OPCPackage.java:1532)
   at org.apache.poi.openxml4j.opc.OPCPackage.close(OPCPackage.java:506)
   at org.apache.poi.util.IOUtils.closeQuietly(IOUtils.java:486)
   at org.apache.poi.xssf.usermodel.XSSFWorkbook.close(XSSFWorkbook.java:642)
   at java.io.FileDescriptor.closeAll(FileDescriptor.java:352)
   at java.io.FileInputStream.close(FileInputStream.java:524)
   at sun.nio.cs.StreamDecoder.implClose(StreamDecoder.java:424)
   at sun.nio.cs.StreamDecoder.lockedClose(StreamDecoder.java:264)
   at sun.nio.cs.StreamDecoder.close(StreamDecoder.java:249)
   at java.io.InputStreamReader.close(InputStreamReader.java:203)
   at java.io.BufferedReader.implClose(BufferedReader.java:636)
   at java.io.BufferedReader.close(BufferedReader.java:621)
   at io.netty.util.internal.PlatformDependent$4.run(PlatformDependent.java:261)
   at io.netty.util.internal.PlatformDependent$4.run(PlatformDependent.java:231)
   at com.oracle.svm.core.jdk.Target_java_security_AccessController.executePrivileged(SecuritySubstitutions.java:129)
   at sun.java2d.loops.GraphicsPrimitive.<clinit>(GraphicsPrimitive.java:341)
   at static root method.(Unknown Source)

Detailed message:

    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:126)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:809)
    ... 6 more
Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.putArchiveEntry(org.apache.commons.compress.archivers.zip.ZipArchiveEntry). This error is reported at image build time because class org.apache.poi.openxml4j.opc.internal.marshallers.ZipPartMarshaller is registered for linking at image build time by command line and command line.
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:548)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:542)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedMethod(SharedGraphBuilderPhase.java:469)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedInvoke(SharedGraphBuilderPhase.java:366)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeVirtual(BytecodeParser.java:1740)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5439)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3431)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.iterateBytecodesForBlock(SharedGraphBuilderPhase.java:741)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3391)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3233)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1137)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.build(SharedGraphBuilderPhase.java:161)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1029)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:101)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:115)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:434)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:146)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.parseGraph(AnalysisMethod.java:895)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsedHelper(AnalysisMethod.java:860)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:843)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysisGraphDecoder.lookupEncodedGraph(InlineBeforeAnalysisGraphDecoder.java:175)
    at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.doInline(PEGraphDecoder.java:1211)
    at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.tryInline(PEGraphDecoder.java:1194)
    at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.trySimplifyInvoke(PEGraphDecoder.java:1049)
    at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.handleInvokeWithCallTarget(PEGraphDecoder.java:1001)
    at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.handleInvoke(PEGraphDecoder.java:987)
    at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.GraphDecoder.processNextNode(GraphDecoder.java:921)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysisGraphDecoder.processNextNode(InlineBeforeAnalysisGraphDecoder.java:344)
    at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.GraphDecoder.decode(GraphDecoder.java:650)
    at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.decode(PEGraphDecoder.java:892)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysis.decodeGraph(InlineBeforeAnalysis.java:76)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:195)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:621)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.createFlowsGraph(MethodTypeFlow.java:167)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureFlowsGraphCreated(MethodTypeFlow.java:153)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.getOrCreateMethodFlowsGraphInfo(MethodTypeFlow.java:111)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.typestate.DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultVirtualInvokeTypeFlow.java:113)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:620)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.PointsToAnalysis$1.run(PointsToAnalysis.java:491)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:187)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:171)
    at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

When running the app via quarkus:dev I get this;

 java.lang.NoSuchMethodError: 'void org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.putArchiveEntry(org.apache.commons.compress.archivers.zip.ZipArchiveEntry)'
	at org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.saveImpl(ZipContentTypeManager.java:65)
	at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.save(ContentTypeManager.java:450)
	at org.apache.poi.openxml4j.opc.ZipPackage.saveImpl(ZipPackage.java:608)
	at org.apache.poi.openxml4j.opc.OPCPackage.save(OPCPackage.java:1532)
	at org.apache.poi.openxml4j.opc.OPCPackage.save(OPCPackage.java:1519)
	at org.apache.poi.openxml4j.opc.ZipPackage.closeImpl(ZipPackage.java:515)
	at org.apache.poi.openxml4j.opc.OPCPackage.close(OPCPackage.java:502)
	at org.apache.poi.ooxml.POIXMLDocument.close(POIXMLDocument.java:189)
	at org.apache.poi.xssf.usermodel.XSSFWorkbook.close(XSSFWorkbook.java:640)

@gastaldi
Copy link
Member

gastaldi commented Dec 8, 2023

That's because you need commons-compress 1.25.0. See quarkusio/quarkus#37620 on how to workaround until the next Quarkus release

@manofthepeace
Copy link
Author

When I do a dependencytree I see compress 1.24 used instead of 1.25 as defined in the quarkus-poi pom

[INFO] |  +- org.apache.poi:poi-ooxml:jar:5.2.5:compile
[INFO] |  |  +- org.apache.xmlbeans:xmlbeans:jar:5.2.0:compile
[INFO] |  |  +- org.apache.commons:commons-compress:jar:1.24.0:compile
[INFO] |  |  \- com.github.virtuald:curvesapi:jar:1.08:compile

If I force the following in my pom

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-compress</artifactId>
      <version>1.25.0</version>
    </dependency>

it does work as expected

@manofthepeace
Copy link
Author

That's because you need commons-compress 1.25.0. See quarkusio/quarkus#37620 on how to workaround until the next Quarkus release

oh well looks like you where faster than me. but the solution above works as well

@gastaldi
Copy link
Member

gastaldi commented Dec 8, 2023

I think we can bypass that by adding commons-compress 1.25.0 in the same pom.xml runtime, WDYT @melloware ?

@gastaldi
Copy link
Member

gastaldi commented Dec 8, 2023

Ah but then the Quarkus BOM may still override it, nvm, your workaround is okay

@manofthepeace
Copy link
Author

if this quarkusio/quarkus#37187 gets backported to 3.6.2 next week then all will be good, so I think its all ok and no workarounds will be needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants