I am using
Tomcat 4.0 on windows 98, when I try to use my bean class from
jsp program, I get class not found error. I read/followed all the similar problems in the forum but still have not been able to solve the problem.
The error I get is as follows:
==============================
type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
An error occurred at line: 1 in the jsp file: /handoff1.jsp
Generated
servlet error:
D:\Apps\Apache\Tomcat4.0\work\Standalone\localhost\cartapp\handoff1$jsp.java:56: Class com.cartapp.user.User not found.
com.cartapp.user.User handoff = null;
^
An error occurred at line: 1 in the jsp file: /handoff1.jsp
Generated servlet error:
D:\Apps\Apache\Tomcat4.0\work\Standalone\localhost\cartapp\handoff1$jsp.java:59: Class com.cartapp.user.User not found.
handoff= (com.cartapp.user.User)
^
An error occurred at line: 1 in the jsp file: /handoff1.jsp
Generated servlet error:
D:\Apps\Apache\Tomcat4.0\work\Standalone\localhost\cartapp\handoff1$jsp.java:64: Class com.cartapp.user.User not found.
handoff = (com.cartapp.user.User) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "com.cartapp.user.User");
^
3 errors, 1 warning
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:285)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:548)
=============================================
Location of files
==================
My jsp file is located at:
D:\Apps\Apache\Tomcat4.0\webapps\ROOT\cartapp
my bean class - User - is at:
D:\Apps\Apache\Tomcat4.0\webapps\ROOT\WEB-INF\classes\com\cartapp\user
Contents of the jsp file
=======================
<jsp:useBean id="handoff" scope="session" class="com.cartapp.user.User" />
<HTML>
<BODY>
This is the setting page!
<%
handoff.setFirstName("George");
%>
</BODY>
</HTML>
The first 2 lines of the class are:
==================================
package com.cartapp.user;
public class User {
Environment settings
====================
JAVA_HOME=D:\Apps\java\jdk
CATALINA_HOME=D:\Apps\Apache\Tomcat4.0
CLASSPATH=;.;F:\ola\progmn\JAVA\pkgs;D:\Apps\Apache\Tomcat4.0\common\lib\servlet.jar
Can anyone please help. Thanks.
Thanks.
Ola Oke (
SCJP 1.4)