java.lang.NoClassDefFoundError Please Help
Posted: Mon Dec 08, 2003 1:59 pm
im using the java web devlopers pack 1.3
installed in ;
C:\jwsdp-1.3
when i run certain classes (when there name is no long see below for example i get the error)
java.lang.NoClassDefFoundError
==============================================
the problem is basically a class called Test will run while a class (identical codewise) called TestCustomerDao Wont run given the above error (it compiles fine)
sample class which wont run(code wise this is no problem)
======================================
// CustomerByNameCommand.java
/*
6 - dec - 03
note to myself
proble with this class
it doesnt work because the class name is too long?
the code is fine
*/
package web.proj3.command ;
import java.util.* ;
import java.sql.* ;
import java.io.* ;
/*
CustomerByNameCommand
Q4 (ii)
*/
import javax.servlet.* ;
import javax.servlet.http.* ;
import web.proj3.business.* ;
import web.proj3.dao.* ;
import web.proj3.exceptions.* ;
public class CustomerByNameCommand implements Command
{
private HttpServletRequest request ;
private HttpServletResponse response ;
private HttpSession session ;
public CustomerByNameCommand(HttpServletRequest aRequest,
HttpServletResponse aResponse,
HttpSession aSession)
{
request = aRequest ;
response = aResponse ;
session = aSession ;
}
public String execute()
{
String page = null ;
CustomerDao dao = new CustomerDao() ;
try
{
//has to be changed
String customerName = request.getParameter("customerName") ;
ArrayList customers = dao.getCustomersByName(customerName);
/*String customerName = request.getParameter("customerName") ;
ArrayList customers = dao.getCustomersByName(customerName) ;
if (customers.size() == 0)
{
request.setAttribute("errorMessage", "No customers with this name") ;
page = errorPage ;
}
else
{
request.setAttribute("customers", customers) ;
page = "/" + request.getParameter("command") + ".jsp" ; // i.e. /CustomersByName.jsp
}*/
if (customers.size() == 0)
{
request.setAttribute("errorMessage", NO_CUSTOMERS) ;
page = errorPage ;
}
else
{
request.setAttribute("customers", customers) ;
page = "/" + request.getParameter("command") + ".jsp" ; // i.e. /Customers.jsp
}
}
catch(DaoException e)
{
page = errorPage ;
request.setAttribute("errorMessage", e.getMessage() ) ;
}
return page ;
}
}
installed in ;
C:\jwsdp-1.3
when i run certain classes (when there name is no long see below for example i get the error)
java.lang.NoClassDefFoundError
==============================================
the problem is basically a class called Test will run while a class (identical codewise) called TestCustomerDao Wont run given the above error (it compiles fine)
sample class which wont run(code wise this is no problem)
======================================
// CustomerByNameCommand.java
/*
6 - dec - 03
note to myself
proble with this class
it doesnt work because the class name is too long?
the code is fine
*/
package web.proj3.command ;
import java.util.* ;
import java.sql.* ;
import java.io.* ;
/*
CustomerByNameCommand
Q4 (ii)
*/
import javax.servlet.* ;
import javax.servlet.http.* ;
import web.proj3.business.* ;
import web.proj3.dao.* ;
import web.proj3.exceptions.* ;
public class CustomerByNameCommand implements Command
{
private HttpServletRequest request ;
private HttpServletResponse response ;
private HttpSession session ;
public CustomerByNameCommand(HttpServletRequest aRequest,
HttpServletResponse aResponse,
HttpSession aSession)
{
request = aRequest ;
response = aResponse ;
session = aSession ;
}
public String execute()
{
String page = null ;
CustomerDao dao = new CustomerDao() ;
try
{
//has to be changed
String customerName = request.getParameter("customerName") ;
ArrayList customers = dao.getCustomersByName(customerName);
/*String customerName = request.getParameter("customerName") ;
ArrayList customers = dao.getCustomersByName(customerName) ;
if (customers.size() == 0)
{
request.setAttribute("errorMessage", "No customers with this name") ;
page = errorPage ;
}
else
{
request.setAttribute("customers", customers) ;
page = "/" + request.getParameter("command") + ".jsp" ; // i.e. /CustomersByName.jsp
}*/
if (customers.size() == 0)
{
request.setAttribute("errorMessage", NO_CUSTOMERS) ;
page = errorPage ;
}
else
{
request.setAttribute("customers", customers) ;
page = "/" + request.getParameter("command") + ".jsp" ; // i.e. /Customers.jsp
}
}
catch(DaoException e)
{
page = errorPage ;
request.setAttribute("errorMessage", e.getMessage() ) ;
}
return page ;
}
}