You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jay Wright <jw...@once.com> on 2001/10/10 18:56:06 UTC

class loader

Hopefully this is an easy question that has been worked over many times.

I've just switched from Resin to Tomcat 4.0.  I'm currently testing on
windows, though we'll deploy on Solaris.  Everything looks great so far and
I'm overall very pleased, but have stumbled into one problem:  the
Class.forName(<classname>) is unable to find a class.  In this case, it is
oracle.jdbc.driver.OracleDriver.  As I've ported the code from Resin to
Tomcat, I know my code is okay, but I wanted to make sure that I'm complying
with the Tomcat container.

I've placed the classes12.jar file (the oracle driver) in
%CATALINA_HOME%/lib.  I've done nothing else, such as add it to a classpath.


Do I need to explicitly set it in the classpath?  Is there a better location
for it?  (I've also tried %CATALINA_HOME%/server/lib and
%CATALINA_HOME%/webapps/<myapp>/WEB-INF/lib).

Any help would be appreciated.

Thanks,
Jay

Re: class loader

Posted by Torben Nürnberg Rasmussen <to...@nurnberg.dk>.
----- Original Message -----
From: "Jay Wright" <jw...@once.com>
To: <to...@jakarta.apache.org>
Sent: Wednesday, October 10, 2001 6:56 PM
Subject: class loader


>
> Hopefully this is an easy question that has been worked over many times.
>
> I've just switched from Resin to Tomcat 4.0.  I'm currently testing on
> windows, though we'll deploy on Solaris.  Everything looks great so far
and
> I'm overall very pleased, but have stumbled into one problem:  the
> Class.forName(<classname>) is unable to find a class.  In this case, it is
> oracle.jdbc.driver.OracleDriver.  As I've ported the code from Resin to
> Tomcat, I know my code is okay, but I wanted to make sure that I'm
complying
> with the Tomcat container.
>
> I've placed the classes12.jar file (the oracle driver) in
> %CATALINA_HOME%/lib.  I've done nothing else, such as add it to a
classpath.
>
>
> Do I need to explicitly set it in the classpath?  Is there a better
location
> for it?  (I've also tried %CATALINA_HOME%/server/lib and
> %CATALINA_HOME%/webapps/<myapp>/WEB-INF/lib).
>
I think the right solution is to place the jar-file in the
%CATALINA_HOME%/webapps/<myapp>/WEB-INF/lib directory.
That worked for me.
Have you tried to restart the tomcat server? It seems that sometimes that is
necessary. I can't find out when it is necessary and when not.

Torben Rasmussen.


Re: class loader

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 10 Oct 2001, Jay Wright wrote:

> Date: Wed, 10 Oct 2001 09:56:06 -0700
> From: Jay Wright <jw...@once.com>
> Reply-To: tomcat-user@jakarta.apache.org
> To: "'tomcat-user@jakarta.apache.org'" <to...@jakarta.apache.org>
> Subject: class loader
>
>
> Hopefully this is an easy question that has been worked over many times.
>
> I've just switched from Resin to Tomcat 4.0.  I'm currently testing on
> windows, though we'll deploy on Solaris.  Everything looks great so far and
> I'm overall very pleased, but have stumbled into one problem:  the
> Class.forName(<classname>) is unable to find a class.  In this case, it is
> oracle.jdbc.driver.OracleDriver.  As I've ported the code from Resin to
> Tomcat, I know my code is okay, but I wanted to make sure that I'm complying
> with the Tomcat container.
>
> I've placed the classes12.jar file (the oracle driver) in
> %CATALINA_HOME%/lib.  I've done nothing else, such as add it to a classpath.
>
>
> Do I need to explicitly set it in the classpath?

No ... even if you try, anything you put on the CLASSPATH variable is
totally ignored at startup time.

> Is there a better location
> for it?  (I've also tried %CATALINA_HOME%/server/lib

See the Class Loader HOW-TO docs for more info, and you'll find that this
won't help -- it's for stuff that is visible *only* to the insides of
Tomcat.


> and
> %CATALINA_HOME%/webapps/<myapp>/WEB-INF/lib).
>

If none of these places work, it is likely that your file is not being
recognized as a JAR file.  Are there any interesting messages in the log
files?

> Any help would be appreciated.
>
> Thanks,
> Jay
>

Craig



RE: class loader

Posted by Rob Smyth <ro...@mediaone.net>.
Sorry to bother you with of-topic info.  Do you know how to unsubscribe
from this list?

Rob Smyth
Avarial Consulting
310-385-9526


-----Original Message-----
From: Jay Wright [mailto:jwright@once.com] 
Sent: Wednesday, October 10, 2001 9:56 AM
To: 'tomcat-user@jakarta.apache.org'
Subject: class loader


Hopefully this is an easy question that has been worked over many times.

I've just switched from Resin to Tomcat 4.0.  I'm currently testing on
windows, though we'll deploy on Solaris.  Everything looks great so far
and
I'm overall very pleased, but have stumbled into one problem:  the
Class.forName(<classname>) is unable to find a class.  In this case, it
is
oracle.jdbc.driver.OracleDriver.  As I've ported the code from Resin to
Tomcat, I know my code is okay, but I wanted to make sure that I'm
complying
with the Tomcat container.

I've placed the classes12.jar file (the oracle driver) in
%CATALINA_HOME%/lib.  I've done nothing else, such as add it to a
classpath.


Do I need to explicitly set it in the classpath?  Is there a better
location
for it?  (I've also tried %CATALINA_HOME%/server/lib and
%CATALINA_HOME%/webapps/<myapp>/WEB-INF/lib).

Any help would be appreciated.

Thanks,
Jay