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

Runtime exception on building application jar #26773

Closed
wstryjew opened this issue Jul 18, 2022 · 7 comments · Fixed by #26810
Closed

Runtime exception on building application jar #26773

wstryjew opened this issue Jul 18, 2022 · 7 comments · Fixed by #26810
Labels
env/windows Impacts Windows machines kind/bug Something isn't working
Milestone

Comments

@wstryjew
Copy link

Describe the bug

When I try to build application jar the following exception occures:

ERROR] [error]: Build step io.quarkus.deployment.logging.LoggingResourceProcessor#setupLoggingRuntimeInit threw an exception: java.lang.RuntimeException: You cannot invoke getValue() directly on an object returned from the bytecode recorder, you can only pass it back into the recorder as a parameter [ERROR] at io.quarkus.deployment.recording.BytecodeRecorderImpl$3.invoke(BytecodeRecorderImpl.java:444) [ERROR] at io.quarkus.deployment.recording.BytecodeRecorderImpl$$ReturnValueProxy22.getValue(Unknown Source) [ERROR] at io.quarkus.runtime.logging.LoggingSetupRecorder.configureFileHandler(LoggingSetupRecorder.java:500) [ERROR] at io.quarkus.runtime.logging.LoggingSetupRecorder.createNamedHandlers(LoggingSetupRecorder.java:333) [ERROR] at io.quarkus.runtime.logging.LoggingSetupRecorder.initializeBuildTimeLogging(LoggingSetupRecorder.java:261) [ERROR] at io.quarkus.deployment.logging.LoggingResourceProcessor.setupLoggingRuntimeInit(LoggingResourceProcessor.java:225) [ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:566) [ERROR] at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:944) [ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:277) [ERROR] at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) [ERROR] at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) [ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) [ERROR] at java.base/java.lang.Thread.run(Thread.java:829) [ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:501) [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Possible root cause
Direct use of possibleFileFormatters in io.quarkus.runtime.logging.LoggingSetupRecorder::initializeBuildTimeLogging.
Does logging to file make sense at build time?

Expected behavior

Quarkus jar is build.

Actual behavior

Error occurs: Build step io.quarkus.deployment.logging.LoggingResourceProcessor#setupLoggingRuntimeInit threw an exception: java.lang.RuntimeException: You cannot invoke getValue() directly on an object returned from the
bytecode recorder, you can only pass it back into the recorder as a parameter

How to Reproduce?

a) Checkout https://github.com/quarkusio/quarkus-quickstarts/tree/main/getting-started
b) add the following to application.properties
quarkus.log.handler.file."aaa".enable=true
quarkus.log.handler.file."aaar".path=./logs/aaa.log
quarkus.log.handler.file."aaa".level=INFO
c) add depdencency to io.quarkus:quarkus-logging-json in pom.xml
d) run mvnw package

Output of uname -a or ver

Microsoft Windows [Version 10.0.19044.1766]

Output of java -version

openjdk 11.0.15 2022-04-19

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.10.x

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

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)

Additional information

No response

@wstryjew wstryjew added the kind/bug Something isn't working label Jul 18, 2022
@quarkus-bot quarkus-bot bot added env/windows Impacts Windows machines triage/needs-triage labels Jul 18, 2022
@wstryjew wstryjew changed the title Runtime exception on firing tests or building jar Runtime exception on building application jar Jul 18, 2022
@mihaipoenaru
Copy link

mihaipoenaru commented Jul 18, 2022

I have the same issue. Was about to open an issue myself but may as well use this one. For me it only happens when I use categories/handlers. The error strangely disappears when I comment out the %prod.quarkus.log.handler.file."PRINT_LOGGING".enable=true line

My other projects using the json-logging extensions work fine, but the difference is that I don't use categories. I'll keep trying arbitrary stuff, maybe I figure it out but someone should definitely look on this.

PS: If I comment out the above mentioned line, I get this error:

LogManager error of type GENERIC_FAILURE: Handler with name 'PRINT_LOGGING' is linked to a category but not configured.

My app.props file:

%dev.quarkus.http.port=8989
quarkus.http.test-port=8183
quarkus.arc.transform-unproxyable-classes=true

quarkus.jaeger.propagation=b3,jaeger

#LOGGING
quarkus.log.console.json=false
quarkus.log.file.json=true
quarkus.log.file.enable=true
quarkus.log.file.path=span.log
quarkus.log.file.format=%d{yyyy-MM-dd HH:mm:ss} [%p] [%t] traceId=%X{traceId} %m%n

%dev.quarkus.log.file.enable=false
%test.quarkus.log.file.enable=false

%prod.quarkus.log.handler.file."PRINT_LOGGING".path=analytics.log
%prod.quarkus.log.handler.file."PRINT_LOGGING".enable=true
%prod.quarkus.log.handler.file."PRINT_LOGGING".format=%s%n

%prod.quarkus.log.category."com.orange.vp.analytics.service.AnalyticsPrinter".handlers=PRINT_LOGGING

@mihaipoenaru
Copy link

@gsmet I think you worked on the json logging, right? Please, any chance this is an easy fix? I had to do a very ugly workaround to be able to log a json to file, and I need to get rid of it as soon as this is fixed.

@gsmet
Copy link
Member

gsmet commented Jul 19, 2022

@mihaipoenaru no idea. Please create a simple Maven reproducer so that we can have a look. Thanks!

@gsmet
Copy link
Member

gsmet commented Jul 19, 2022

Hmmm. I see what the problem is. No idea how to fix it yet.

@gsmet
Copy link
Member

gsmet commented Jul 19, 2022

I have a fix coming. Too late for 2.10.3.Final but I release 2.11.0.Final core artifacts tomorrow and it will be in it if all goes well.

gsmet added a commit to gsmet/quarkus that referenced this issue Jul 19, 2022
Despite being part of the recorder, it is called statically at build
time. We need to be extremely careful about it.

Fixes quarkusio#26773
@gsmet
Copy link
Member

gsmet commented Jul 19, 2022

PR is here: #26810 .

@quarkus-bot quarkus-bot bot added this to the 2.12 - main milestone Jul 19, 2022
@gsmet gsmet modified the milestones: 2.12 - main, 2.11.0.Final Jul 19, 2022
gsmet added a commit to gsmet/quarkus that referenced this issue Jul 19, 2022
Despite being part of the recorder, it is called statically at build
time. We need to be extremely careful about it.

Fixes quarkusio#26773

(cherry picked from commit d125cd8)
@mihaipoenaru
Copy link

Thanks a lot, @gsmet ❤️. There will now be one less ugly workaround in the world

ia3andy pushed a commit to ia3andy/quarkus that referenced this issue Jul 20, 2022
Despite being part of the recorder, it is called statically at build
time. We need to be extremely careful about it.

Fixes quarkusio#26773
michelle-purcell pushed a commit to michelle-purcell/quarkus that referenced this issue Jul 20, 2022
Despite being part of the recorder, it is called statically at build
time. We need to be extremely careful about it.

Fixes quarkusio#26773
@gsmet gsmet modified the milestones: 2.11.0.Final, 2.10.4.Final Jul 26, 2022
gsmet added a commit to gsmet/quarkus that referenced this issue Jul 26, 2022
Despite being part of the recorder, it is called statically at build
time. We need to be extremely careful about it.

Fixes quarkusio#26773

(cherry picked from commit d125cd8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
env/windows Impacts Windows machines kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants