javaoracle11gpayarajava-17

JDBC Connection Pool Payara 5 with JDK 17


I am testing payara 5 with jdk 17. But I have problems with the connection pool.

<jdbc-connection-pool max-pool-size="100" datasource-classname="oracle.jdbc.pool.OracleDataSource" steady-pool-size="1" validation-table-name="dual" name="oracle_thin_emp" is-connection-validation-required="true" res-type="javax.sql.DataSource">
      <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"></property>
      <property name="URL" value="jdbc:oracle:thin:@192.168.50.19:1521:TD"></property>
      <property name="serverName" value="192.168.50.19"></property>
      <property name="User" value="EMP"></property>
      <property name="Password" value="EMP"></property>
      <property name="PortNumber" value="1521"></property>
      <property name="databaseName" value="TD"></property>
    </jdbc-connection-pool>

When I start payara 5 with jdk 8 the connection pool works correctly but when I start the web server with jdk 17 and ping from the admin console I get the following error: Ping Connection Pool failed for oracle_thin_emp. Class name is wrong or classpath is not set for : oracle.jdbc.pool.OracleDataSource Please check the server.log for more details.

Log:

[Payara 5.2022.2] [SEVERE] [] [javax.enterprise.resource.resourceadapter.com.sun.gjc.util] [tid: _ThreadID=163 _ThreadName=admin-thread-pool::admin-listener(4)] [timeMillis: 1657657513953] [levelValue: 1000] [[
  RAR5099 : Wrong class name or classpath for Datasource Object 
java.lang.ClassNotFoundException: oracle.jdbc.pool.OracleDataSource
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
    at com.sun.enterprise.loader.CurrentBeforeParentClassLoader.loadClass(CurrentBeforeParentClassLoader.java:83)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:467)

Details:


Solution

  • Place the driver in one directory above, <payara-home>/glassfish/domains/<domain>/lib.

    The reason seems to be that the extension mechanism (system property java.ext.dirs) has been removed from Java 9. Also, the PayaraServer5.192 Release Notes states that <payara-home>/glassfish/domains/<domain>/lib/ext are no longer placed in the classpath. PayaraServer officially supports Java 11 in addition to Java 8 since 5.192, but it seems to be a corresponding response.