wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Bean class not found error... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Bean class not found error..." Watch "Bean class not found error..." New topic
Author

Bean class not found error...

Tokunbo Oke
Ranch Hand

Joined: Sep 09, 2003
Posts: 57
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)
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12760
    
    5
Does your JSP have a <%@ page tag that imports the "com.cartapp.user" package?
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Bean class not found error...
 
Similar Threads
a problem about java beans
Package...not found in import
Help! Where to put a bean class
Where does this package go?
Newbie: In which directory do I put helper classes/beans