Ihor M.
Ihor M.

Reputation: 3148

Tomcat6 and JRE7 compatibility issue. Unsupported major.minor version 51.0

I have a web app compiled with JRE7 and now i'd like to run it on Tomcat6. When I launch my app I see exception in the logs:

Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) 

This exception comes from the class that implements ServletContextListener.

Does that mean I have to use Tomcat7 for code compiled with JRE7? Is there a workaround? Any information will be valuable.

Upvotes: 1

Views: 3147

Answers (2)

Carlo Ledesma
Carlo Ledesma

Reputation: 446

You can find out the server information through its status page:

{running-tomcat-url}/manager/status

On that page you can see the version of Java on which your Tomcat runs

Upvotes: 0

zacheusz
zacheusz

Reputation: 8842

You're attempting to run Java 7 bytecode with a Java 6. You need to deploy it to Tomcat 7 or recompile using JDK 1.6. Check what JRE your Tomcat uses. I guess it's Java 6 JVM.

Upvotes: 5

Related Questions