It's not that Tomcat doesn't *run* fine with Java 7 even if you're making use of JDBC.

And it's not that you can't have code that calls JDBC APIs that works fine with Java 6 and Java 7.

It's that you can't make Java source code which /implements /JDBC interfaces and make it compilable with both Java 6 and Java 7. The JDBC interfaces have new methods in Java 7 *and* some of these new methods use classes new to Java 7.

One approach to work around this is to use dynamic proxies, but this can be obnoxious. Otherwise you're stuck with code that will compile only with Java 6 or Java 7 -- take your pick.

This isn't a Tomcat issue -- it applies to anything which ends up needing to implement a JDBC interface.

Standard, built-in Java classes to wrap Connection, PreparedStatement, etc, would go a long way towards resolving this -- as one could simply extend the wrapper class and override the necessary methods. This is a lot easier to read than InvocationHandler code required by the dynamic proxy approach. I'd bet that most who end up doing any substantive work in this area end up creating their own reusable pass-through wrapper classes for easy extension.

--
Jess Holle

On 2/4/2013 8:39 AM, André Warnier wrote:
Mark Thomas wrote:
On 04/02/2013 13:41, Caldarale, Charles R wrote:
From: Mark Thomas [mailto:ma...@apache.org] Subject: Re: Tomcat and
Sun/Oracle Java 7
What is the status of Tomcat vs Sun/oracle Java 7 ? I vaguely
remember seeing some messages on this list about some kind of incompatibility.
There are no known issues.
Although there are no issues with running Tomcat under Java 7, I was
under the impression that Tomcat 7 and below could not be built with
Java 7 due to JRE interface incompatibilities.

Correct. JDBC. Again.


Ok, then sorry about my persistent deep lack of knowledge of Java-things, but are the following assumptions correct ? (and if not, why ?)

- tomcat 6 will run fine under a Sun/Oracle Java 1.6 JVM
- tomcat 7 will run fine under a Sun/Oracle Java 1.6 JVM
- tomcat 6 will run fine under a Sun/Oracle Java 1.7 JVM
- tomcat 7 will run fine under a Sun/Oracle Java 1.7 JVM
- tomcat 6 will run fine under an OpenJDK Java 1.7 JVM
- tomcat 7 will run fine under an OpenJDK Java 1.7 JVM

and, there may (or may not) be problems compiling a servlet that uses JDBC under a Sun/Oracle Java 1.7 JDK, but assuming that this servlet does not use JDBC in any way :

- the classes of a servlet that has been compiled under a Sun/Oracle Java 1.6 JDK will run fine under Tomcat 6 and a Sun/Oracle Java 1.7 JVM - the classes of a servlet that has been compiled under a Sun/Oracle Java 1.7 JDK will run fine under Tomcat 6 and a Sun/Oracle Java 1.6 JVM - the classes of a servlet that has been compiled under a Sun/Oracle Java 1.6 JDK will run fine under Tomcat 6 and a OpenJDK Java 1.6 JVM - the classes of a servlet that has been compiled under a Sun/Oracle Java 1.6 JDK will run fine under Tomcat 6 and a OpenJDK Java 1.7 JVM

or alternatively, is it so that to run a servlet compiled under some JDK only works under the corresponding JRE/JVM ? (or any other simpler rule-of-thumb rather than my exhaustive kind of list above)

I apologise if these are more Java-level questions than Tomcat-level questions, but as a sysadmin I have to decide which JVM to install, to run Tomcat along with webapps which I receive pre-compiled, and other non-Tomcat Java applications also precompiled. And I have to decide this for several Linux and Windows platforms, whereas I am told that for some of these platforms at least, the pre-packaged versions of Java and/or Tomcat are not always the most recent ones. Hence my confusion.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

.


Reply via email to