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

Jdbc-derby: missing resource in native mode #22058

Closed
JiriOndrusek opened this issue Dec 9, 2021 · 9 comments · Fixed by #22059
Closed

Jdbc-derby: missing resource in native mode #22058

JiriOndrusek opened this issue Dec 9, 2021 · 9 comments · Fixed by #22059
Labels
area/persistence kind/bug Something isn't working
Milestone

Comments

@JiriOndrusek
Copy link
Contributor

Describe the bug

I'm fixing camel-quarkus integration test of sql extension. If I use external derby database (using docker) for the test, I got an exception in native mode:

Caused by: [java.util.MissingResourceException - Can't find bundle for base name org.apache.derby.loc.clientmessages, locale en_US]: java.util.MissingResourceException: Can't find bundle for base name org.apache.derby.loc.clientmessages, locale en_US
	at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:2055)
	at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1689)
	at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1593)
	at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1556)
	at java.util.ResourceBundle.getBundle(ResourceBundle.java:932)
	at org.apache.derby.shared.common.i18n.MessageUtil.getCompleteMessage(Unknown Source)
	at org.apache.derby.shared.common.i18n.MessageUtil.getCompleteMessage(Unknown Source)
	at org.apache.derby.shared.common.i18n.MessageUtil.getCompleteMessage(Unknown Source)
	at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
	at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
	at org.apache.derby.client.am.DisconnectException.<init>(Unknown Source)
	at org.apache.derby.client.am.DisconnectException.<init>(Unknown Source)
	at org.apache.derby.client.am.DisconnectException.<init>(Unknown Source)
	at org.apache.derby.client.net.Reply.fill(Unknown Source)
	at org.apache.derby.client.net.Reply.ensureALayerDataInBuffer(Unknown Source)
	at org.apache.derby.client.net.Reply.readDssHeader(Unknown Source)
	at org.apache.derby.client.net.Reply.startSameIdChainParse(Unknown Source)
	at org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(Unknown Source)
	at org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(Unknown Source)
	at org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(Unknown Source)
	at org.apache.derby.client.am.ClientStatement.readPrepareDescribeOutput(Unknown Source)
	at org.apache.derby.client.am.ClientPreparedStatement.readPrepareDescribeInputOutput(Unknown Source)
	at org.apache.derby.client.am.ClientPreparedStatement.flowPrepareDescribeInputOutput(Unknown Source)
	at org.apache.derby.client.am.ClientPreparedStatement.prepare(Unknown Source)
	at org.apache.derby.client.am.ClientConnection.prepareStatementX(Unknown Source)
	at org.apache.derby.client.am.ClientConnection.prepareStatement(Unknown Source)
	at io.agroal.pool.wrapper.ConnectionWrapper.prepareStatement(ConnectionWrapper.java:659)
	at org.springframework.jdbc.core.JdbcTemplate$SimplePreparedStatementCreator.createPreparedStatement(JdbcTemplate.java:1645)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:649)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:691)
	at org.apache.camel.component.sql.SqlConsumer.poll(SqlConsumer.java:202)
	at org.apache.camel.support.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:197)
	at org.apache.camel.support.ScheduledPollConsumer.run(ScheduledPollConsumer.java:111)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.lang.Thread.run(Thread.java:829)
	at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:596)
	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)

Problems seems to be similar as #21639

Expected behavior

Jdbc derby should work i native mode without an error.

Actual behavior

No response

How to Reproduce?

As a reproducer, please use integration-tests/sql from my branch: https://github.com/JiriOndrusek/camel-quarkus/tree/3260-sql-derby-quarkus-master-reproducer

  1. Branch is compatible with quarkus/main (verified on revision 32773ed)
  2. To force usage of external (docker) derby database, export following properties:
export SQL_USE_DERBY_DOCKER=true
export SQL_USE_DERBY_PORT="#port"

(property SQL_USE_DERBY_PORT just tells docker which port to use, so use for example 1527 - but it could be any random free port number)
3. Run test with a property for derby mvn clean verify -Pnative -f integration-tests/sql -Dcq.sqlJdbcKind=derby

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

No response

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

No response

Additional information

Current failure was simulated on quarkus built from main branch (revision 32773ed)
The same exception happens also with quarkus 2.5.0.

@JiriOndrusek JiriOndrusek added the kind/bug Something isn't working label Dec 9, 2021
@JiriOndrusek
Copy link
Contributor Author

I forgot to mention that problem is not happening with dev services.
(to run the same scenario with dev services - do not export any of the properties from step 2)

@geoand
Copy link
Contributor

geoand commented Dec 9, 2021

Could you give #22059 a try please?

@quarkus-bot
Copy link

quarkus-bot bot commented Dec 9, 2021

@JiriOndrusek
Copy link
Contributor Author

I'll try it.

geoand added a commit to geoand/quarkus that referenced this issue Dec 9, 2021
@Sanne
Copy link
Member

Sanne commented Dec 9, 2021

To be clear, I don't think we expect Derby to work in native; I see you only need the client here, so that might be doable but this wasn't expected to work, nor tested.

@geoand
Copy link
Contributor

geoand commented Dec 9, 2021

Right, but I do see we some reflection registration already in there, so if the fix is as simple as #22059, then I see no reason not to add it :)

@Sanne
Copy link
Member

Sanne commented Dec 9, 2021

Sure ok I have no problem with someone wanting to fix it :)
Just setting expectations, it might need quite some more work... and it's untested. It could be trivial, but we don't know yet.

@geoand
Copy link
Contributor

geoand commented Dec 9, 2021

👍🏼

@JiriOndrusek
Copy link
Contributor Author

JiriOndrusek commented Dec 9, 2021

@geoand I tried your fix and it fixes the problem with missing resources.
But test keeps failing in native because of

2021-12-09 13:46:04,729 ERROR [org.apa.cam.qua.mai.CamelMainRuntime] (main) Failed to start application: org.apache.camel.RuntimeCamelException: java.sql.SQLNonTransientConnectionException: A communications error has been detected: Connection reset.
	at org.apache.camel.support.service.BaseService.doFail(BaseService.java:413)
	at org.apache.camel.support.service.BaseService.fail(BaseService.java:342)
	at org.apache.camel.support.service.BaseService.init(BaseService.java:88)
	at org.apache.camel.quarkus.main.CamelMain.startEngine(CamelMain.java:137)
	at org.apache.camel.quarkus.main.CamelMainRuntime.start(CamelMainRuntime.java:49)
	at org.apache.camel.quarkus.core.CamelBootstrapRecorder.start(CamelBootstrapRecorder.java:45)
	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot173480958.deploy_0(Unknown Source)
	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot173480958.deploy(Unknown Source)
	at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
	at io.quarkus.runtime.Application.start(Application.java:101)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:104)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:67)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:41)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:120)
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
Caused by: java.sql.SQLNonTransientConnectionException: A communications error has been detected: Connection reset.
	at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source)
	at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
	at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
	at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:204)
	at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:509)
	at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:490)
	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1126)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.lang.Thread.run(Thread.java:829)
	at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:596)
	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
Caused by: ERROR 08006: A communications error has been detected: Connection reset.
	at org.apache.derby.client.net.NetAgent.throwCommunicationsFailure(Unknown Source)
	at org.apache.derby.client.net.Reply.fill(Unknown Source)
	at org.apache.derby.client.net.Reply.ensureALayerDataInBuffer(Unknown Source)
	at org.apache.derby.client.net.Reply.readDssHeader(Unknown Source)
	at org.apache.derby.client.net.Reply.startSameIdChainParse(Unknown Source)
	at org.apache.derby.client.net.NetConnectionReply.readExchangeServerAttributes(Unknown Source)
	at org.apache.derby.client.net.NetConnection.readServerAttributesAndKeyExchange(Unknown Source)
	at org.apache.derby.client.net.NetConnection.flowServerAttributesAndKeyExchange(Unknown Source)
	at org.apache.derby.client.net.NetConnection.flowUSRIDONLconnect(Unknown Source)
	at org.apache.derby.client.net.NetConnection.flowConnect(Unknown Source)
	at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
	at org.apache.derby.client.net.ClientJDBCObjectFactoryImpl.newNetConnection(Unknown Source)
	... 11 more
Caused by: java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(SocketInputStream.java:186)
	at java.net.SocketInputStream.read(SocketInputStream.java:140)
	... 22 more

2021-12-09 13:46:04,738 ERROR [io.qua.run.Application] (main) Failed to start application (with profile prod): java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(SocketInputStream.java:186)
	at java.net.SocketInputStream.read(SocketInputStream.java:140)
	at org.apache.derby.client.net.Reply.fill(Unknown Source)
	at org.apache.derby.client.net.Reply.ensureALayerDataInBuffer(Unknown Source)
	at org.apache.derby.client.net.Reply.readDssHeader(Unknown Source)
	at org.apache.derby.client.net.Reply.startSameIdChainParse(Unknown Source)
	at org.apache.derby.client.net.NetConnectionReply.readExchangeServerAttributes(Unknown Source)
	at org.apache.derby.client.net.NetConnection.readServerAttributesAndKeyExchange(Unknown Source)
	at org.apache.derby.client.net.NetConnection.flowServerAttributesAndKeyExchange(Unknown Source)
	at org.apache.derby.client.net.NetConnection.flowUSRIDONLconnect(Unknown Source)
	at org.apache.derby.client.net.NetConnection.flowConnect(Unknown Source)
	at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
	at org.apache.derby.client.net.ClientJDBCObjectFactoryImpl.newNetConnection(Unknown Source)
	at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
	at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:204)
	at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:509)
	at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:490)
	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1126)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.lang.Thread.run(Thread.java:829)
	at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:596)
	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)

[ERROR] Tests run: 9, Failures: 0, Errors: 1, Skipped: 8, Time elapsed: 3.707 s <<< FAILURE! - in org.apache.camel.quarkus.component.sql.it.SqlIT
[ERROR] testSqlComponent  Time elapsed: 0.009 s  <<< ERROR!
java.lang.RuntimeException: Unable to successfully launch process '26395'. Exit code is: '1'.
	at io.quarkus.test.common.LauncherUtil.ensureProcessIsAlive(LauncherUtil.java:98)
	at io.quarkus.test.common.LauncherUtil.waitForCapturedListeningData(LauncherUtil.java:67)
	at io.quarkus.test.common.DefaultNativeImageLauncher.start(DefaultNativeImageLauncher.java:107)
	at io.quarkus.test.junit.IntegrationTestUtil.startLauncher(IntegrationTestUtil.java:181)
	at io.quarkus.test.junit.NativeTestExtension.doNativeStart(NativeTestExtension.java:161)
	at io.quarkus.test.junit.NativeTestExtension.ensureStarted(NativeTestExtension.java:102)
	at io.quarkus.test.junit.NativeTestExtension.beforeAll(NativeTestExtension.java:75)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$10(ClassBasedTestDescriptor.java:381)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:381)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:205)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:80)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:148)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:150)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:124)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)

I'll investigate it more to find from what is causing the problem It could be quarkus or the test itself.

gsmet added a commit that referenced this issue Dec 9, 2021
Register derby resource bundler in native mode
@quarkus-bot quarkus-bot bot added this to the 2.7 - main milestone Dec 9, 2021
@gsmet gsmet modified the milestones: 2.7 - main, 2.5.2.Final Dec 9, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Dec 9, 2021
Postremus pushed a commit to Postremus/quarkus that referenced this issue Dec 10, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/persistence kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants