How can I solve Modularity related issue ?
Hello. One of JDBC application with JavaDB did not work on JDK12. Following exception happened: java.sql.SQLException: No suitable driver found for jdbc:derby:xxxxxx I assume, this issue related Modularity feature... I could not solve this issue by myself. In order to investigate the root cause, I would appreciate telling me how to identify the problem and debug it. Thanks, Ichiroh Takiguchi IBM Japan, Ltd. =========================== The detail instruction is as follows: It has two types of SELECT statement call. 1. Use DriverManager 2. Use createJdbcRowSet() "1" worked fine, "2" did not work on JDK11. Same one worked fine on JDK8. System / OS: RHEL 7.5 x86_64 Steps to Reproduce 1. Store JavaDB (derby.jar) in derby/lib/derby.jar You can download Apache Derby (derby.jar) [1] or use JDK8's one 2. Download testcases [2][3][4], then compile and run following command $ javac SetupJavaDB.java JdbcRowSetProvider.java JdbcRowSetProviderA.java 3. Create DB $ java -cp derby/lib/derby.jar:. SetupJavaDB 4. Run testcases ### Use DriverManager and createJdbcRowSet() ### $ java -cp derby/lib/derby.jar:. JdbcRowSetProvider ### Use createJdbcRowSet() ### $ java -cp derby/lib/derby.jar:. JdbcRowSetProviderA On JDK8 $ ~/jdk8_181/jdk1.8.0_181/jre/bin/java -showversion -cp derby/lib/derby.jar:. JdbcRowSetProvider java version "1.8.0_181" Java(TM) SE Runtime Environment (build 1.8.0_181-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode) 1,One 2,Two 3,Three 1,One 2,Two 3,Three $ ~/jdk8_181/jdk1.8.0_181/jre/bin/java -showversion -cp derby/lib/derby.jar:. JdbcRowSetProviderA java version "1.8.0_181" Java(TM) SE Runtime Environment (build 1.8.0_181-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode) 1,One 2,Two 3,Three On JDK12 $ ~/jdk-12+12/bin/java -showversion -cp derby/lib/derby.jar:. JdbcRowSetProvider openjdk version "12-ea" 2019-03-19 OpenJDK Runtime Environment 19.3 (build 12-ea+12) OpenJDK 64-Bit Server VM 19.3 (build 12-ea+12, mixed mode) 1,One 2,Two 3,Three Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:derby:javadb/db at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228) at java.sql.rowset/com.sun.rowset.JdbcRowSetImpl.connect(JdbcRowSetImpl.java:643) at java.sql.rowset/com.sun.rowset.JdbcRowSetImpl.prepare(JdbcRowSetImpl.java:654) at java.sql.rowset/com.sun.rowset.JdbcRowSetImpl.execute(JdbcRowSetImpl.java:556) at JdbcRowSetProvider.main(JdbcRowSetProvider.java:30) $ ~/jdk-12+12/bin/java -showversion -cp derby/lib/derby.jar:. JdbcRowSetProviderA openjdk version "12-ea" 2019-03-19 OpenJDK Runtime Environment 19.3 (build 12-ea+12) OpenJDK 64-Bit Server VM 19.3 (build 12-ea+12, mixed mode) Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:derby:javadb/db at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228) at java.sql.rowset/com.sun.rowset.JdbcRowSetImpl.connect(JdbcRowSetImpl.java:643) at java.sql.rowset/com.sun.rowset.JdbcRowSetImpl.prepare(JdbcRowSetImpl.java:654) at java.sql.rowset/com.sun.rowset.JdbcRowSetImpl.execute(JdbcRowSetImpl.java:556) at JdbcRowSetProviderA.main(JdbcRowSetProviderA.java:18) =========================== [1] https://db.apache.org/derby/derby_downloads.html [2] https://cr.openjdk.java.net/~itakiguchi/jdk12-jdbc/SetupJavaDB.java [3] https://cr.openjdk.java.net/~itakiguchi/jdk12-jdbc/JdbcRowSetProvider.java [4] https://cr.openjdk.java.net/~itakiguchi/jdk12-jdbc/JdbcRowSetProviderA.java
On 28/09/2018 08:28, Ichiroh Takiguchi wrote:
Hello.
One of JDBC application with JavaDB did not work on JDK12. Following exception happened: java.sql.SQLException: No suitable driver found for jdbc:derby:xxxxxx
I assume, this issue related Modularity feature... I could not solve this issue by myself. I suspect this is related to the de-privileging of the java.sql.rowset module in JDK 9. The java.sql.rowset module is mapped to the platform class loader whereas historically the types in this module were defined by the boot class loader. This is relevant because java.sql.rowset is making use of the java.sql.DriverManager (in the java.sql module) and DriverManager is caller sensitive so it sees the caller coming from java.sql.rowset. This is problematic because the JDBC driver is on the class path and is not visible to the caller's class loader. The visibility check has always been in JDBC and I suspect this usage in the JDBC Rowset implementation only worked by accident in the past because DriverManager used the TCCL when called from code defined to the bootstrap class loader. I'm sure Lance will jump in but all previous investigations into changing behavior going back 20+ has come to nothing due to compatibility concerns.
-Alan.
On 9/28/18 1:59 AM, Alan Bateman wrote:
On 28/09/2018 08:28, Ichiroh Takiguchi wrote:
Hello.
One of JDBC application with JavaDB did not work on JDK12. Following exception happened: java.sql.SQLException: No suitable driver found for jdbc:derby:xxxxxx
I assume, this issue related Modularity feature... I could not solve this issue by myself. I suspect this is related to the de-privileging of the java.sql.rowset module in JDK 9. The java.sql.rowset module is mapped to the platform class loader whereas historically the types in this module were defined by the boot class loader. This is relevant because java.sql.rowset is making use of the java.sql.DriverManager (in the java.sql module) and DriverManager is caller sensitive so it sees the caller coming from java.sql.rowset. This is problematic because the JDBC driver is on the class path and is not visible to the caller's class loader. The visibility check has always been in JDBC and I suspect this usage in the JDBC Rowset implementation only worked by accident in the past because DriverManager used the TCCL when called from code defined to the bootstrap class loader. I'm sure Lance will jump in but all previous investigations into changing behavior going back 20+ has come to nothing due to compatibility concerns.
It does look like related to the de-privileging of java.sql.rowset module. JDBC rowset implementation just happened to work in the past as it was defined to the bootstrap class loader. I have created JBS issue for this: https://bugs.openjdk.java.net/browse/JDK-8211295 Mandy
Hello Alan and Mandy. I appreciate your explanation and action. Also I read Lance's mail. http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-September/055780.h... I verified Lance's patch, it worked... Many thanks, Ichiroh Takiguchi IBM Japan, Ltd. On 2018-09-29 09:35, Mandy Chung wrote:
On 9/28/18 1:59 AM, Alan Bateman wrote:
On 28/09/2018 08:28, Ichiroh Takiguchi wrote:
Hello.
One of JDBC application with JavaDB did not work on JDK12. Following exception happened: java.sql.SQLException: No suitable driver found for jdbc:derby:xxxxxx
I assume, this issue related Modularity feature... I could not solve this issue by myself. I suspect this is related to the de-privileging of the java.sql.rowset module in JDK 9. The java.sql.rowset module is mapped to the platform class loader whereas historically the types in this module were defined by the boot class loader. This is relevant because java.sql.rowset is making use of the java.sql.DriverManager (in the java.sql module) and DriverManager is caller sensitive so it sees the caller coming from java.sql.rowset. This is problematic because the JDBC driver is on the class path and is not visible to the caller's class loader. The visibility check has always been in JDBC and I suspect this usage in the JDBC Rowset implementation only worked by accident in the past because DriverManager used the TCCL when called from code defined to the bootstrap class loader. I'm sure Lance will jump in but all previous investigations into changing behavior going back 20+ has come to nothing due to compatibility concerns.
It does look like related to the de-privileging of java.sql.rowset module. JDBC rowset implementation just happened to work in the past as it was defined to the bootstrap class loader.
I have created JBS issue for this: https://bugs.openjdk.java.net/browse/JDK-8211295
Mandy
I will be pushing the fix back later today Best Lance
On Oct 1, 2018, at 3:56 AM, Ichiroh Takiguchi <takiguc@linux.vnet.ibm.com> wrote:
Hello Alan and Mandy.
I appreciate your explanation and action.
Also I read Lance's mail. http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-September/055780.h...
I verified Lance's patch, it worked...
Many thanks, Ichiroh Takiguchi IBM Japan, Ltd.
On 2018-09-29 09:35, Mandy Chung wrote:
On 9/28/18 1:59 AM, Alan Bateman wrote:
On 28/09/2018 08:28, Ichiroh Takiguchi wrote:
Hello. One of JDBC application with JavaDB did not work on JDK12. Following exception happened: java.sql.SQLException: No suitable driver found for jdbc:derby:xxxxxx I assume, this issue related Modularity feature... I could not solve this issue by myself. I suspect this is related to the de-privileging of the java.sql.rowset module in JDK 9. The java.sql.rowset module is mapped to the platform class loader whereas historically the types in this module were defined by the boot class loader. This is relevant because java.sql.rowset is making use of the java.sql.DriverManager (in the java.sql module) and DriverManager is caller sensitive so it sees the caller coming from java.sql.rowset. This is problematic because the JDBC driver is on the class path and is not visible to the caller's class loader. The visibility check has always been in JDBC and I suspect this usage in the JDBC Rowset implementation only worked by accident in the past because DriverManager used the TCCL when called from code defined to the bootstrap class loader. I'm sure Lance will jump in but all previous investigations into changing behavior going back 20+ has come to nothing due to compatibility concerns. It does look like related to the de-privileging of java.sql.rowset module. JDBC rowset implementation just happened to work in the past as it was defined to the bootstrap class loader. I have created JBS issue for this: https://bugs.openjdk.java.net/browse/JDK-8211295 Mandy
<http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen@oracle.com <mailto:Lance.Andersen@oracle.com>
participants (4)
-
Alan Bateman
-
Ichiroh Takiguchi
-
Lance Andersen
-
Mandy Chung