I'd like to take advantage of some JDK7 features. What issues might I run into given that I use Apache Tomcat 7.0.x (latest) and Spring 3.1 (latest)?
-
1Did you try to update and see? :) – PhD Oct 15 '11 at 00:46
-
2Not yet, I wanted to prepare and find out if there are any big issues which might be hard to spot. – at. Oct 15 '11 at 01:48
-
Nothing helpful to add on the topic, however one suggestion which has saved me lots of time in similar situations - try this in a VM. It'll be easy to go back to "where you came from" and you can try different tweaks along the way. – Will Chesterfield Oct 15 '11 at 02:33
3 Answers
There were a few compilation gotchas where JDK 6 could infer the generic type properly where JDK 7 could not. This was apparently a bug in JDK 6 as referenced here.
If you are using container-specific resources (e.g., data sources, etc.) be sure to verify these are still operating properly (though this will be immediately obvious on Spring startup if any of these are wired in).
If you are using Spring Security, and you upgrade, you do not need to make any changes per se to get get things running. However, you should take advantage of their less verbose configuration options (especially for REST URL's) that are available in Spring Security 3.1.
Other than that, our upgrade was seamless.
With the last Ubuntu update (11.10) I switched to JDK 7 (OpenJDK 1.7.0_147). I'm using Spring 3.0, Tomcat 6, and JRE 6 on the server (we have both VM and "physical" server installations). The code, compiled with JDK 7 runs on this configuration without any problems. I'm sure, switching to Spring 3.1 won't cause any changes. Not so sure about Tomcat 7, but hopefully this information will be useful to you.

- 8,064
- 6
- 45
- 62
You might run into a problem if you're using Java 7 features in a JSP. Tomcat by default user Java 1.6 for JSP compilation. See http://tomcat.apache.org/tomcat-7.0-doc/jasper-howto.html#Production%20Configuration
To solve the problem you'll want to override the compilerSourceVM
and compilerSourceVM
init parameters in your application's web.xml file. More on that here: https://stackoverflow.com/a/20194823/1029261