Marcus Junius Brutus
Marcus Junius Brutus

Reputation: 27286

Tomcat 7 with Java 7 JRE_HOME not handling Java 7 beans

I've set-up my Tomcat 7 on Ubuntu 12 with a Java 7 JRE_HOME:

$ /usr/share/tomcat7/bin/version.sh 
Using CATALINA_BASE:   /usr/share/tomcat7
Using CATALINA_HOME:   /usr/share/tomcat7
Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
Using JRE_HOME:        /usr/lib/jvm/java-7-openjdk-i386
Using CLASSPATH:       /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
Server version: Apache Tomcat/7.0.26
Server built:   Apr 11 2012 12:24:08
Server number:  7.0.26.0
OS Name:        Linux
OS Version:     3.2.0-24-generic-pae
Architecture:   i386
JVM Version:    1.7.0_03-b147
JVM Vendor:     Oracle Corporation

But when deploying a simple JSF application compiled to 1.7 Tomcat complains with

SEVERE: Critical error during deployment: 
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! java.util.concurrent.ExecutionException: java.lang.UnsupportedClassVersionError: com/corejsf/UserBean : Unsupported major.minor version 51.0 (unable to load class com.corejsf.UserBean)

When I change my Ant build.xml to compile to "1.6" the application deploys fine. Is this incompatibility with Java 7 to be expected? There is a 6-months-old related question on Tomcat 7 / Java 7 compatibility but the answers there seem to suggest that Java 7 is supported.

Upvotes: 2

Views: 2601

Answers (1)

MeIr
MeIr

Reputation: 7316

I encountered exactly the same issue. Here are my steps:

Edit file:

/etc/default/tomcat7

Replace JAVA_HOME

From

JAVA_HOME=/usr/lib/jvm/openjdk-6-jdk

to

JAVA_HOME=/usr/lib/jvm/jdk1.7.0_09

Restart Tomcat.

Upvotes: 1

Related Questions