Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

JSP -Class not found Error  RSS feed

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Currently trying to create a web application, under TomCat
server.
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: http://127.0.0.1/examples/jsp/cats.jsp I get the following
error:-
-----------------------------------------------
Error: 500
Location: /examples/jsp/cats.jsp
Internal Servlet Error:
org.apache.jasper.JasperException:
Unable to compile class for JSPC:\TomCatDir\jakarta-tomcat\work\localhost_8080%2Fexamples\_0002fjsp_0002fcats_0002ejspcats_jsp_0.java:66:
Class jsp.catBean not found.
catBean categories = null;
^
C:\TomCatDir\jakarta-tomcat\work\localhost_8080%2Fexamples\_0002fjsp_0002fcats_0002ejspcats_jsp_0.java:69: Class jsp.catBean not found.
categories= (catBean)
^
----------------------------------------------
My cats.jsp file is as follows:-
<html>
<head>
<title>
The VSJ Widget Store
</title>
<%@ page language="java" %>
</head>
<body>
<table border="0" width="320">
<tr>
<td><center><h1>The VSJ Widget Store</center></h1></td></tr>
<tr>
<td><b>Welcome!</b>   Please click on whatever interests you.</td></tr>
<jsp:useBean id="categories" class="catBean" scope="page" />
<%
categories.makeConnection();
%>
<%
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>
</td></tr>
<%
} /* of while */
} /* of if */
%>
<% categories.takeDown();
%>
</table>
</body>
</html>
My catBean.java file contains:-
import java.sql.*;
import java.io.*;
public class catBean extends sqlBean
{
String myCatSQL = "select * from category";
ResultSet myResultSet = null;
public catBean() {super();}
public boolean getNextCat() throws Exception
{
return myResultSet.next();
}
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??.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 smirnov@colorado.edu
Thank you in advance!
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"MartinL",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . 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.
Thanks.
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!