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

ClassNotFoundException in dev mode with @MessageBundle and properties file #11188

Closed
derkoe opened this issue Aug 4, 2020 · 2 comments · Fixed by #11192
Closed

ClassNotFoundException in dev mode with @MessageBundle and properties file #11188

derkoe opened this issue Aug 4, 2020 · 2 comments · Fixed by #11192
Assignees
Labels
area/devmode area/qute The template engine kind/bug Something isn't working
Milestone

Comments

@derkoe
Copy link

derkoe commented Aug 4, 2020

Describe the bug
java.lang.ClassNotFoundException in dev mode (mvn quarkus:dev) when using @MessageBundle with properties files.

The same code works when bundling the application with mvn package and launching the JAR.

Expected behavior
The properties from msg_de.properties are loaded into the ApplicationMessages in dev mode.

Actual behavior
An exception is thrown.

java.lang.ClassNotFoundException: at.porscheinformatik.bazaar.ApplicationMessages
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:426)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:363)
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:420)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:363)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:426)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:363)
	at at.porscheinformatik.bazaar.ApplicationMessages_6c2e17da52e74fd894575403e6dbcf3fc2744ee9_Synthetic_Bean.create(ApplicationMessages_6c2e17da52e74fd894575403e6dbcf3fc2744ee9_Synthetic_Bean.zig:137)
	at at.porscheinformatik.bazaar.ApplicationMessages_6c2e17da52e74fd894575403e6dbcf3fc2744ee9_Synthetic_Bean.create(ApplicationMessages_6c2e17da52e74fd894575403e6dbcf3fc2744ee9_Synthetic_Bean.zig:156)
	at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:88)
	at io.quarkus.arc.impl.ComputingCache$CacheFunction.lambda$apply$0(ComputingCache.java:99)
	at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
	at io.quarkus.arc.impl.ComputingCache.getValue(ComputingCache.java:41)
	at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:25)
	at at.porscheinformatik.bazaar.ApplicationMessages_6c2e17da52e74fd894575403e6dbcf3fc2744ee9_Synthetic_Bean.get(ApplicationMessages_6c2e17da52e74fd894575403e6dbcf3fc2744ee9_Synthetic_Bean.zig:188)
	at at.porscheinformatik.bazaar.ApplicationMessages_6c2e17da52e74fd894575403e6dbcf3fc2744ee9_Synthetic_Bean.get(ApplicationMessages_6c2e17da52e74fd894575403e6dbcf3fc2744ee9_Synthetic_Bean.zig:204)
	at io.quarkus.arc.impl.InstanceImpl.getBeanInstance(InstanceImpl.java:210)
	at io.quarkus.arc.impl.InstanceImpl.getInternal(InstanceImpl.java:196)
	at io.quarkus.arc.impl.InstanceImpl.get(InstanceImpl.java:93)
	at io.quarkus.qute.i18n.MessageBundles.setupNamespaceResolvers(MessageBundles.java:73)
	at io.quarkus.qute.i18n.MessageBundles_Observer_setupNamespaceResolvers_4f71b9cf1ad0f31200829efc11f16a310a169db8.notify(MessageBundles_Observer_setupNamespaceResolvers_4f71b9cf1ad0f31200829efc11f16a310a169db8.zig:264)
	at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:282)
	at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:263)
	at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:69)
	at io.quarkus.qute.runtime.EngineProducer.<init>(EngineProducer.java:87)
	at io.quarkus.qute.runtime.EngineProducer_Bean.create(EngineProducer_Bean.zig:414)
	at io.quarkus.qute.runtime.EngineProducer_Bean.create(EngineProducer_Bean.zig:429)
	at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:88)
	at io.quarkus.arc.impl.ComputingCache$CacheFunction.lambda$apply$0(ComputingCache.java:99)
	at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
	at io.quarkus.arc.impl.ComputingCache.getValue(ComputingCache.java:41)
	at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:25)
	at io.quarkus.qute.runtime.EngineProducer_Bean.get(EngineProducer_Bean.zig:461)
	at io.quarkus.qute.runtime.EngineProducer_Bean.get(EngineProducer_Bean.zig:477)
	at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:408)
	at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:421)
	at io.quarkus.arc.impl.ArcContainerImpl.instance(ArcContainerImpl.java:258)
	at io.quarkus.qute.runtime.EngineProducer_Observer_Synthetic_5ca7449e3ab1631e7e8ed910338051c00d29a79b.notify(EngineProducer_Observer_Synthetic_5ca7449e3ab1631e7e8ed910338051c00d29a79b.zig:89)
	at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:282)
	at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:267)
	at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:69)
	at io.quarkus.arc.runtime.LifecycleEventRunner.fireStartupEvent(LifecycleEventRunner.java:23)
	at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:113)
	at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent-858218658.deploy_0(LifecycleEventsBuildStep$startupEvent-858218658.zig:81)
	at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent-858218658.deploy(LifecycleEventsBuildStep$startupEvent-858218658.zig:40)
	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:751)
	at io.quarkus.runtime.Application.start(Application.java:90)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:91)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:61)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:106)
	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
	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.runner.bootstrap.StartupActionImpl$3.run(StartupActionImpl.java:145)
	at java.base/java.lang.Thread.run(Thread.java:834)
Resulted in: java.lang.NoClassDefFoundError: at/porscheinformatik/bazaar/ApplicationMessages
	... 57 more
Resulted in: java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:824)
	... 12 more
Resulted in: java.lang.RuntimeException: java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.dev.appstate.ApplicationStateNotification.waitForApplicationStart(ApplicationStateNotification.java:51)
	at io.quarkus.runner.bootstrap.StartupActionImpl.runMainClass(StartupActionImpl.java:156)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.restartApp(IsolatedDevModeMain.java:173)
	at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:183)
	at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$2.handle(VertxHttpHotReplacementSetup.java:61)
	at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$2.handle(VertxHttpHotReplacementSetup.java:51)
	at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:313)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	... 1 more

To Reproduce
Steps to reproduce the behavior:

  1. Create a class ApplicationMessages
    @MessageBundle(defaultKey = Message.HYPHENATED_ELEMENT_NAME)
    public interface ApplicationMessages {
      @Message(value = "Hello, {name} !")
      String helloName(String name);
    }
    
  2. Create a file src/main/resources/messages/msg_de.properties with the following content
    helloName=Hallo {name}!
    
  3. Run the app in dev mode: mvn compile quarkus:dev

Environment (please complete the following information):

  • Output of uname -a or ver:
    Linux MYPC 4.19.84-microsoft-standard #1 SMP Wed Nov 13 11:44:37 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux`
    
  • Output of java -version:
    openjdk version "11.0.8" 2020-07-14
    OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu120.04)
    OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)
    
  • GraalVM version (if different from Java): -
  • Quarkus version or git rev: 1.7.0.CR1
  • Build tool (ie. output of mvnw --version or gradlew --version):
    Apache Maven 3.6.3
    Maven home: /usr/share/maven
    Java version: 11.0.8, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
    Default locale: en_US, platform encoding: UTF-8
    OS name: "linux", version: "4.19.84-microsoft-standard", arch: "amd64", family: "unix
    

Additional context
Also interesting is that the key in the msg_de.properties has to be named helloName and not hello-name. When using hello-name an error is shown. I had expected the key to use the hyphenated name.

io.quarkus.qute.deployment.MessageBundleException: Message bundle method hello-name() not found on: at.porscheinformatik.bazaar.ApplicationMessages
	- file: /home/koc/git/github.com/porscheinformatik/bazaar/target/classes/messages/msg_de.properties
@derkoe derkoe added the kind/bug Something isn't working label Aug 4, 2020
@geoand geoand added the area/qute The template engine label Aug 4, 2020
@geoand
Copy link
Contributor

geoand commented Aug 4, 2020

@mkouba I'll take a quick look at this one today if I have the time. If I don't get it done today, I'll leave it to you since I'm going on PTO.

Either way, I'll let you know

@geoand
Copy link
Contributor

geoand commented Aug 4, 2020

#11192 should fix the issue

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

Successfully merging a pull request may close this issue.

4 participants