Re: shared/lib again...

2004-04-19 Thread Veniamin Fichin
Julio César Aguilar wrote:

I've done several tests in Windows and this is what I found.
To remember my settings
No CATALINA_BASE defined. Tests done with CATALINA_HOME/shared/lib.

1. As being told, I can find jars put in CATALINA_HOME/common/lib.

2.
   What exactly the moment when CNFE is thrown? You said that the 
applications is not even start due to CNFE, so that classes are needed 
during deployment or while normal application functioning?
The original problem was with a Filter, which was started at deployment.
   Then to my opinion this is due to Filter initialization (not 
run-time usage) as implemented in Tomcat: it uses a classloader that 
sees private webapp libraries (WEB-INF/lib/*) and libraries common to 
both webapp and Tomcat itself (CATALINA_HOME/common/lib/*), but not 
CATALINA_HOME/shared/lib/* . Hey, anybody with internals knowlegde can 
clarify this?

If I place the jar that contains the Filter class in WEB-INF/lib then the
application starts, but looking for classes needed after deployment 
(during a normal run) I can't find them if the corresponding jars are in shared/lib.

3. Something I had not mentioned about my application (I did not thought 
it was relevant) is that it lives outside the CATALINA_HOME directory, 
is referred to by a context.xml file in 
CATALINA_HOME/conf/Catalina/localhost.
   I don't think this is relevant eithter...

Using a test application in CATALINA_HOME/webapps and compiling the 
IsThereThisClass servlet provided by Veniamin I can finally find the 
classes within shared/lib.
   Stop, now I've messed up. :-) Your code can not find some jars in 
question, but mine does?? That code simply get servlet's classloader and 
searches a class by given name. So while it gets an ordinary 
this.getClass().getClassLoader(), it legally uses a classloader 
mentioned in Tomcat's docs as WebappX classloader, which surely should 
find all classes in its classpath.

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


Re: shared/lib again...

2004-04-19 Thread Julio César Aguilar
Sorry about not being clear enough last time.

Let's see...

The original problem was with a Filter, which was started at deployment.
   Then to my opinion this is due to Filter initialization (not run-time 
usage) as implemented in Tomcat.
That was my first thought when you brought up the question about the moment of 
the CNFE happening but I tried with classes needed at runtime (Velocity classes, 
for example) and could not find those either. Using my code or your servlet.


   Stop, now I've messed up. :-) Your code can not find some jars in 
question, but mine does??
No. Your code does not find things if I put in my application.
But it does find classes in jars in shared/lib within a test (almost empty) 
application living in CATALINA_HOME/webapps.

I know it does not seem important but I have no other clues by now.

---
Julio César Aguilar Cabrera
[EMAIL PROTECTED]
Proyecto SIGC3, LANIA


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


Re: shared/lib again...

2004-04-16 Thread Veniamin Fichin
Julio César Aguilar wrote:

   If you use multiple instance Tomcat's feature, this may be the case. 
In Windows I'm using a single instance of tomcat, there's no 
CATALINA_BASE so it should be the same as CATALINA_HOME if I understand 
correctly.
   Then I don't know... My installation is that:

Win2K
Java is 1.4.1_01
CATALINA_HOME=D:\Tomcat-5.0.16
CATALINA_BASE=D:\Projects\CA (or any other)
   %CATALINA_BASE%\shared\lib contains jars needed by most 
applications, and that classes are visible to application. Removing 
CATALINA_BASE variable and placing jars into %CATALINA_HOME%\shared\lib 
still works.
   I just wrote a simple servlet that looks for the class whose name is 
passed as parameter.

IsThereThisClass.java
package org.unchqua.test.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class IsThereThisClass extends HttpServlet {

public void doGet (HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.setContentType(text/plain);
PrintWriter out=resp.getWriter();
String cn=req.getParameter(cn);
ClassLoader cnLoader=null;
if (cn==null) {
out.println(No class name given, I want \cn\ parameter);
return;
}
out.print(The class \+cn+\ is);
try {
cnLoader=this.getClass().getClassLoader().loadClass(cn)
  .getClassLoader();
}
catch (ClassNotFoundException cnfe) {
out.print( not);
}
out.println( found);
if (cnLoader!=null) {
out.println(Loader:\n--\n+cnLoader+--);
}
}
}
/IsThereThisClass.java
   Map it to any working application and call it like 
classfind?cn=com.example.your.package.YourClass to see if it is visible 
to any webapp's classloader.
   What exactly the moment when CNFE is thrown? You said that the 
applications is not even start due to CNFE, so that classes are needed 
during deployment or while normal application functioning?

In Linux I'm using a single binary of tomcat and have the jar in 
CATALINA_BASE/shared/lib.


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


Re: shared/lib again...

2004-04-16 Thread Julio César Aguilar
I've done several tests in Windows and this is what I found.
To remember my settings
No CATALINA_BASE defined. Tests done with CATALINA_HOME/shared/lib.

1. As being told, I can find jars put in CATALINA_HOME/common/lib.

2.
   What exactly the moment when CNFE is thrown? You said that the 
applications is not even start due to CNFE, so that classes are needed 
during deployment or while normal application functioning?
The original problem was with a Filter, which was started at deployment.

If I place the jar that contains the Filter class in WEB-INF/lib then the
application starts, but looking for classes needed after deployment (during a
normal run) I can't find them if the corresponding jars are in shared/lib.
3. Something I had not mentioned about my application (I did not thought it was 
relevant) is that it lives outside the CATALINA_HOME directory, is referred to 
by a context.xml file in CATALINA_HOME/conf/Catalina/localhost.

Using a test application in CATALINA_HOME/webapps and compiling the 
IsThereThisClass servlet provided by Veniamin I can finally find the classes 
within shared/lib.

So, could this be the cause of my problem?

---
Julio César Aguilar Cabrera
[EMAIL PROTECTED]
Proyecto SIGC3, LANIA








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


RE: shared/lib again...

2004-04-15 Thread Shapira, Yoav

Hi,
Try putting the jar in common/lib instead of shared/lib.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: Julio César Aguilar [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 14, 2004 6:51 PM
To: Tomcat Users List
Subject: shared/lib again...

I've read the ClassLoading part of Tomcat documentation and searched this
list
but I've still found no clue to my recent problem:

Tomcat 5.0.19
JDK 1.4.2_03
Windows XP

I have several applications running with a common jar of my own in each
WEB-INF/lib and everthing works.
If I move that jar to %CATALINA_HOME%/shared/lib the applications wont
start
reporting a CNFE about a class in the previously mentioned jar.

I can reproduce the problem in Linux (same version of Tomcat and JDK)
placing
the jar in CATALINA_BASE/shared/lib or CATALINA_HOME/shared/lib.

Is there something that has to be done to be able to share a jar through
applications?

Thanks for any help.
---
Julio César Aguilar Cabrera
[EMAIL PROTECTED]
Proyecto SIGC3, LANIA


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




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



Re: shared/lib again...

2004-04-15 Thread Veniamin Fichin
Julio Cesar Aguilar wrote:
I've read the ClassLoading part of Tomcat documentation and searched this list 
but I've still found no clue to my recent problem:

Tomcat 5.0.19
JDK 1.4.2_03
Windows XP
I have several applications running with a common jar of my own in each 
WEB-INF/lib and everthing works.
If I move that jar to %CATALINA_HOME%/shared/lib the applications wont start 
reporting a CNFE about a class in the previously mentioned jar.
   If you use multiple instance Tomcat's feature, this may be the case. 
According to class-loader-howto.html, shared classloader looks its 
classes in $CATALINA_BASE/shared/lib , not in $CATALINA_HOME/shared/lib 
. I just tried this and it works.
   Alternatively you can place your .jar in $CATALINA_HOME/common/lib .

I can reproduce the problem in Linux (same version of Tomcat and JDK) placing 
the jar in CATALINA_BASE/shared/lib or CATALINA_HOME/shared/lib.

Is there something that has to be done to be able to share a jar through 
applications?


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


Re: shared/lib again...

2004-04-15 Thread Julio César Aguilar
Thanks to Veniamin and Yoav:

Veniamin Fichin wrote:
   If you use multiple instance Tomcat's feature, this may be the case. 
In Windows I'm using a single instance of tomcat, there's no CATALINA_BASE so it 
should be the same as CATALINA_HOME if I understand correctly.

In Linux I'm using a single binary of tomcat and have the jar in 
CATALINA_BASE/shared/lib.

   Alternatively you can place your .jar in $CATALINA_HOME/common/lib .
I wanted to be able to deploy my application as a regular user who owns 
CATALINA_BASE and has not write access to CATALINA_HOME.

Thanks anyway.
---
Julio César Aguilar Cabrera
[EMAIL PROTECTED]
Proyecto SIGC3, LANIA
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


shared/lib again...

2004-04-14 Thread Julio César Aguilar
I've read the ClassLoading part of Tomcat documentation and searched this list 
but I've still found no clue to my recent problem:

Tomcat 5.0.19
JDK 1.4.2_03
Windows XP
I have several applications running with a common jar of my own in each 
WEB-INF/lib and everthing works.
If I move that jar to %CATALINA_HOME%/shared/lib the applications wont start 
reporting a CNFE about a class in the previously mentioned jar.

I can reproduce the problem in Linux (same version of Tomcat and JDK) placing 
the jar in CATALINA_BASE/shared/lib or CATALINA_HOME/shared/lib.

Is there something that has to be done to be able to share a jar through 
applications?

Thanks for any help.
---
Julio César Aguilar Cabrera
[EMAIL PROTECTED]
Proyecto SIGC3, LANIA
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]