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).]
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
Want to do something great will do one day
Joined: Nov 01, 2001
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).]