question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Helidon OJDBC Connectivity Issue when combined with JBatch

See original GitHub issue

Helidon 3.0 combined with JBatch and OJDBC libraries is resulting in Database connectivity issues. Built a simple repro combining the JBatch and HikariCP examples provided in Helidon 3.0, and pushed it to GitHub at https://github.com/bvkrish83/helidon-jdbc-issue

Same sample works fine when we change versions to Helidon 2.5.1 and corresponding updates to all dependent libraries.

Repro Steps:

  • Update microprofile-config.properties file to point to a valid Oracle database.
  • Build the sample repro code provided in above github repo (or) use the already compiled version checked into build-issue folder\libs directory.
  • Run the executable using java -jar .\build\libs\helidon-examples-jbatch_3.0.0.jar
  • Execute curl command curl -X GET http://localhost:8080/tables
  • Expected Output - Connect to database, and execute the sample SQL and return valid result.
  • Actual Output
2022.07.31 22:15:42 INFO io.helidon.common.LogConfig Thread[main,5,main]: Logging at initialization configured using classpath: /logging.properties
2022.07.31 22:15:43 INFO io.helidon.microprofile.server.ServerCdiExtension Thread[main,5,main]: Registering JAX-RS Application: HelidonMP
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2022.07.31 22:15:44 INFO io.helidon.webserver.NettyWebServer Thread[nioEventLoopGroup-2-1,10,main]: Channel '@default' started: [id: 0x12001e33, L:/[0:0:0:0:0:0:0:0]:8080]
2022.07.31 22:15:44 INFO io.helidon.microprofile.server.ServerCdiExtension Thread[main,5,main]: Server started on http://localhost:8080 (and all other host addresses) in 1954 milliseconds (since JVM startup).
2022.07.31 22:15:44 INFO io.helidon.common.HelidonFeatures Thread[features-thread,5,main]: Helidon MP 3.0.0 features: [CDI, Config, JAX-RS, Server]
2022.07.31 22:15:59 SEVERE io.helidon.webserver.RequestRouting Thread[helidon-server-1,5,server]: Default error handler: Unhandled exception encountered.
java.util.concurrent.ExecutionException: Unhandled 'cause' of this exception encountered.
        at io.helidon.webserver.RequestRouting$RoutedRequest.defaultHandler(RequestRouting.java:398)
        at io.helidon.webserver.RequestRouting$RoutedRequest.nextNoCheck(RequestRouting.java:379)
        at io.helidon.webserver.RequestRouting$RoutedRequest.next(RequestRouting.java:421)
        at io.helidon.webserver.jersey.ResponseWriter.failure(ResponseWriter.java:141)
        at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:438)
        at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:263)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:234)
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:684)
        at io.helidon.webserver.jersey.JerseySupport$JerseyHandler.lambda$doAccept$4(JerseySupport.java:326)
        at io.helidon.common.context.Contexts.runInContext(Contexts.java:117)
        at io.helidon.common.context.ContextAwareExecutorImpl.lambda$wrap$7(ContextAwareExecutorImpl.java:154)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ExceptionInInitializerError
        at oracle.jdbc.driver.T4CPreparedStatement.configureRowData(T4CPreparedStatement.java:603)
        at oracle.jdbc.driver.OracleStatement.initStatement(OracleStatement.java:946)
        at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:888)
        at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:1122)
        at oracle.jdbc.driver.T4CPreparedStatement.<init>(T4CPreparedStatement.java:65)
        at oracle.jdbc.driver.T4CDriverExtension.allocatePreparedStatement(T4CDriverExtension.java:154)
        at oracle.jdbc.driver.PhysicalConnection.prepareStatementInternal(PhysicalConnection.java:2333)
        at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:2253)
        at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:2244)
        at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:2155)
        at com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:327)
        at com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)
        at io.helidon.jbatch.example.TablesResource.get(TablesResource.java:77)
        at io.helidon.jbatch.example.TablesResource$Proxy$_$$_WeldClientProxy.get(Unknown Source)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:134)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:177)
        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:81)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:475)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:397)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81)
        at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:255)
        ... 14 more
Caused by: java.lang.NullPointerException: Cannot read field "m_ucsChar" because "<local1>" is null
        at oracle.jdbc.driver.DynamicByteArray$1.run(DynamicByteArray.java:961)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
        at oracle.jdbc.driver.DynamicByteArray.<clinit>(DynamicByteArray.java:956)
        ... 41 more

Exception in thread "helidon-server-1" java.lang.IllegalStateException: The 'next()' method can be called only once!
        at io.helidon.webserver.RequestRouting$RoutedRequest.checkNexted(RequestRouting.java:339)
        at io.helidon.webserver.RequestRouting$RoutedRequest.checkNexted(RequestRouting.java:334)
        at io.helidon.webserver.RequestRouting$RoutedRequest.next(RequestRouting.java:419)
        at io.helidon.webserver.jersey.JerseySupport$JerseyHandler.lambda$doAccept$4(JerseySupport.java:332)
        at io.helidon.common.context.Contexts.runInContext(Contexts.java:117)
        at io.helidon.common.context.ContextAwareExecutorImpl.lambda$wrap$7(ContextAwareExecutorImpl.java:154)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
2022.07.31 22:16:05 INFO io.helidon.webserver.NettyWebServer Thread[nioEventLoopGroup-2-1,10,main]: Channel '@default' closed: [id: 0x12001e33, L:/[0:0:0:0:0:0:0:0]:8080]
2022.07.31 22:16:05 INFO io.helidon.microprofile.server.ServerCdiExtension Thread[helidon-cdi-shutdown-hook,5,main]: Server stopped in 25 milliseconds.

Environment Details

  • Helidon Version: 3.0.0
  • Helidon MP
  • JDK version: JDK 17.0.4
  • OS: Windows 11
  • Docker version (if applicable): NA

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ljnelsoncommented, Aug 2, 2022

In fairness, we test our examples, and have not triggered this behavior yet. My guess is that you have to do something Unicode-related that for whatever reason our examples do not trigger to see this issue. Nevertheless yes, I think this is a setting we need to document at the very least. With your permission I’ll close this issue as fixed.

0reactions
vamshikrishna83commented, Aug 4, 2022

@ljnelson Great, Thanks for the really detailed analysis in such short period of time. Your help is greatly appreciated. 👍

Yes, this fixed the issue. Once i have added pattern=oracle.sql.converter.* in serial-config.properties, I am able to successfully connect to the OJDBC SQL Database and verify the sanity of application.

It would help users, if database connectivity examples included in Helidon Examples, included this line in serial-config.properties file to guide them that this property is related and required for these example scenarios to work properly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Helidon OJDBC Connectivity Issue when combined with JBatch
Helidon 3.0 combined with JBatch and OJDBC libraries is resulting in Database connectivity issues. Built a simple repro combining the JBatch ...
Read more >
Configuring the Oracle JDBC drivers in a Helidon project
Configuring the Oracle JDBC drivers in Helidon is a straight forward task given Helidon's UCP extension. This post shows how to get it...
Read more >
Index (Helidon Project 2.5.4 API)
The producer will attempt to batch records together into fewer requests whenever multiple records are being sent to the same partition.
Read more >
Oracle JDBC Connection Fails with SSL handshake_failure ...
net.debug=ssl while instantiating the connection. I am not able to figure out what caused the issue, and how to get the same resolved...
Read more >
Helidon and JPA - Medium
Instead, with Helidon MicroProfile, all of those problems are ... You can use this connection pool with any JDBC-compliant database driver.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found