On 04/02/2013 14:39, 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

Yes. And you can add Java 1.5 from <vendor of your choice> to that list
for Tomcat 6.

> and, there may (or may not) be problems compiling a servlet that uses
> JDBC under a Sun/Oracle Java 1.7 JDK,

If you use JDBC and compile with a 1.7 JDK, you must write your code to
the JDBC 4.1 interfaces. This is mainly an issue for JDBC driver /
connection pool implementers and is unlikely to impact web application
developers.

> 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
Yes.

> - 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
Yes, providing that "javac -target 1.6 ..." is used and no APIs
introduced in Java 1.7 are used.

> - 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
Yes.

> - 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
Yes.

> 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)
The rule of thumb is that:
a) you must run Tomcat on a Java version greater or equal to the target
Java version the application was compiled for.
b) you must run Tomcat on at least the minimum Java version required by
that Tomcat version

For all of the above, I have assumed only the public APIs have been
used. If an app starts using JRE internals directly (e.g. classes in the
sun.* package) all bets are off.

Also, s/will/should/ since a JRE bug could break the expected compatibility.


> 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.

It gets worse. You often find commercial applications that only run on
specific versions of the JRE and specific application server versions.
For example, it was only relatively recently that Jira was supported on
Java 7 and Tomcat 7. It wasn't just a case of being unsupported, stuff
broke if you ran it on Java 7 and/or Tomcat 7 rather than Java 6 /
Tomcat 6. That just shouldn't happen.

Personally, I'd aim for Tomcat 7 and Java 7 everywhere and require a
very good justification of why not for any exception cases.

Mark

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

Reply via email to