quarkusio / quarkus

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

Devservices derby doesn't start because of missing resource bundle #23083

Open JiriOndrusek opened 2 years ago

JiriOndrusek commented 2 years ago

Describe the bug

Issue seems to be the same as the older (fixed) one - https://github.com/quarkusio/quarkus/issues/21639. According to the documentation, zero config setup for Apache derby should work. But if it is used, there is an error preventing db to start:

java.util.MissingResourceException: Can't find bundle for base name org.apache.derby.loc.drda.messages, locale en
    at java.base/java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:2055)
    at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1689)
    at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1593)
    at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1556)
    at java.base/java.util.ResourceBundle.getBundle(ResourceBundle.java:932)
    at org.apache.derby.iapi.tools.i18n.LocalizedResource.setResource(Unknown Source)

Expected behavior

Derby dev service should start.

Actual behavior

No response

How to Reproduce?

Issue could be reproduced with quarkus-quickstart spring-data-jpa-quickstart



### Output of `uname -a` or `ver`

_No response_

### Output of `java -version`

_No response_

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

1.6.0-1.6.3, 2.7.0.CR1

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

_No response_

### Additional information

_No response_
quarkus-bot[bot] commented 2 years ago

/cc @stuartwdouglas

stuartwdouglas commented 2 years ago

So the issue here is that even though the server parts of derby are listed as parent first they don't actually end up on the class path, as they are only deployment time dependencies rather than runtime ones, so the client can't see them.

We could add them as dependencies in the mojo/gradle plugin I guess, but 'launch from IDE' still won't work.

We could also just stop them all being parent first, but then we run into https://github.com/quarkusio/quarkus/issues/14829.

@aloubyansky do you have any ideas here? I can't really think of any way to make this work at the moment.

aloubyansky commented 2 years ago

I actually don't see how parentFirst (or the absence of it) plays a role in this case. What I had in mind investigating is adding a "prepare-test" goal in, e.g. process-test-classes phase, that would be added to the default lifecycle of the quarkus-maven-plugin (and so wouldn't need to be explicitly configured in applications) in which we could do all sorts of classpath preparations (including the resolution of the application model using the original Maven resolver istead of our bootstrap one with limited workspace discovery). For example, we could generate classes and resources in the locations surefire/failsafe plugins are collecting resources from. Not sure it would be reasonable in this kind of case, but we could theoretically copy these message bundles to test-classes as part of that goal.

aloubyansky commented 2 years ago

That doesn't seem to work launching tests from an IDE though, of course.

aloubyansky commented 2 years ago

Otherwise, it works from the command line

[aloubyansky@fedora spring-data-jpa-quickstart]$ mvn clean test
[INFO] Scanning for projects...
[INFO] 
[INFO] ----------------< org.acme:spring-data-jpa-quickstart >-----------------
[INFO] Building spring-data-jpa-quickstart 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ spring-data-jpa-quickstart ---
[INFO] Deleting /home/aloubyansky/git/quarkus-quickstarts/spring-data-jpa-quickstart/target
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ spring-data-jpa-quickstart ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ spring-data-jpa-quickstart ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /home/aloubyansky/git/quarkus-quickstarts/spring-data-jpa-quickstart/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ spring-data-jpa-quickstart ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory /home/aloubyansky/git/quarkus-quickstarts/spring-data-jpa-quickstart/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ spring-data-jpa-quickstart ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/aloubyansky/git/quarkus-quickstarts/spring-data-jpa-quickstart/target/test-classes
[INFO] 
[INFO] --- quarkus-maven-plugin:999-SNAPSHOT:prepareTest (default-prepareTest) @ spring-data-jpa-quickstart ---
[INFO] 
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ spring-data-jpa-quickstart ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.acme.spring.data.jpa.FruitResourceTest
2022-01-25 23:25:47,287 INFO  [org.jbo.threads] (main) JBoss Threads version 3.4.2.Final
2022-01-25 23:25:47,856 INFO  [io.qua.dev.der.dep.DerbyDevServicesProcessor] (build-18) Attempt 1 to see if Dev Services for Derby started
Tue Jan 25 23:25:47 CET 2022 : Apache Derby Network Server - 10.14.2.0 - (1828579) started and ready to accept connections on port 1527
2022-01-25 23:25:47,892 INFO  [io.qua.dev.der.dep.DerbyDevServicesProcessor] (build-18) Dev Services for Derby started.
2022-01-25 23:25:47,901 INFO  [io.qua.dat.dep.dev.DevServicesDatasourceProcessor] (build-18) Dev Services for the default datasource (derby) started.
JiriOndrusek commented 2 years ago

Hi @aloubyansky, if I understand correctly your comment, the quickstart spring-data-jpa-quickstart works for you from cmd. I tested it again and it fails. Here is the description of my steps.

  1. I built quarkus from the main branch, revision 0c7f8ba48a51d29ae8efbd728d74d00ca12c7db5
  2. I built spring-data-jpa-quickstart from the branch development (revision 0ed819fe75aafe879f5481eddcebf737a0d39cf2)
  3. I changed pom.xml to use derby instead of postgresl. I changed this line https://github.com/quarkusio/quarkus-quickstarts/blob/main/spring-data-jpa-quickstart/pom.xml#L40 to <artifactId>quarkus-jdbc-derby</artifactId>
  4. I executed maven test from cmd (from the folder ../quarkus-quickstarts/spring-data-jpa-quickstart by executing mvn clean test - my java is openjdk version "11.0.12" 2021-07-20)
  5. The result is failure
[INFO] Scanning for projects...
[INFO] 
[INFO] ----------------< org.acme:spring-data-jpa-quickstart >-----------------
[INFO] Building spring-data-jpa-quickstart 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ spring-data-jpa-quickstart ---
[INFO] Deleting /home/jondruse/git/community/quarkus-quickstarts/spring-data-jpa-quickstart/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ spring-data-jpa-quickstart ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ spring-data-jpa-quickstart ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /home/jondruse/git/community/quarkus-quickstarts/spring-data-jpa-quickstart/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ spring-data-jpa-quickstart ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/jondruse/git/community/quarkus-quickstarts/spring-data-jpa-quickstart/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ spring-data-jpa-quickstart ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/jondruse/git/community/quarkus-quickstarts/spring-data-jpa-quickstart/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ spring-data-jpa-quickstart ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.acme.spring.data.jpa.FruitResourceTest
2022-01-27 15:18:32,450 INFO  [org.jbo.threads] (main) JBoss Threads version 3.4.2.Final
2022-01-27 15:18:33,037 INFO  [io.qua.dev.der.dep.DerbyDevServicesProcessor] (build-28) Attempt 1 to see if Dev Services for Derby started
Thu Jan 27 15:18:33 CET 2022 : Connection reset
java.net.SocketException: Connection reset
    at java.base/java.net.SocketInputStream.read(SocketInputStream.java:186)
    at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
    at java.base/java.net.SocketInputStream.read(SocketInputStream.java:126)
    at org.apache.derby.impl.drda.NetworkServerControlImpl.fillReplyBuffer(Unknown Source)
    at org.apache.derby.impl.drda.NetworkServerControlImpl.readResult(Unknown Source)
    at org.apache.derby.impl.drda.NetworkServerControlImpl.pingWithNoOpen(Unknown Source)
    at org.apache.derby.impl.drda.NetworkServerControlImpl.ping(Unknown Source)
    at org.apache.derby.drda.NetworkServerControl.ping(Unknown Source)
    at io.quarkus.devservices.derby.deployment.DerbyDevServicesProcessor$1.startDatabase(DerbyDevServicesProcessor.java:44)
    at io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor.startDevDb(DevServicesDatasourceProcessor.java:266)
    at io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor.launchDatabases(DevServicesDatasourceProcessor.java:121)
    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:882)
    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:829)
    at org.jboss.threads.JBossThread.run(JBossThread.java:501)
2022-01-27 15:18:33,742 INFO  [io.qua.dev.der.dep.DerbyDevServicesProcessor] (build-28) Attempt 2 to see if Dev Services for Derby started
2022-01-27 15:18:34,243 INFO  [io.qua.dev.der.dep.DerbyDevServicesProcessor] (build-28) Attempt 3 to see if Dev Services for Derby started
2022-01-27 15:18:34,744 INFO  [io.qua.dev.der.dep.DerbyDevServicesProcessor] (build-28) Attempt 4 to see if Dev Services for Derby started
2022-01-27 15:18:35,245 INFO  [io.qua.dev.der.dep.DerbyDevServicesProcessor] (build-28) Attempt 5 to see if Dev Services for Derby started
2022-01-27 15:18:35,746 INFO  [io.qua.dev.der.dep.DerbyDevServicesProcessor] (build-28) Attempt 6 to see if Dev Services for Derby started
2022-01-27 15:18:36,246 INFO  [io.qua.dev.der.dep.DerbyDevServicesProcessor] (build-28) Attempt 7 to see if Dev Services for Derby started
2022-01-27 15:18:36,747 INFO  [io.qua.dev.der.dep.DerbyDevServicesProcessor] (build-28) Attempt 8 to see if Dev Services for Derby started
2022-01-27 15:18:37,248 INFO  [io.qua.dev.der.dep.DerbyDevServicesProcessor] (build-28) Attempt 9 to see if Dev Services for Derby started
2022-01-27 15:18:37,748 INFO  [io.qua.dev.der.dep.DerbyDevServicesProcessor] (build-28) Attempt 10 to see if Dev Services for Derby started
2022-01-27 15:18:37,749 ERROR [io.qua.dev.der.dep.DerbyDevServicesProcessor] (build-28) Dev Services for Derby failed to start: java.util.MissingResourceException: Can't find bundle for base name org.apache.derby.loc.drda.messages, locale en
    at java.base/java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:2055)
    at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1689)
    at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1593)
    at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1556)
    at java.base/java.util.ResourceBundle.getBundle(ResourceBundle.java:932)
    at org.apache.derby.iapi.tools.i18n.LocalizedResource.setResource(Unknown Source)
    at org.apache.derby.iapi.tools.i18n.LocalizedResource.getTextMessage(Unknown Source)
    at org.apache.derby.impl.drda.NetworkServerControlImpl.localizeMessage(Unknown Source)
    at org.apache.derby.impl.drda.NetworkServerControlImpl.consolePropertyMessageWork(Unknown Source)
    at org.apache.derby.impl.drda.NetworkServerControlImpl.consolePropertyMessage(Unknown Source)
    at org.apache.derby.impl.drda.NetworkServerControlImpl.setUpSocket(Unknown Source)
    at org.apache.derby.impl.drda.NetworkServerControlImpl.ping(Unknown Source)
    at org.apache.derby.drda.NetworkServerControl.ping(Unknown Source)
    at io.quarkus.devservices.derby.deployment.DerbyDevServicesProcessor$1.startDatabase(DerbyDevServicesProcessor.java:44)
    at io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor.startDevDb(DevServicesDatasourceProcessor.java:266)
    at io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor.launchDatabases(DevServicesDatasourceProcessor.java:121)
    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:882)
    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:829)
    at org.jboss.threads.JBossThread.run(JBossThread.java:501)

[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 1, Time elapsed: 8.295 s <<< FAILURE! - in org.acme.spring.data.jpa.FruitResourceTest
...

Is there a problem in my scenario?

aloubyansky commented 2 years ago

No @JiriOndrusek I was testing the idea I described in my comment above and it worked against my local branch from the command line. But it wouldn't work from an IDE, because IDEs, usually, don't follow Maven lifecycle configs when launching tests.

JiriOndrusek commented 2 years ago

@aloubyansky thanks for explanation.