aspose file tools*
The moose likes Tomcat and the fly likes useBean error & classpath setting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "useBean error & classpath setting" Watch "useBean error & classpath setting" New topic
Author

useBean error & classpath setting

shivani anand
Ranch Hand

Joined: Dec 28, 2000
Posts: 155
Hi!
I started tomcat through following script

******************************************
echo Starting Tomcat > tomcat_status
date >> tomcat_status
CLASSPATH=/var/jakarta-tomcat-5.5.6/server/lib:/var/tomcat4/common/lib:/var/tomcat4/webapps/WEB-INF/classes:/var/tomcat4/common/lib:/var/tomcat4/webapps/WEB-INF/classes
export CLASSPATH
CATALINA_HOME=/var/jakarta-tomcat-5.5.6
export CATALINA_HOME
JAVA_HOME=/usr/java/jdk1.5.0_01
export JAVA_HOME
cd $CATALINA_HOME/bin
rm nohup.out
nohup ./startup.sh &
***************************************

now I am tring to access one jsp script from explorer

It is giving me following error..
org.apache.jasper.JasperException: /cu/emailreg/process_request.jsp(3,0) The value for the useBean class attribute cu.emailreg.RegistrantBean is invalid.



Why it is giving so any idea?

there is a file RegistrantBean.class in following folder

/var/tomcat4/webapps/WEB-INF/classes/cu/emailreg.

Please advice.
thanks
SA
Tim Baker
Ranch Hand

Joined: Oct 04, 2003
Posts: 541
Hi,
Lets see the useBean statement in your JSP
and also
Lets see the top of your java file ie all the code in the top until the end of your default constructor.


Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
shivani anand
Ranch Hand

Joined: Dec 28, 2000
Posts: 155
I am sending code but the thing is it is working on one box I am trying to migrate all application on different server.

************* process_request.jsp ****************
<%@ page import="java.util.*" %>

<jsp:useBean id="xxxxxx" class="cu.emailreg.RegistrantBean" scope="request">
<jsp:setProperty name="Registrant" property="*"/>
</jsp:useBean>
<%
if (Registrant.validate()) {
Registrant.insert();
response.sendRedirect(Registrant.getredirect());
} else {
// invalid data - display error page
%>
<jsp:forward page="get_info.jsp"/>
<%
}

**************************java code *************
package cu.emailreg;

import coreservlets.DBResults;
import coreservlets.DatabaseUtilities;
import csc.utils.StringFormat;
import csc.utils.errorHandler;
import java.io.*;
import java.util.Hashtable;

// Referenced classes of package cu.emailreg:
// emailSubscriberConnectionPool

public class RegistrantBean
{

public RegistrantBean()
{
version = "1.1, 2003/12/23";
debug = false;
if(debug)
System.out.println(getClass().getName() + " version " + version + ": entering RegistrantBean method");
email = "";
fname = "";
action = "";
list = new String[0];
redirect = "";
crsubscriber = "";
availableList = new Hashtable();
general_error_msg = "";
errors = new Hashtable();
if(debug)
System.out.println(getClass().getName() + ": leaving RegistrantBean method");
}
shivani anand
Ranch Hand

Joined: Dec 28, 2000
Posts: 155
One more thing my process_request.jsp in following folder
/var/tomcat4/webapps/ROOT/cu/emailreg


SA
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

First, Tomcat does not use your classpath. It finds classes by searching a predefined set of directories.

Where did you put your RegistrantBean class?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Tim Baker
Ranch Hand

Joined: Oct 04, 2003
Posts: 541
Ok,
so you said your class is in:
/var/tomcat4/webapps/WEB-INF/classes/cu/emailreg.

but your jsp is in:
/var/tomcat4/webapps/ROOT/cu/emailreg

I believe your class should be in:
/var/tomcat4/webapps/ROOT/WEB-INF/classes/cu/emailreg
shivani anand
Ranch Hand

Joined: Dec 28, 2000
Posts: 155
Tim,

Thanks a bunch it worked
SA
 
Don't get me started about those stupid light bulbs.
 
subject: useBean error & classpath setting