RE: Classloader issues

2004-02-25 Thread SH Solutions
Hi

> Have you added the mail's jar file to your WEB-INF/lib or common/lib? If
not, then that's the problem. Tomcat 5 doesn't ship with the mail api.

I have tried adding mailapi.jar, activation.jar, smtp.jar, pop3.jar,
imap.jar to common/lib, WEB-INF/lib and shared/lib. None worked.

Any other hints?

cu
  Steffen


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Classloader issues

2004-02-24 Thread Jeanfrancois Arcand


SH Solutions wrote:

Hi

I experience problems using 5.0.18 that did not occur running 4.0.6, but I
do NOT want to revert to it.
Maybe you could help me:
Actually I have a system that uses classloaders for loading add-in groups.
The two most important functions are:
 protected Class findClass( String className )
   throws ClassNotFoundException
 {
   if ( className.startsWith( "com.companyname." ) )
 return getClass().getClassLoader().loadClass( className );
   byte classData[] = getTypeFromBasePath( className );
   if ( classData == null )
 throw new ClassNotFoundException();
   return defineClass( className, classData, 0, classData.length );
 }
 
 private byte[] getTypeFromBasePath( String typeName )
 {
   return Utils.readFile( classPath + typeName.replace( '.',
File.separatorChar ) + ".class" );
 }

This works that far. It worked completely in tomcat4.0.6.

Now, having switched to 5.0.18 something wired occued:
java.lang.ClassNotFound javax.mail.Address
we used to have mailapi.jar in common (including its dependencies) which
worked well.
Now with 5.0.18 these classes are not found anymore, but nothing was changed
inside the code.
Could you give me any hints?
 

Have you added the mail's jar file to your WEB-INF/lib or common/lib? If 
not, then that's the problem. Tomcat 5 doesn't ship with the mail api.

-- Jeanfrancois

Thanks,
 Steffen
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Classloader Issues: ServletContext... method not found

2003-05-27 Thread Andrew Hughes - LISAsoft
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/

Re: classloader issues using ../common/lib vs. ../shared/lib

2003-02-04 Thread Bill Barker
Except for stuff like jdbc drivers, 90% of the time you will see no
difference between common/lib and shared/lib.  The difference is that the
internal Tomcat classes can see what is in common/lib (which the above
mentioned 90% of the time means that they could care less :).

"Mark" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Are there any potential classloader problems with putting .jar files that
> are shared across webapps (ie. junit, cactus, etc) in ../common/lib vs.
> ../shared/lib?
>
> We've been tossing .jars into ../common/lib, but after reading the Tomcat
> classloader how-to it seems that's discouraged, ie. should be done only
> when the classes are needed both by Tomcat and applications such as db
> drivers for JDBC realm and application use. I'm guessing, but does putting
> the .jars in ../shared/lib would spread work out better between
classloaders?
>
> Our application and integration tools are working great, but the fact
we're
> not configured the way the how-to suggests concerns me.
>
> TIA




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]