tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: [repost] loading class files
Date Mon, 19 Nov 2001 16:06:22 GMT
I use this setup on my linux box (TC 4.0.1, MySQL JDBC, Mandrake 8).  The 
only issue I've ever had with the driver is the downloaded MySQL JDBC driver 
file needs to be unjarred.  The .jar file nested inside is the actual JDBC 
driver.  Place it in WEB-INF/lib and restart Tomcat so it can find the file.  
Alternatively, this file can be in CATALINA_BASE$/lib or 
CATALINA_BASE$/common/lib if you want it available to all your apps or all 
your apps and Tomcat itself respectively.

Note on the other stuff:  Classes used on the server side should be in a 
package structure under WEB-INF/classes to work correctly.  JSPs, static 
content, and client-side applets should all be outside the WEB-INF folder for 
proper operation.  This is defined in the spec and is required for all 
applications conforming to it.

Hope this clears some mystery.

--David Smith

On Monday 19 November 2001 12:41 am, you wrote:
> Sorry guys this is a repost. But after doing numerous google search and
> wading through the docs, I still can't solve my problem with regard to
> loading applet classes. I sincerely hope some of you can help me this time,
> I desperately need to get this working.  The same message is as follow.
>
> Hello All,
>
> I'm writing an applet that uses JDBC to connect to MySQL server , and the
> applet is embedded in a jsp.  I'm new to this, so I went on and read the
> docs that come with Tomcat.  I'm also using CVS and ant for the
> development. The source code layout of my project is as suggested in the
> docs, which is
>
> project name
>
>                   |----- docs
>                   |----- src
>                   |----- web
>                   |
>                                 |------>WEB-INF
>
> In the project/web/WEB-INF directory, do I have to create a classes and lib
> subdirectories?  The reason I ask this is because the class loader, from
> the Tomcat or web browser, can't find the class files.  But they're clearly
> in the web directory, whose structure is as,
>
> project
>
>           |---- login.jsp (that's the jsp file that embeds the applet)
>           |---- WEB-INF
>           |
>                                 |------- classes (this directory has all
>                                 | the
>
> needed class files)
>
>                                 |------- lib (where the MySQL driver is
>
> stored)
>
> The Tomcat docs says the classes and lib dir "are made visible to other
> classes within your particular web application", but why my class files
> can't be loaded there?  If I move all the class files to the top of the web
> directory, and change "code="MyClass.class""  to "code="MyClass"" in the
> jsp file, then everything seems to working OK. Oh, yeah, almost forgot, I
> also need to copy the whole directory tree for the driver to the web
> directory as well.  Setting the classpath for the driver doesn't work.  I
> don't want to copy the class files to the top of the web directory every
> time, can those file be loaded in the classes and lib directories.  Sorry
> about this rather long message, but I'm getting very frustrated and hopping
> some of you can help me with this.
>
> Thanks for your help in advance.
>
> P.S. I'm using Tomcat4.0 on Win2000
>
>
>
>
>
> --
> To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
> Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message