I got the problem solved, the java package I have created that it called
by the servlet was compiling against an old version of 'servlet.jar'
that some person had put into cvs. Thanks heaps for your advice. What
you mentioned was actually happening somewhere else in another servlet.
So you have in fact solved another problem I had to fix.
Thanks to everyone who uses this mailing list, especially those who post
to it!!!
Shapira, Yoav wrote:
Howdy,
To Andrew: make sure you only have one servlet.jar file in each tomcat
installation. It is located in the $CATALINA_HOME/common/lib directory
by default. Don't put another copy in your WEB-INF/lib directories by
mistake ;)
To Christian: can you rigorously prove your JSP correctly shows the
classloading order? Does it work on non-Sun JVMs? Does it correctly
account for the precedence of endorsed directories as specified by the
-D argument to java?
Yoav Shapira
Millennium ChemInformatics
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, May 26, 2003 2:35 AM
To: Tomcat Users List
Subject: Re: Classloader Issues: ServletContext... method not found
Hi Andrew,
The following code is the code of a jsp site which list you all the
classes
loaded by Tomcat and also tellingy out in which order they are loaded.
Maybe this will help you figure out which class are loaded in your
case.
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
Classpath Diagnostic
Classpath Diagnostic
Classes will be loaded from the following locations, in the order
shown
below:
<%
final String DELIMITER = System.getProperty("path.separator");
StringTokenizer st;
String path;
%>
Boot Classes
<%
path = System.getProperty("sun.boot.class.path");
st = new StringTokenizer(path, DELIMITER);
while (st.hasMoreTokens()) {
String token = st.nextToken();
out.println(getFileLink(token));
}
%>
Extension Classes
<%
path = System.getProperty("java.ext.dirs");
st = new StringTokenizer(path, DELIMITER);
while (st.hasMoreTokens()) {
String token = st.nextToken();
out.println(enumerateJars(token));
}
%>
Application Classes
<%
path = System.getProperty("java.class.path");
st = new StringTokenizer(path, DELIMITER);
while (st.hasMoreTokens()) {
String token = st.nextToken();
out.println(getFileLink(token));
}
%>
WEB-INF Classes
<%
path = application.getRealPath("/WEB-INF");
if (path == null)
out.println("N/A" + "");
else {
File WEBINF = new File(path);
File classes = new File(WEBINF, "classes");
out.println(getFileLink(classes.getPath()));
File lib = new File(WEBINF, "lib");
out.println(enumerateJars(lib.getPath()));
}
%>
<%!
private String enumerateJars(String name){
StringBuffer sb = new StringBuffer();
File dir = new File(name);
if (dir.exists()) {
String[] files = dir.list();
if (files != null) {
for (int i = 0; i < files.length; i++) {
if (files[i].endsWith(".jar")) {
File file = new File(dir, files[i]);
sb.append(getFileLink(file.getPath()));
}
}
}
}
else {
sb.append(name);
sb.append(" (does not exist)");
}
return sb.toString();
}
private String getFileLink(String name){
StringBuffer sb = new StringBuffer();
File file = new File(name);
if (file.exists()) {
sb.append("");
sb.append(name);
sb.append("");
}
else {
sb.append(name);
sb.append(" (does not exist)");
}
sb.append("");
return sb.toString();
}
%>
Christian Schuster
Rudolf Schuster AG
Postfach 277
CH - 3000 Bern 11
http://www.rsag.ch
++41 31 348 05 30
Andrew Hughes -
LISAsoft
<[EMAIL PROTECTED]
To
.com.au> [EMAIL PROTECTED]
cc
26.05.2003 08:20
Subject
Classloader Issues:
Please respond to ServletContext... method not
found
"Tomcat Users
List"
<[EMAIL PROTECTED]
rta.apache.org>
Greetings,
I'm running both tomcat v4.0.4 and 4.1.24. Both of them have now an
error when I try and execute a servlet I have written. I have not
changed any of the lib files but I am now unexplainably receiving the
following exception from tomcat.
/The method getInitParameter(String) is undefined for the type
ServletContext/
The API says it has such a method, however it is obviouly loading
another package/