You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jason Rumney <jr...@ipo.att.com> on 2000/06/01 10:08:58 UTC

Re: WEB-INF/lib and .jar files in Tomcat 3.1

Nacho <na...@siapi.es> writes:

> I think that there are no restrictions to this, only that zip files are
> no loaded from WEB-INF/lib, but a zip file is not jar :-).
> 
> 
> > The reason I ask is that the CORBA libraries required by myapp do not
> > appear to be loaded from myapp/WEB-INF/lib. I wonder whether they are
> > too low-level for this method to work.
> > 
> 
> i dont know, but until now everytime i have the feeling that tomcat
> don't load a file from WEB-INF/lib was my fail no a Tomcat's fail.....

Thanks for confirming that this should work, and I am not reading the
servlet spec wrong.

The files are jar files, and they are in WEB-INF/lib, not a
subdirectory. Permissions are 664, so Tomcat should have no problems
reading them. They are loaded if I place them in jakarta-tomcat/lib,
but for reasons of organization I would prefer to keep them with the
app rather than the server.

The only thing I can think of is that these libraries contain
org.omg.CORBA.* classes, so they may need to be loaded when the JVM
starts up, to avoid clashes with the standard Java 1.2 classes. I don't
know enough about the Java classloader to know whether this would be
an issue, or if there is another problem.


-- 
Jason Rumney <jr...@ipo.att.com>
AT&T Labs (Redditch, UK)


Re: WEB-INF/lib and .jar files in Tomcat 3.1

Posted by Mark Brouwer <ma...@virgil.nl>.
Hi all,

"Craig R. McClanahan" wrote:
> 
> <snipped some stuff>
> 
> As currently implemented, the class loader used by Tomcat looks on the system
> classpath first, and then into the application-specific stuff (WEB-INF/classes
> and WEB-INF/lib/*.jar).  Thus, the classes from the JDK are going to be found
> where they have the same name, but the ones from your library will be found
> when they are different -- a mix that probably isn't going to work.
> 
> IMHO the class loader logic should be reversed - load from the application
> repositories first and then the system classpath.  I'm cross posting this to
> the developer's list in order to discuss this further.
> 

I while ago I brought this subject up with Danny Coward (spec lead of
Servlet 2.3) and he mentioned this will be clarified for 2.3. I also had
a discussion about the order of the classpath.

I think it should be:

WEB-INF/classes - WEB-INF/lib/*.jar - system classpath

My reasoning (from my mail to Danny)

> 
> Let us imagine a J2EE container with the mail.jar version 1.1.0 on its
> system classpath. You are using mail.jar version 1.1.5 in your
> WEB-INF/lib/ because that version has some bugfixes. The only way to get
> your application working now is by modifying the J2EE container, a big
> problem if your web application is hosted by an ASP. The same is
> applicable for standard XML parsers that most servlet containers will
> use.
>

We will see with the next spec :-)
-- 
Mark Brouwer
Virgil B.V.

Re: WEB-INF/lib and .jar files in Tomcat 3.1

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Jason Rumney wrote:

> Nacho <na...@siapi.es> writes:
>
> > I think that there are no restrictions to this, only that zip files are
> > no loaded from WEB-INF/lib, but a zip file is not jar :-).
> >
> >
> > > The reason I ask is that the CORBA libraries required by myapp do not
> > > appear to be loaded from myapp/WEB-INF/lib. I wonder whether they are
> > > too low-level for this method to work.
> > >
> >
> > i dont know, but until now everytime i have the feeling that tomcat
> > don't load a file from WEB-INF/lib was my fail no a Tomcat's fail.....
>
> Thanks for confirming that this should work, and I am not reading the
> servlet spec wrong.
>
> The files are jar files, and they are in WEB-INF/lib, not a
> subdirectory. Permissions are 664, so Tomcat should have no problems
> reading them. They are loaded if I place them in jakarta-tomcat/lib,
> but for reasons of organization I would prefer to keep them with the
> app rather than the server.
>
> The only thing I can think of is that these libraries contain
> org.omg.CORBA.* classes, so they may need to be loaded when the JVM
> starts up, to avoid clashes with the standard Java 1.2 classes. I don't
> know enough about the Java classloader to know whether this would be
> an issue, or if there is another problem.
>

That is going to be an issue.

As currently implemented, the class loader used by Tomcat looks on the system
classpath first, and then into the application-specific stuff (WEB-INF/classes
and WEB-INF/lib/*.jar).  Thus, the classes from the JDK are going to be found
where they have the same name, but the ones from your library will be found
when they are different -- a mix that probably isn't going to work.

IMHO the class loader logic should be reversed - load from the application
repositories first and then the system classpath.  I'm cross posting this to
the developer's list in order to discuss this further.

>
> --
> Jason Rumney <jr...@ipo.att.com>
> AT&T Labs (Redditch, UK)

Craig McClanahan





Re: WEB-INF/lib and .jar files in Tomcat 3.1

Posted by James Cook <ji...@iname.com>.
Jason,

Have you checked with your CORBA provider to see if there is a properties
file that can be used to specify which set of classes to use. I know that
Inprise's Visibroker product can get around the problem by specifying some
commandline switches.

At least I *think* that it addresses the same problem you are having.

jim

----- Original Message -----
From: Jason Rumney <jr...@ipo.att.com>
To: <to...@jakarta.apache.org>
Sent: Thursday, June 01, 2000 4:08 AM
Subject: Re: WEB-INF/lib and .jar files in Tomcat 3.1


> Nacho <na...@siapi.es> writes:
>
> > I think that there are no restrictions to this, only that zip files are
> > no loaded from WEB-INF/lib, but a zip file is not jar :-).
> >
> >
> > > The reason I ask is that the CORBA libraries required by myapp do not
> > > appear to be loaded from myapp/WEB-INF/lib. I wonder whether they are
> > > too low-level for this method to work.
> > >
> >
> > i dont know, but until now everytime i have the feeling that tomcat
> > don't load a file from WEB-INF/lib was my fail no a Tomcat's fail.....
>
> Thanks for confirming that this should work, and I am not reading the
> servlet spec wrong.
>
> The files are jar files, and they are in WEB-INF/lib, not a
> subdirectory. Permissions are 664, so Tomcat should have no problems
> reading them. They are loaded if I place them in jakarta-tomcat/lib,
> but for reasons of organization I would prefer to keep them with the
> app rather than the server.
>
> The only thing I can think of is that these libraries contain
> org.omg.CORBA.* classes, so they may need to be loaded when the JVM
> starts up, to avoid clashes with the standard Java 1.2 classes. I don't
> know enough about the Java classloader to know whether this would be
> an issue, or if there is another problem.
>
>
> --
> Jason Rumney <jr...@ipo.att.com>
> AT&T Labs (Redditch, UK)
>
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org
>
>


Re: WEB-INF/lib and .jar files in Tomcat 3.1

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Jason Rumney wrote:

> Nacho <na...@siapi.es> writes:
>
> > I think that there are no restrictions to this, only that zip files are
> > no loaded from WEB-INF/lib, but a zip file is not jar :-).
> >
> >
> > > The reason I ask is that the CORBA libraries required by myapp do not
> > > appear to be loaded from myapp/WEB-INF/lib. I wonder whether they are
> > > too low-level for this method to work.
> > >
> >
> > i dont know, but until now everytime i have the feeling that tomcat
> > don't load a file from WEB-INF/lib was my fail no a Tomcat's fail.....
>
> Thanks for confirming that this should work, and I am not reading the
> servlet spec wrong.
>
> The files are jar files, and they are in WEB-INF/lib, not a
> subdirectory. Permissions are 664, so Tomcat should have no problems
> reading them. They are loaded if I place them in jakarta-tomcat/lib,
> but for reasons of organization I would prefer to keep them with the
> app rather than the server.
>
> The only thing I can think of is that these libraries contain
> org.omg.CORBA.* classes, so they may need to be loaded when the JVM
> starts up, to avoid clashes with the standard Java 1.2 classes. I don't
> know enough about the Java classloader to know whether this would be
> an issue, or if there is another problem.
>

That is going to be an issue.

As currently implemented, the class loader used by Tomcat looks on the system
classpath first, and then into the application-specific stuff (WEB-INF/classes
and WEB-INF/lib/*.jar).  Thus, the classes from the JDK are going to be found
where they have the same name, but the ones from your library will be found
when they are different -- a mix that probably isn't going to work.

IMHO the class loader logic should be reversed - load from the application
repositories first and then the system classpath.  I'm cross posting this to
the developer's list in order to discuss this further.

>
> --
> Jason Rumney <jr...@ipo.att.com>
> AT&T Labs (Redditch, UK)

Craig McClanahan





RE: WEB-INF/lib and .jar files in Tomcat 3.1

Posted by "Rob S." <rs...@home.com>.
I'm not sure if anyone's answered this yet (I'm about 200 messages behind =)
but that's a feature that doesn't quite work according to a Tomcat FAQ
somewheres.

We had the same problem.  It wasn't loading out postgresql.jar, and our
admin found it in a faq.

- r

> -----Original Message-----
> From: jrumney@venice.ipo.att.com [mailto:jrumney@venice.ipo.att.com]On
> Behalf Of Jason Rumney
> Sent: Thursday, June 01, 2000 1:09 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Re: WEB-INF/lib and .jar files in Tomcat 3.1
>
>
> Nacho <na...@siapi.es> writes:
>
> > I think that there are no restrictions to this, only that zip files are
> > no loaded from WEB-INF/lib, but a zip file is not jar :-).
> >
> >
> > > The reason I ask is that the CORBA libraries required by myapp do not
> > > appear to be loaded from myapp/WEB-INF/lib. I wonder whether they are
> > > too low-level for this method to work.
> > >
> >
> > i dont know, but until now everytime i have the feeling that tomcat
> > don't load a file from WEB-INF/lib was my fail no a Tomcat's fail.....
>
> Thanks for confirming that this should work, and I am not reading the
> servlet spec wrong.
>
> The files are jar files, and they are in WEB-INF/lib, not a
> subdirectory. Permissions are 664, so Tomcat should have no problems
> reading them. They are loaded if I place them in jakarta-tomcat/lib,
> but for reasons of organization I would prefer to keep them with the
> app rather than the server.
>
> The only thing I can think of is that these libraries contain
> org.omg.CORBA.* classes, so they may need to be loaded when the JVM
> starts up, to avoid clashes with the standard Java 1.2 classes. I don't
> know enough about the Java classloader to know whether this would be
> an issue, or if there is another problem.
>
>
> --
> Jason Rumney <jr...@ipo.att.com>
> AT&T Labs (Redditch, UK)
>
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org
>
>