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

MessageBundle(qute/jboss logging) not work with gradle multi module #21672

Closed
pipinet opened this issue Nov 24, 2021 · 9 comments
Closed

MessageBundle(qute/jboss logging) not work with gradle multi module #21672

pipinet opened this issue Nov 24, 2021 · 9 comments
Labels
area/gradle Gradle area/qute The template engine kind/bug Something isn't working

Comments

@pipinet
Copy link

pipinet commented Nov 24, 2021

Describe the bug

Can not start service with gradle multi module

Expected behavior

MessageBundle work well

Actual behavior

1、when use io.quarkus.qute.i18n.MessageBundle not work
2、when use org.jboss.logging.annotations.MessageBundle not work

How to Reproduce?

demo project in
https://github.com/qwlabs/quarkus-graphql/tree/jboss-logging
and
https://github.com/qwlabs/quarkus-graphql/tree/qute

step in README.md

Output of uname -a or ver

Darwin Kernel Version 20.6.0

Output of java -version

11.0.2

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.4.2.Final

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

Gradle 7.2

Additional information

No response

@pipinet pipinet added the kind/bug Something isn't working label Nov 24, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Nov 24, 2021

/cc @glefloch, @mkouba, @quarkusio/devtools

@pipinet
Copy link
Author

pipinet commented Nov 24, 2021

@dmlloyd hi
qute error message in here https://github.com/qwlabs/quarkus-graphql/blob/qute/README.md
jboss logging error message in here https://github.com/qwlabs/quarkus-graphql/blob/jboss-logging/README.md

there are work well with gradle single module but multi module.

@mkouba
Copy link
Contributor

mkouba commented Nov 24, 2021

hi qute error message in here https://github.com/qwlabs/quarkus-graphql/blob/qute/README.md

@pipinet it seems that the shared module is not a bean archive as described in the bean discovery documentation. You can try to place an empty beans.xml file in the META-INF of your shared module.

@pipinet
Copy link
Author

pipinet commented Nov 24, 2021

@pipinet
Copy link
Author

pipinet commented Nov 25, 2021

@mkouba hi,

in jboos logging case, i add class path to annotationProcessor fixed class not found error.

annotationProcessor("org.jboss.logging:jboss-logging:3.4.2.Final")

but quarkus gradle plugin not include annotationProcessor output folder build/generated/sources/annotationProcessor to class path

error message is :

$ ./gradlew quarkusDev

> Task :services:api-service:quarkusDev
Listening for transport dt_socket at address: 5005
Press [h] for more options>NG [3s]
Tests paused
Press [r] to resume testing, [h] for more options>
Press [r] to resume testing, [o] Toggle test output, [h] for more options>
2021-11-25 10:47:18,492 WARN  [io.qua.arc.dep.SplitPackageProcessor] (build-53) Detected a split package usage which is considered a bad practice and should be avoided. Following packages were detected in multiple archives:
- "com.qwlabs.quarkus" found in [qwlabs.crp:security::jar, qwlabs.crp:shared::jar]
     2021-11-25 10:47:18,682 INFO  [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure3s]
2021-11-25 10:47:18,793 INFO  [org.jbo.threads] (main) JBoss Threads version 3.4.2.Final
     2021-11-25 10:47:19,017 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.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.qwlabs.quarkus.SecurityMessages and qualifiers [@Default]
        - java member: com.qwlabs.quarkus.IdentityService#<init>()
        - declared on CLASS bean [types=[com.qwlabs.quarkus.IdentityService, java.lang.Object], qualifiers=[@Default, @Any], target=com.qwlabs.quarkus.IdentityService]
        at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1190)
        at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:268)
        at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:129)
        at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:418)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:821)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        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:834)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.qwlabs.quarkus.SecurityMessages and qualifiers [@Default]
        - java member: com.qwlabs.quarkus.IdentityService#<init>()
        - declared on CLASS bean [types=[com.qwlabs.quarkus.IdentityService, java.lang.Object], qualifiers=[@Default, @Any], target=com.qwlabs.quarkus.IdentityService]
        at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:567)
        at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:470)
        at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:256)
        ... 13 more

        at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:418)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:276)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:67)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:91)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:446)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:65)
        at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:149)
        at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:105)
        at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:145)
        at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:63)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.qwlabs.quarkus.SecurityMessages and qualifiers [@Default]
        - java member: com.qwlabs.quarkus.IdentityService#<init>()
        - declared on CLASS bean [types=[com.qwlabs.quarkus.IdentityService, java.lang.Object], qualifiers=[@Default, @Any], target=com.qwlabs.quarkus.IdentityService]
        at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1190)
        at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:268)
        at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:129)
        at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:418)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:821)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        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:834)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.qwlabs.quarkus.SecurityMessages and qualifiers [@Default]
        - java member: com.qwlabs.quarkus.IdentityService#<init>()
        - declared on CLASS bean [types=[com.qwlabs.quarkus.IdentityService, java.lang.Object], qualifiers=[@Default, @Any], target=com.qwlabs.quarkus.IdentityService]
        at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:567)
        at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:470)
        at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:256)
        ... 13 more

        at io.quarkus.builder.Execution.run(Execution.java:116)
        at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
        at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:161)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:416)
        ... 9 more
Caused by: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.qwlabs.quarkus.SecurityMessages and qualifiers [@Default]
        - java member: com.qwlabs.quarkus.IdentityService#<init>()
        - declared on CLASS bean [types=[com.qwlabs.quarkus.IdentityService, java.lang.Object], qualifiers=[@Default, @Any], target=com.qwlabs.quarkus.IdentityService]
        at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1190)
        at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:268)
        at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:129)
        at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:418)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:821)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        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:834)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.qwlabs.quarkus.SecurityMessages and qualifiers [@Default]
        - java member: com.qwlabs.quarkus.IdentityService#<init>()
        - declared on CLASS bean [types=[com.qwlabs.quarkus.IdentityService, java.lang.Object], qualifiers=[@Default, @Any], target=com.qwlabs.quarkus.IdentityService]
        at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:567)
        at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:470)
        at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:256)
        ... 13 more


<============-> 94% EXECUTING [4m 5s]
> :services:api-service:quarkusDev

@mkouba
Copy link
Contributor

mkouba commented Nov 25, 2021

@pipinet By default, jboss-logging message bundles cannot be injected via CDI. You can obtain the message bundle via org.jboss.logging.Messages.getBundle(Class<T>) instead. Typically, you'll initialize a static field like this:

@MessageBundle(projectCode = "QWSEC")
public interface SecurityMessages {

    SecurityMessages log =  org.jboss.logging.Messages.getBundle(SecurityMessages.class);

    @Message(value = "User name not found")
    RuntimeException usernameNotFound();
}

And then just use SecurityMessages.LOG.usernameNotFound() in your code.

@pipinet
Copy link
Author

pipinet commented Nov 25, 2021

@mkouba oh, i forgot it, I used this way in single module project.

@mkouba
Copy link
Contributor

mkouba commented Nov 25, 2021

Ok, I think we can close this issue now ;-)

@mkouba mkouba closed this as completed Nov 25, 2021
@pipinet
Copy link
Author

pipinet commented Nov 25, 2021

@mkouba sure!thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gradle Gradle area/qute The template engine kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants