Bug 54929 - jdbc-pool cannot be used with Java 1.5, "java.lang.NoClassDefFoundError: java/sql/SQLFeatureNotSupportedException"
Summary: jdbc-pool cannot be used with Java 1.5, "java.lang.NoClassDefFoundError: java...
Status: NEEDINFO
Alias: None
Product: Tomcat Modules
Classification: Unclassified
Component: jdbc-pool (show other bugs)
Version: unspecified
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-05 23:31 UTC by Konstantin Kolinko
Modified: 2014-08-07 21:57 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Kolinko 2013-05-05 23:31:28 UTC
As reported via documentation comment,
[1] http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#comment_1210

The documentation [1] says:
"We build the JDBC pool code with 1.6, but it is backwards compatible down to 1.5 for runtime environment"

Current builds of jdbc-pool fail when one tries to use them with Java 1.5 because of "java.lang.NoClassDefFoundError: java/sql/SQLFeatureNotSupportedException"

The java.sql.SQLFeatureNotSupportedException class is @since 1.6.

The broken class is org.apache.tomcat.jdbc.pool.DataSourceProxy that has the following method:

    public Logger getParentLogger() throws SQLFeatureNotSupportedException {
        throw new SQLFeatureNotSupportedException();
    }


This bug was introduced in r1302968 (13 months ago) when fixing bug 52493.


The alternative ways that I see to fix this:

a) Update documentation.
As [1] says, "For unit test, we use 1.6 and higher", so running with JDK 1.5 is essentially untested.

Is there any interest in supporting JDK 1.5? This issue was unreported for more than a year.

b) Use reflection to create an instance of SQLFeatureNotSupportedException class.

c) Standard taglib currently "solved" this in r1453156 by throwing UnsupportedOperationException instead.

That is an easy solution, but I would say that it is wrong, as the API expects a SQLFeatureNotSupportedException here "if the data source does not use <code>java.util.logging<code>."

http://docs.oracle.com/javase/7/docs/api/javax/sql/CommonDataSource.html#getParentLogger%28%29
Comment 1 mohanpakam 2013-05-14 08:18:19 UTC
I am sure updating the document to reflect that tomcat jdbc is only compatible with jdk 1.5 would be much appreciated by user group.

My application is still on jdk1.5 and so I had to fetch the source code of tomcat jdbc 7.0.39 and tweak it to support jdk1.5 based on your suggested alternative (c).

Thanks
Comment 2 Filip Hanik 2014-08-07 21:57:07 UTC
I'm considering closing the development of jdbc-pool on the Tomcat 7 branch. and just continue on Tomcat 8, at which point I do believe Java 6 should be the minimum required.

Is this still an issue? Anyone still using Java 1.5 out there?