tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 18577] New: - resources in $CATALINA_HOME/shared not found
Date Tue, 01 Apr 2003 18:51:11 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18577>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18577

resources in $CATALINA_HOME/shared not found

           Summary: resources in $CATALINA_HOME/shared not found
           Product: Tomcat 4
           Version: 4.1.24
          Platform: All
        OS/Version: OS/400
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: bahbahbooie@go.com


I am using Tomcat 4.1.24 on an IBM iSeries (formerly AS/400).
I cannot access a class that resides in a JAR file (utilities.jar) in 
$CATALINA_HOME/shared/lib and get a java.lang.NoClassDefFoundError.

I wrote a very simple servlet to reproduce this problem. It attempts to use 
a class (CASDate) in the shared dir. 
---- 
import com.myco.utilities.CASDate; 
import javax.servlet.http.HttpServlet; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 

public class Test1 extends HttpServlet { 

public void doGet(HttpServletRequest request, HttpServletResponse 
response) throws javax.servlet.ServletException, java.io.IOException { 

System.out.println("GET method of Test1 invloked"); 
performTask(request, response); 
} 
// 
public void doPost(HttpServletRequest request, HttpServletResponse 
response) throws javax.servlet.ServletException, java.io.IOException { 

System.out.println("POST method of Test1 invloked"); 
performTask(request, response); 
} 
/** 
* Test the use of a shared class. 
*/ 
public void performTask(HttpServletRequest request, HttpServletResponse 
response) { 

try { 
java.io.PrintWriter pw = response.getWriter(); 
CASDate today = new CASDate(); 
pw.println("CASDate today is " + today.toString()); 
pw.println("CASDate class loaded..."); 
} 
catch(Throwable theException) { 
System.out.println("Error..."); 
theException.printStackTrace(System.out); 
} 
} 
} 
---- 
This is the utility class (some getXXX methods deleted for brevity): 
---- 
package com.myco.utilities; 

import java.util.Calendar; 
import java.util.GregorianCalendar; 

public class CASDate { 
private int ccc = 0; 
private int yyy = 0; 
private int mmm = 0; 
private int ddd = 0; 
private int time = 0; 
/** 
* Default constructor is to create CAS date using the current date. 
*/ 
public CASDate() { 
super(); 
GregorianCalendar cal = new GregorianCalendar(); 
ccc = 20; 
yyy = cal.get(Calendar.YEAR) - 2000; 
mmm = cal.get(Calendar.MONTH) + 1; 
ddd = cal.get(Calendar.DAY_OF_MONTH); 
} 
/** 
* Return a string in MM/DD/CCYY format. 
*/ 
public String toString() { 
String returnValue = getMonth() + "/" + getDay() + "/" + 
getYearAndCentury(); 
return returnValue; 
} 
} 
---- 

The error I get is: 
java.lang.NoClassDefFoundError: com/myco/utilities/CASDate 

When I moved utilities.jar to my <webapp>/WEB-INF/lib the error goes away so I
know it is not a coding error.
The error also goes away when I put the JAR file in $CATALINA_HOME/common/lib
but the documentation says:

"For classes and resources that must be shared across all web applications,
place unpacked classes and resources under $CATALINA_HOME/shared/classes, or
place JAR files containing those classes and resources under
$CATALINA_HOME/shared/lib." 

Please update the documentation or fix the functionality to save others the
headaches I've experienced.

Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message