my dog learned polymorphism
The moose likes Servlets and the fly likes JSP -Class not found Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP -Class not found Error" Watch "JSP -Class not found Error" New topic

JSP -Class not found Error

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Currently trying to create a web application, under TomCat
I have copied all my jsp files to \examples\jsp directory, relative to where I installed TomCat.
Copied .class files under the \examples\WEB-INF\classes
Copied .jpg and .gif into \examples\jsp\images
I kick off tomcat ok, but on entering: I get the following
Error: 500
Location: /examples/jsp/cats.jsp
Internal Servlet Error:
Unable to compile class for JSPC:\TomCatDir\jakarta-tomcat\work\localhost_8080%2Fexamples\
Class jsp.catBean not found.
catBean categories = null;
C:\TomCatDir\jakarta-tomcat\work\localhost_8080%2Fexamples\ Class jsp.catBean not found.
categories= (catBean)
My cats.jsp file is as follows:-
The VSJ Widget Store
<%@ page language="java" %>
<table border="0" width="320">
<td><center><h1>The VSJ Widget Store</center></h1></td></tr>
<td><b>Welcome!</b>   Please click on whatever interests you.</td></tr>
<jsp:useBean id="categories" class="catBean" scope="page" />
if (categories.getCategories())
while (categories.getNextCat()) {
<tr><td><br><a href='store.jsp?catid=<%= categories.getColumn("catid") %>'>
<center><h2><%= categories.getColumn("catname") %></a></h2></center>
} /* of while */
} /* of if */
<% categories.takeDown();
My file contains:-
import java.sql.*;
public class catBean extends sqlBean
String myCatSQL = "select * from category";
ResultSet myResultSet = null;
public catBean() {super();}
public boolean getNextCat() throws Exception
public String getColumn( String inCol) throws Exception
return myResultSet.getString(inCol);
public boolean getCategories() throws Exception
String myQuery = myCatSQL;
Statement stmt = myConn.createStatement();
myResultSet = stmt.executeQuery(myQuery);
return (myResultSet != null);
Can any body help!.
It looks as if the jsp can't locate the class file, I thought
CLASSPATH took care of that??.
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I have exactly the same question as the
"JSP -Class not found Error" topic.
Did this get resolved? I relly need to know! Let me know at
Thank you in advance!
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

It looks like your servlet is looking for jsp.catBean

So under your \examples\WEB-INF\classes, you should have a jsp folder with the catBean.class file inside.

Perhaps there is a packaging error.
I agree. Here's the link:
subject: JSP -Class not found Error
It's not a secret anymore!