You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by sm...@digisolutions.com on 2000/04/04 19:58:30 UTC

newbie class path question

Hi,

So far I have been able to deploy a webapp other than example
basically by cloning the examples app. I've even been able to have the
new code call classes that exist in packages. (Pretty exciting, I
know). 

However, I have not be able to have the intial servlet exist in a
package. That is the servlet that the starts the webapp has no
package. 

Here's my setup.

webapps/myServlets/WEB-INF/classes/

this directory contains com which is the tip of my packages. 

it also contanis a file called:

EntryServlet.class which is the servlet that gets things going. 

I'd like to have this servlet exist in com/myCode/serlvets/

or some such, but I can't figure out to configure this. 

Basically, I am asking how package configuration works under tomcat, I
guess. 

Also any info about WARchive files would be appreicate. Like how to
create them. 

Thanks in advance,Spencer

Re: newbie class path question

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

> Hi,
>
> So far I have been able to deploy a webapp other than example
> basically by cloning the examples app. I've even been able to have the
> new code call classes that exist in packages. (Pretty exciting, I
> know).
>
> However, I have not be able to have the intial servlet exist in a
> package. That is the servlet that the starts the webapp has no
> package.
>
> Here's my setup.
>
> webapps/myServlets/WEB-INF/classes/
>
> this directory contains com which is the tip of my packages.
>
> it also contanis a file called:
>
> EntryServlet.class which is the servlet that gets things going.
>
> I'd like to have this servlet exist in com/myCode/serlvets/
>
> or some such, but I can't figure out to configure this.
>

If you want this to be the case, then EntryServlet must be in package
com.myCode.servlets -- and the class file would be

    webapps/myServlets/WEB-INF/classes/com/myCode/servlets/EntryServlet.class


>
> Basically, I am asking how package configuration works under tomcat, I
> guess.
>

Exactly the same as package configuration for any other kind of Java classes.

If you've got the classes unpacked, you are putting a directory name on the
classpath (for servlets, Tomcat automatically does this for the
WEB-INF/classes directory of your app) and the directory structure underneath
this directory must reflect your package hierarchy.

>
> Also any info about WARchive files would be appreicate. Like how to
> create them.
>

Web ARchive files (WAR files) are simply JAR files with a particular
organization that is described in the Servlet API Specification, version 2.2
(downloadable at <http://java.sun.com/products/servlet>).  You can create one
with the "jar" utility.

In Tomcat 3.1, there is an Application Developer's Guide that can give you a
head start on constructing new applications built with the Ant tool (the same
way that Tomcat is).  This will be in the final release of 3.1, but for now
the best way to get it is:

- Download the most recent nightly build of Tomcat from:

    http://jakarta.apache.org/builds/tomcat/nightly

- Unpack this file, and point your browser at the following
  file (within wherever you unpacked it):

    tomcat/doc/appdev/index.html


>
> Thanks in advance,Spencer
>

Craig McClanahan