tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Pope <mich...@dtcorp.com.au>
Subject useBeans problem
Date Thu, 06 Oct 2005 04:25:29 GMT
I'm new to JSP and still getting used to the environment. 
I'm using FreeBSD5.4, Jakarta tomcat 5.5.9 with JDK 1.5.0_p2

When I try to use Beans it comes up with the error:

*type* Exception report

*message*

*description* _The server encountered an internal error () that 
prevented it from fulfilling this request._

*exception*

javax.servlet.ServletException: UserData (Unsupported major.minor version 49.0)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

*root cause*

java.lang.UnsupportedClassVersionError: UserData (Unsupported major.minor version 49.0)
	java.lang.ClassLoader.defineClass0(Native Method)
	java.lang.ClassLoader.defineClass(ClassLoader.java:537)
	java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
	org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1629)
	org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:850)
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1299)
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
	org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1210)
	org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
	org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
	org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
	org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
	org.apache.jasper.compiler.Generator.generate(Generator.java:3270)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:189)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

*note* _The full stack trace of the root cause is available in the 
Apache Tomcat/5.5.9 logs._



Here are my files:
<!--First File-->
<html><body>
<form method=post action="SaveName.jsp">
    What's your name? <input type=text name=username size=20><br>
    What's your email address? <input type=text name=email size=20><br>
    What's your age? <input type=text name=age size=3><br>
    <input type=submit>
</form>
</body></html>


<!--Second File-->
<jsp:useBean id="user" class="UserData" scope ="session" />
<jsp:setProperty name="user" property="*" />

<HTML><BODY>
<A HREF="NextPage.jsp">Continue</A>
</BODY></HTML>


//UserData.java
import java.io.Serializable;

public class UserData implements Serializable {

    String username;
    String email;
    int age;

    public void setUsername( String value )    {
        username = value;
    }

    public void setEmail( String value )    {
        email = value;
    }

    public void setAge( int value )  {
        age = value;
    }

    public String getUsername() { return username; }
    public String getEmail() { return email; }
    public int getAge() { return age; }
}


<!--Last file-->
<jsp:useBean id="user" class="UserData" scope="session" />

<html><body>
You entered<br>
Name: <%= user.getUsername() %> <br>
Email: <%= user.getEmail() %><br>
Age: <%= user.getAge() %><br>
</body></html>


My environment variables are:
JAVA_HOME=/usr/local/jdk1.5.0; export JAVA_HOME
CATALINE_HOME="/usr/local/jakarta-tomcat5.5"; export CATALINE_HOME
CATALINE_BASE="/usr/local/jakarta-tomcat5.5"; export CATALINE_BASE
CATALINE_TMPDIR="/usr/local/jakarta-tomcat5.5/temp"; export CATALINE_TMPDIR
CLASSPATH="/usr/local/jakarta-tomcat5.5/webapps/ROOT/jsptut/WEB-INF/classes:/usr/local/jakarta-tomcat5.5/webapps/ROOT/WEB-INF/classes:/usr/local/jakarta-tomcat5.5/common/lib/servlet-api.jar:/usr/local/jakarta-tomcat5.5/common/lib/jsp-api.jar:.";export

CLASSPATH

I've compiled UserData.java with the following command:
$ javac UserData.java

and stored the class in the directory: 
/usr/local/jakarta-tomcat5.5/webapps/ROOT/WEB-INF/classes

Why am I getting this error?
How do I get a simple javabean example working with JSP under tomcat?


-- Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message