• 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

ClassNotFoundException

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a complete newby to java, and Tomcat, so this may be a very stupid mistake, but I have been trying to get this working for several days, and I am having no luck. I have seen several posts where someone has had the same symptoms as this, but none of their fixes have solved this problem.
I am running Tomcat 4 on redhat7.1
The error message that I am getting is
Root Cause:
java.lang.ClassNotFoundException: ConnectionBean
ConnectionBean.class is in .../jakarta-tomcat-4.0/webapps/abhome/WEB-INF/classes/com/artco/
the jsp code is:
<%@ page import="java.sql.*, com.artco.*" %>
<jsp:useBean id="con" class="ConnectionBean" />
<html>
<body>
Jeremiah's Bean Tester
<%
String sql = "Select * from DealerUsage";
ResultSet results = con.executeQuery(sql);
%>
<%=results.getString("UserName")%>
<hr>
</body>
</html>

I can post the ConnectionBean.java If it would help, But I think it is either a problem with the classpath or the jsp code.

Here is part of the /etc/bashrc file
JDK_HOME=/usr/local/java/jdk1.3.1_01/
JAVA_HOME=/usr/local/java/jdk1.3.1_01/
J2EE_HOME=/usr/local/java/j2sdkee1.3/
JAKARTA_HOME=/usr/local/java/jakarta-tomcat-4.0/
ANT_HOME=/usr/share/ant/bin/
TOMCAT_HOME=$JAKARTA_HOME/bin/
J2EE_CLASSPATH=/usr/local/java/j2sdkee1.3/lib/
PATH="$PATH:$JAVA_HOME/bin:$J2EE_HOME/bin:."
CLASSPATH="$JAKARTA_HOME/common/lib/servlet.jar"
CLASSPATH="$CLASSPATH:$JAKARTA_HOME/webapps/abhome/WEB-INF/classes/"
CLASSPATH="$CLASSPATH:$JAVA_HOME/lib/tools.jar:$ANT_HOME/lib/ant.jar"
CLASSPATH="$CLASSPATH:$J2EE_HOME/lib/j2ee.jar"
CLASSPATH="$CLASSPATH:$JAVA_HOME/lib:."
export J2EE_HOME JAVA_HOME JAKARTA_HOME ANT_HOME PATH TOMCAT_HOME J2EE_CLASSPATH JDK_HOME CLASSPATH
thanks in advance, JE
[This message has been edited by Jeremiah Elliott (edited November 01, 2001).]
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir
same problem I got..
I made it by..
Just putting the bean in the folder ..till where path is set for server to pick up file..mean
bean /mybean
folder bean and inside that folder mybean
right from the folder till where path u set in u r server ..
just try it
sandeep
 
Jeremiah Elliott
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help.
I added the bean directory in the classes directory, I got a different error message, so I re compiled the class file changing the first line (package bean.com.artco; ) Then I changed the import statement in the .jsp file to read
<%@ page import=�java.sql.*, bean.com.artco.*� %>
Any way I am back to where I was, with the same error message. I am not sure why but I think it is something in the classpath. Do I need to have the classpath pointing to the WEB_INF/classpath directory? If I take it out nothing changes.
like I said before, I would be happy to post the ConnectionBean.java file if it would help.
Thanks in advance,
Jeremiah
[This message has been edited by Jeremiah Elliott (edited November 02, 2001).]
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it's in your jsp useBean tag?

try: < jsp:useBean id="con" class="bean.com.artco.ConnectionBean" />
 
Jeremiah Elliott
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!! I am now getting a invalid cursor operation for my JDBC, but I think I can figure that out.
Jeremiah Elliott
 
If you two don't stop this rough-housing somebody is going to end up crying. Sit down and read this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!