| Author |
tomcat 7 encounters LifecycleException caused by java.lang.UnsupportedClassVersionError
|
Joseph Idol
Greenhorn
Joined: Nov 07, 2011
Posts: 1
|
|
i'm using apache tomcat 7 with jdk 1.7. i have so far been unsuccessful with running even one servlet.
i created my web application hierarchy as:
or
web application hierarchy
the java code is:
and the web.xml code is:
but i always get a 404 error message every time i run: http://localhost:8080/hello/sayhello
i then checked the stderr log and found that
Nov 7, 2011 4:11:42 PM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/hello]]
.
.
.
Caused by: java.lang.UnsupportedClassVersionError: com/training/HelloServlet : Unsupported major.minor version 51.0 (unable to load class com.training.HelloServlet)
any thoughts as to how i may resolve this so that i can run my java servlets?
|
 |
Hebert Coelho
Ranch Hand
Joined: Jul 14, 2010
Posts: 754
|
|
|
Try to access it by: http://localhost:8080/myWebApp/sayhello
|
[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56192
|
|
|
That's almost always a sign that you compiled the class with a deferent version of Java than Tomcat is using.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Joseph Idol wrote:i'm using apache tomcat 7 with jdk 1.7. i have so far been unsuccessful with running even one servlet.
That error indicates that the class has been compiled by a Java 7 compiler* but you're using an earlier JRE version. Make sure that Tomcat is really using your Java 7 installation, and not some other version.
* See here.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Norbert Waage
Greenhorn
Joined: Jun 08, 2012
Posts: 3
|
|
Bear Bibeault wrote:That's almost always a sign that you compiled the class with a deferent version of Java than Tomcat is using.
THANK YOU!
I was blowing my head out here...
|
 |
 |
|
|
subject: tomcat 7 encounters LifecycleException caused by java.lang.UnsupportedClassVersionError
|
|
|