You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ron Forrester <rj...@zero-ping.com> on 2000/03/20 03:22:22 UTC

servlet confusion...

I have from from JServ over to tomcat this afternoon.

First, I really enjoyed the installation process, having suffered
through JServ+gnujsp installations.

One thing has me quite confused however -- all of the example servlets
with tomcat are embedded in HTML files. I am used to seeing servlets
in .class files. Is this no longer supported? I copied a
blah.{java,class} file into the example servlets dir and it just
treats it like a generic file.

Do I need to wrap all my servlets in container/launcher HTML files
like the examples are?

Thanks.
rjf&


Re: servlet confusion...

Posted by Kyle Cordes <Ky...@kylecordes.com>.
The 3.1 has a bug where it doesn't load JARs out of the lib directory,
by the way.  There is a source patch in the bug database, or you can
just use the .class files instead.


----- Original Message -----
From: "Craig R. McClanahan" <cm...@mytownnet.com>
To: <to...@jakarta.apache.org>
Sent: Sunday, March 19, 2000 8:28 PM
Subject: Re: servlet confusion...


> Ron Forrester wrote:
>
> > I have from from JServ over to tomcat this afternoon.
> >
> > First, I really enjoyed the installation process, having suffered
> > through JServ+gnujsp installations.
> >
> > One thing has me quite confused however -- all of the example
servlets
> > with tomcat are embedded in HTML files.
>
> This was done only to let you look at the source code -- servlets must
be
> Java class files, or packaged in a JAR file, to be executed.
>
> > I am used to seeing servlets
> > in .class files. Is this no longer supported? I copied a
> > blah.{java,class} file into the example servlets dir and it just
> > treats it like a generic file.
> >
> > Do I need to wrap all my servlets in container/launcher HTML files
> > like the examples are?
> >
>
> No.
>
> Put your servlet classes in the WEB-INF/classes directory (or in a JAR
file
> in the WEB-INF/lib directory) of your web application.  These places
are
> automatically added to the class path for your app -- no additional
> manipulation of the class path is required.  Set up the web
application
> deployment descriptor (WEB-INF/web.xml) as described in the Servlet
2.2
> specification.
>
>
> >
> > Thanks.
> > rjf&
> >
>
> Craig McClanahan
>
>
>
> ----------------------------------------------------------------------
----
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org
>
>


Re: servlet confusion...

Posted by Mike Grady <ms...@majure.com>.
From: Ron Forrester <rj...@zero-ping.com>
> Okay, so I took the IsItWorking.java example from the JServ dist,
> compiled it against the tomcat libs (i.e. servlet.jar), and copied the
> .java and .class files into WEB-INF/classes.
> 
> All other configuration is the same, canned, tomcat-apache defaults:
> 
> My question is, how do I run the IsItWorking servlet?
> 
> I tried various URL's and always got a file not found.

I believe the URL you have to use is <web-app>/servlet/<servlet-name>/.
So if you put your test servlet under the "examples" directory, you
would have to use ".../examples/servlet/IsItWorking/".

> I am currently reading the 2.2 spec to see if there is something
> specific I need to change in the web.xml.
> 

You also need to update the web.xml file under the 
examples/WEB-INF directory in order to access this servlet.
Adding code like this should do the trick...
  
 <servlet>
      <servlet-name>
          IsItWorking
      </servlet-name>
      <servlet-class>
          IsItWorking
      </servlet-class>
    </servlet>


-Mike



Re: servlet confusion...

Posted by Ron Forrester <rj...@zero-ping.com>.
On Sun, Mar 19, 2000 at 06:28:54PM -0800, Craig R. McClanahan wrote:
> Put your servlet classes in the WEB-INF/classes directory (or in a JAR file
> in the WEB-INF/lib directory) of your web application.  These places are
> automatically added to the class path for your app -- no additional
> manipulation of the class path is required.  Set up the web application
> deployment descriptor (WEB-INF/web.xml) as described in the Servlet 2.2
> specification.

Okay, so I took the IsItWorking.java example from the JServ dist,
compiled it against the tomcat libs (i.e. servlet.jar), and copied the
.java and .class files into WEB-INF/classes.

All other configuration is the same, canned, tomcat-apache defaults:

My question is, how do I run the IsItWorking servlet?

I tried various URL's and always got a file not found.

I am currently reading the 2.2 spec to see if there is something
specific I need to change in the web.xml.

Any other tips are much appreciated!
Thanks.
rjf&


Re: tomcat & JServ config

Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Brad K wrote:
> 
> I am trying to setup tomcat under Apache 1.3 and am getting a little lost on
> the configuration. I have JServ running currently. Does this replace JServ?
> Can someone orient me on this.

Try the draft user's guide,

<http://jakarta.apache.org/cvsweb/index.cgi/jakarta-tomcat/src/doc/uguide/>

Hans
-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com

tomcat & JServ config

Posted by Brad K <ko...@aa.net>.
I am trying to setup tomcat under Apache 1.3 and am getting a little lost on
the configuration. I have JServ running currently. Does this replace JServ?
Can someone orient me on this.

thanks

Brad Koehler

-----Original Message-----
From: cmcclanahan@easystreet.com [mailto:cmcclanahan@easystreet.com]On
Behalf Of Craig R. McClanahan
Sent: Sunday, March 19, 2000 6:29 PM
To: tomcat-user@jakarta.apache.org
Subject: Re: servlet confusion...


Ron Forrester wrote:

> I have from from JServ over to tomcat this afternoon.
>
> First, I really enjoyed the installation process, having suffered
> through JServ+gnujsp installations.
>
> One thing has me quite confused however -- all of the example servlets
> with tomcat are embedded in HTML files.

This was done only to let you look at the source code -- servlets must be
Java class files, or packaged in a JAR file, to be executed.

> I am used to seeing servlets
> in .class files. Is this no longer supported? I copied a
> blah.{java,class} file into the example servlets dir and it just
> treats it like a generic file.
>
> Do I need to wrap all my servlets in container/launcher HTML files
> like the examples are?
>

No.

Put your servlet classes in the WEB-INF/classes directory (or in a JAR file
in the WEB-INF/lib directory) of your web application.  These places are
automatically added to the class path for your app -- no additional
manipulation of the class path is required.  Set up the web application
deployment descriptor (WEB-INF/web.xml) as described in the Servlet 2.2
specification.


>
> Thanks.
> rjf&
>

Craig McClanahan



--------------------------------------------------------------------------
To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
For additional commmands, email: tomcat-user-help@jakarta.apache.org


Re: servlet confusion...

Posted by "Craig R. McClanahan" <cm...@mytownnet.com>.
Ron Forrester wrote:

> I have from from JServ over to tomcat this afternoon.
>
> First, I really enjoyed the installation process, having suffered
> through JServ+gnujsp installations.
>
> One thing has me quite confused however -- all of the example servlets
> with tomcat are embedded in HTML files.

This was done only to let you look at the source code -- servlets must be
Java class files, or packaged in a JAR file, to be executed.

> I am used to seeing servlets
> in .class files. Is this no longer supported? I copied a
> blah.{java,class} file into the example servlets dir and it just
> treats it like a generic file.
>
> Do I need to wrap all my servlets in container/launcher HTML files
> like the examples are?
>

No.

Put your servlet classes in the WEB-INF/classes directory (or in a JAR file
in the WEB-INF/lib directory) of your web application.  These places are
automatically added to the class path for your app -- no additional
manipulation of the class path is required.  Set up the web application
deployment descriptor (WEB-INF/web.xml) as described in the Servlet 2.2
specification.


>
> Thanks.
> rjf&
>

Craig McClanahan