aspose file tools*
The moose likes Tomcat and the fly likes Check the servlet and jsp api version that a container supports? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Check the servlet and jsp api version that a container supports?" Watch "Check the servlet and jsp api version that a container supports?" New topic
Author

Check the servlet and jsp api version that a container supports?

Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370

Hi,

Sorry of it sounds too trivial a question. I maintain a JEE web application running in Tomcat 6.0.29 container. My security team asked me to see if it would be a quick work to upgrade to Tomcat 7 without touching my webappp (or with minimal touching if I have to).

So I thought let's check what JRE version, Servlet spec and JSP spec Tomcat 7 supports in this link - http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html

* First looking into it, I think JRE 5 would be good enough. We are running 5.0.15 version.
* Is the Servlet API version it supports 3.0? Is it the minimal? What if my webapps is written in servlet 2.4?
* Is the JSP API version it supports 2.1? Is it the minimal? What if my webapps is written in JSP 2.0?

And now I wanted to check what my webapp is written in. For that I opened the web.xml file of my app and see the root element has a version attribute that says 2.5. This makes me think our application supports Servlet spec 2.5. Please correct me if I am wrong.

I am not sure how I can check the JSP version. Can you please help me with that?

* Are these version supports forward compatible (a 3.0 servlet container will support servlets written in 2.5 as well or a JSP page written in 2.0 will be working fine in a 2.1 JSP container)?
* Are these version backward compatible otherwise?
* Do I need to update my JRE also for Tomcat 7?

Any guidelines will be appreciated. Thanks in advance.




Ashik Uzzaman
Senior Member of Technical Staff, Salesforce.com, San Francisco, CA, USA.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16058
    
  21

Unlike a certain rather large company located in the upper-left corner of the USA, Sun made a point of always supporting backwards compatibility, even when it hurts. Among other things, Java supports a built-in deprecation facility so that you can mark code for later upgrading without making it stop working at 3 am when you need to do an emergency 1-line fix.

In actual fact, even deprecated stuff is rarely removed from the language, and then only years after everyone should have stopped using the deprecated feature. For example, the "broken" Date constructor is still supported (last time I looked, anyway!) even though it has been deprecated for a decade or more.

And what applies to the language also pretty much applies to the frameworks. So test, but figure most stuff is going to keep working just like always. You certainly don't have to upgrade J2EE apps just to run in a JEE container. Unless you want to.

As to language level requirements, check the Tomcat docs for what Tomcat 7 needs.


Customer surveys are for companies who didn't pay proper attention to begin with.
Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370

Thank you Tim. So looks like I am good. I will test in a Tomcat 7 container anyway to make sure the app is functional once deployed.

As I have figured out the servlet version that my app is using, I am confused if there is an easy way to find out the JSP version my app is using. Any idea how I can find it?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41829
    
  63
This may help: http://www.coderanch.com/how-to/java/WhichVersionAmIRunningOn


Ping & DNS - my free Android networking tools app
Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370

Thank you so much for the responses. It helps a lot!

Also from this http://tomcat.apache.org/whichversion.html it looks like Tomcat 7 needs at least Java 6. So my code written in Java 5 may or may not work. I will test quickly by deploying it in a Java 6 JRE with my existing Tomcat 6 to confirm I don't have too deprecated methods that won't be backward compatible in Java 6.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41829
    
  63
Ashik Uzzaman wrote:Also from this http://tomcat.apache.org/whichversion.html it looks like Tomcat 7 needs at least Java 6. So my code written in Java 5 may or may not work. I will test quickly by deploying it in a Java 6 JRE with my existing Tomcat 6 to confirm I don't have too deprecated methods that won't be backward compatible in Java 6.

I think you misunderstand what Java's backward compatibility means. Code written for Java version X will almost always work on version X+1, x+2 etc. The other way around is the problem (code written for version X+1 won't generally work on version X).

Also note that -so far- newer versions of Java have never removed methods or classes that were deprecated.
Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370

Oh that's wonderful! So, if all the deprecated methods are still supported from the birth of Java, I don't have any reason to be worried. Yes, with JRE6, my application still works. I am good then. Thank you all!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Check the servlet and jsp api version that a container supports?