Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

useBean error & classpath setting

 
shivani anand
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 541
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
shivani anand
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more thing my process_request.jsp in following folder
/var/tomcat4/webapps/ROOT/cu/emailreg


SA
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, Tomcat does not use your classpath. It finds classes by searching a predefined set of directories.

Where did you put your RegistrantBean class?
 
Tim Baker
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim,

Thanks a bunch it worked
SA
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic