1

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.

Ihor M.
  • 2,728
  • 3
  • 44
  • 70

2 Answers2

5

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.

zacheusz
  • 8,750
  • 3
  • 36
  • 60
  • 2
    You are completely right, my catalina.sh file in JAVA_HOME had reference to 1.6 JDK. Thanks fo help! – Ihor M. Jul 04 '13 at 23:03
0

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

Carlo Ledesma
  • 406
  • 1
  • 3
  • 7