You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bo Xu <bo...@cybershop.ca> on 2001/09/10 00:11:11 UTC

Re: newbe: class directory question

THEchad@smallerworld.net wrote:

> Hi everyone,
>
> I have a question about the directory structure, or maybe a question about
> servlets themselves; I'm not sure yet.
>
> 1) Does every class file that I'm going to be using have to be in the
> WEB-INF\classes directory while using Tomcat?
> 2) Do all JSP/Servlet servers/containers have this directory?
>
> THE chad

only for your first question :-)

* class can be put in:
    - WEB-INF/classes
          or
    - $CATALINA_HOME/classes
          or
    - $CATALINA_HOME/common/classes


* jar can be put in:
    - WEB-INF/lib
         or
    - $CATALINA_HOME/lib
          or
    - $CATALINA_HOME/common/lib


good email for you :-)

//*************************************************************
[...]
* $CATALINA_HOME/common/lib - Visible to *both* Catalina internal classes
  and to web applications.  The JDBC optional package JAR needed to go
  here.

* $CATALINA_HOME/server/lib - Visible to Catalina internal classes (your
  own custom realms, the JDBC driver used by JDBCRealm, and so on).

* $CATALINA_HOME/lib - Visible to web apps only

In the particular case of the SOAP 2.2 stuff (or JAXM, or lots of other
applicaiton only things), Catalina internal classes don't get involved, so
you can put mail.jar and activation.jar into $CATALINA_HOME/lib.

>
> Zhongwu
>

Craig
//*************************************************************


Bo
Sept.09, 2001




Problem in setting up tomcat

Posted by Ketan Patel <ke...@yahoo.com>.
Hi all,
I have windows'98 machine. I am trying to install tomcat in this
machine.
I had set JAVA_HOME and TOMCAT_HOME.
when i start startup.bat then after adding context of all the projects
like test, examples, admin etc... it gives me following error and it
shut out.
This error i can not trace out that for what reason this comes.

FATAL:java.net.SocketException: Option unsupported by protocol: create
java.net.SocketException: Option unsupported by protocol: create
        at java.net.PlainSocketImpl.socketCreate(Native Method)
        at java.net.PlainSocketImpl.create(PlainSocketImpl.java:70)
        at java.net.ServerSocket.<init>(ServerSocket.java:169)
        at java.net.ServerSocket.<init>(ServerSocket.java:124)
        at
org.apache.tomcat.net.DefaultServerSocketFactory.createSocket(Default
ServerSocketFactory.java:97)
        at
org.apache.tomcat.service.PoolTcpEndpoint.startEndpoint(PoolTcpEndpoi
nt.java:239)
        at org.apache.tomcat.service.PoolTcpConnector.start(Compiled
Code)
        at org.apache.tomcat.core.ContextManager.start(Compiled Code)
        at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:202)
        at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235)

I need to overcome it badly.
Thanks for your helpful help.
-Ketan

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: newbe: class directory question

Posted by Charles Webber <ch...@earthlink.net>.
Oh, and one other piece of information.  If I change the URL manually, so
that I say http://localhost/book/servlet/coreservlets.ShowParameters, the
servlet appears to display stuff properly, even though it doesn't have
values from the html form passed through.
What I am hoping to get is the answer on where I should place my servlets,
and how to configure Tomcat so that I can simply use
http://localhost/book/coreservlets.ShowParameters and get the same output.
Hope this helps.

----- Original Message -----
From: "Charles Webber" <ch...@earthlink.net>
To: <to...@jakarta.apache.org>
Sent: Monday, September 10, 2001 12:02 PM
Subject: Re: newbe: class directory question


> OK - let me try to make this as clear as possible.
> Other than the information I provided below, here is what happens.
> HTML page says:  <FORM ACTION="coreservlets.ShowParameters".  This HTML
form
> is in $TOMCAT_HOME/webapps/book.
> So, when the URL says http://localhost/book/form.html, I get the form with
> no problem, as Apache knows where this is located.  However, when I click
on
> the 'Submit' button, I get the 404.  Right now the servlet is located in
> $TOMCAT_HOME/webapps/book/coreservlets/.  Isn't that the right place?
> Thanks.
>
> ----- Original Message -----
> From: "Craig R. McClanahan" <cr...@apache.org>
> To: <to...@jakarta.apache.org>
> Sent: Sunday, September 09, 2001 9:20 PM
> Subject: Re: newbe: class directory question
>
>
> >
> >
> > On Sun, 9 Sep 2001, Charles Webber wrote:
> >
> > > Date: Sun, 9 Sep 2001 20:58:00 -0700
> > > From: Charles Webber <ch...@earthlink.net>
> > > Reply-To: tomcat-user@jakarta.apache.org
> > > To: tomcat-user@jakarta.apache.org
> > > Subject: Re: newbe: class directory question
> > >
> > > Thanks Craig - here is some more detailed info:
> > > web.xml file does contain a <servlet-mapping> section.  The name of
the
> > > servlet is ShowParameters, which is part of a package called
> coreservlets.
> > > The web.xml file contains the following:
> > > <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app
> > >     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
> > >     "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
> > > <web-app>
> > >   <servlet>
> > >     <servlet-name>ShowParameters</servlet-name>
> > >     <servlet-class>coreservlets.ShowParameters</servlet-class>
> > >   </servlet>
> > >   <servlet-mapping>
> > >     <servlet-name>ShowParameters</servlet-name>
> > >     <url-pattern>/book</url-pattern>
> > > </web-app>
> > >
> > > The server.xml file contains the following in the context section:
> > >  <Context path="/book"
> > >                  docBase="webapps/book"
> > >                  crossContext="false"
> > >                  debug="0"
> > >                  reloadable="true" >
> > >         </Context>
> > >
> > > My HTML file contains a form, and the action is
> > > "/book/coreservlets.ShowParameters".
> > >
> > > However, the submit button doesn't point Tomcat to the correct place,
as
> the
> > > servlet isn't found.
> > > Any suggestions?  Any other questions?
> > > Thanks
> > >
> >
> > Since you *still* didn't say what URL you were trying to submit to :-),
I
> > will make an assumption.
> >
> > The correct URL for the "book" servlet would be:
> >
> >   http://localhost:8080/book/book
> >
> > because you're using "/book" both as the context path *and* as the
servlet
> > path.  URL patterns in <servlet-mapping> entries are relative to the
> > context path of the web application, not from the base of th server.
> >
> > See the servlet spec for more information.
> >
> > Craig
> >
> >
> > > ----- Original Message -----
> > > From: "Craig R. McClanahan" <cr...@apache.org>
> > > To: <to...@jakarta.apache.org>
> > > Sent: Sunday, September 09, 2001 5:31 PM
> > > Subject: Re: newbe: class directory question
> > >
> > >
> > > >
> > > >
> > > > On Sun, 9 Sep 2001, Charles Webber wrote:
> > > >
> > > > > Date: Sun, 9 Sep 2001 17:30:28 -0700
> > > > > From: Charles Webber <ch...@earthlink.net>
> > > > > Reply-To: tomcat-user@jakarta.apache.org
> > > > > To: tomcat-user@jakarta.apache.org
> > > > > Subject: Re: newbe: class directory question
> > > > >
> > > > > Ok - I have basically the same question when it comes to Servlets.
> I've
> > > > > created the proper directory structure for a new web application
> under
> > > > > $TOMCAT_HOME/webapps, placed a new context in server.xml,
> > > >
> > > > You don't actually have to do this, if the directory is under
> "webapps" --
> > > > Tomcat will recognize it automatically.
> > > >
> > > > > and created a
> > > > > web.xml file pointing to the servlet class, but still I can't find
> it
> > > > > without using /servlet/ as part of my URL.  How come?
> > > > >
> > > >
> > > > Have you got a <servlet-mapping> in your /WEB-INF/web.xml file?
> > > >
> > > > The only way to solve problems like this is details - please post
the
> > > > directory structure and its contents, the contents of the web.xml
> file,
> > > > and the URL you are trying.  Otherwise, there's no hope of helping
you
> > > > figure out where you haven't got things quite right.
> > > >
> > > > Craig
> > > >
> > > >
> > > > > ----- Original Message -----
> > > > > From: "Craig R. McClanahan" <cr...@apache.org>
> > > > > To: <to...@jakarta.apache.org>
> > > > > Sent: Sunday, September 09, 2001 3:21 PM
> > > > > Subject: Re: newbe: class directory question
> > > > >
> > > > >
> > > > > >
> > > > > >
> > > > > > On Sun, 9 Sep 2001, Bo Xu wrote:
> > > > > >
> > > > > > > Date: Sun, 09 Sep 2001 18:11:11 -0400
> > > > > > > From: Bo Xu <bo...@cybershop.ca>
> > > > > > > Reply-To: tomcat-user@jakarta.apache.org
> > > > > > > To: tomcat-user@jakarta.apache.org
> > > > > > > Subject: Re: newbe: class directory question
> > > > > > >
> > > > > > > THEchad@smallerworld.net wrote:
> > > > > > >
> > > > > > > > Hi everyone,
> > > > > > > >
> > > > > > > > I have a question about the directory structure, or maybe a
> > > question
> > > > > about
> > > > > > > > servlets themselves; I'm not sure yet.
> > > > > > > >
> > > > > > > > 1) Does every class file that I'm going to be using have to
be
> in
> > > the
> > > > > > > > WEB-INF\classes directory while using Tomcat?
> > > > > > > > 2) Do all JSP/Servlet servers/containers have this
directory?
> > > > > > > >
> > > > > > > > THE chad
> > > > > > >
> > > > > > > only for your first question :-)
> > > > > > >
> > > > > > > * class can be put in:
> > > > > > >     - WEB-INF/classes
> > > > > > >           or
> > > > > > >     - $CATALINA_HOME/classes
> > > > > > >           or
> > > > > > >     - $CATALINA_HOME/common/classes
> > > > > > >
> > > > > > >
> > > > > > > * jar can be put in:
> > > > > > >     - WEB-INF/lib
> > > > > > >          or
> > > > > > >     - $CATALINA_HOME/lib
> > > > > > >           or
> > > > > > >     - $CATALINA_HOME/common/lib
> > > > > > >
> > > > > > >
> > > > > > > good email for you :-)
> > > > > > >
> > > > > >
> > > > > > Just a caution, related to your second question.
> > > > > >
> > > > > > All servlet containers supporting the Servlet 2.2 or 2.3 specs
do
> > > indeed
> > > > > > support unpacked classes in WEB-INF/classes, or JAR'd classes in
> > > > > > WEB-INF/lib.  This is defined in the servlet specification,
which
> can
> > > be
> > > > > > downloaded from:
> > > > > >
> > > > > >   http://java.sun.com/products/servlet/download.html
> > > > > >
> > > > > > and makes useful reading in order to understand what is portable
> and
> > > what
> > > > > > is not.
> > > > > >
> > > > > > Most containers provide mechanisms to make classes available to
> all
> > > web
> > > > > > applications, but this is *not* standardized, or even guaranteed
> to be
> > > > > > available.
> > > > > >
> > > > > > Craig
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> >
>


Re: newbe: class directory question

Posted by Charles Webber <ch...@earthlink.net>.
OK - let me try to make this as clear as possible.
Other than the information I provided below, here is what happens.
HTML page says:  <FORM ACTION="coreservlets.ShowParameters".  This HTML form
is in $TOMCAT_HOME/webapps/book.
So, when the URL says http://localhost/book/form.html, I get the form with
no problem, as Apache knows where this is located.  However, when I click on
the 'Submit' button, I get the 404.  Right now the servlet is located in
$TOMCAT_HOME/webapps/book/coreservlets/.  Isn't that the right place?
Thanks.

----- Original Message -----
From: "Craig R. McClanahan" <cr...@apache.org>
To: <to...@jakarta.apache.org>
Sent: Sunday, September 09, 2001 9:20 PM
Subject: Re: newbe: class directory question


>
>
> On Sun, 9 Sep 2001, Charles Webber wrote:
>
> > Date: Sun, 9 Sep 2001 20:58:00 -0700
> > From: Charles Webber <ch...@earthlink.net>
> > Reply-To: tomcat-user@jakarta.apache.org
> > To: tomcat-user@jakarta.apache.org
> > Subject: Re: newbe: class directory question
> >
> > Thanks Craig - here is some more detailed info:
> > web.xml file does contain a <servlet-mapping> section.  The name of the
> > servlet is ShowParameters, which is part of a package called
coreservlets.
> > The web.xml file contains the following:
> > <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app
> >     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
> >     "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
> > <web-app>
> >   <servlet>
> >     <servlet-name>ShowParameters</servlet-name>
> >     <servlet-class>coreservlets.ShowParameters</servlet-class>
> >   </servlet>
> >   <servlet-mapping>
> >     <servlet-name>ShowParameters</servlet-name>
> >     <url-pattern>/book</url-pattern>
> > </web-app>
> >
> > The server.xml file contains the following in the context section:
> >  <Context path="/book"
> >                  docBase="webapps/book"
> >                  crossContext="false"
> >                  debug="0"
> >                  reloadable="true" >
> >         </Context>
> >
> > My HTML file contains a form, and the action is
> > "/book/coreservlets.ShowParameters".
> >
> > However, the submit button doesn't point Tomcat to the correct place, as
the
> > servlet isn't found.
> > Any suggestions?  Any other questions?
> > Thanks
> >
>
> Since you *still* didn't say what URL you were trying to submit to :-), I
> will make an assumption.
>
> The correct URL for the "book" servlet would be:
>
>   http://localhost:8080/book/book
>
> because you're using "/book" both as the context path *and* as the servlet
> path.  URL patterns in <servlet-mapping> entries are relative to the
> context path of the web application, not from the base of th server.
>
> See the servlet spec for more information.
>
> Craig
>
>
> > ----- Original Message -----
> > From: "Craig R. McClanahan" <cr...@apache.org>
> > To: <to...@jakarta.apache.org>
> > Sent: Sunday, September 09, 2001 5:31 PM
> > Subject: Re: newbe: class directory question
> >
> >
> > >
> > >
> > > On Sun, 9 Sep 2001, Charles Webber wrote:
> > >
> > > > Date: Sun, 9 Sep 2001 17:30:28 -0700
> > > > From: Charles Webber <ch...@earthlink.net>
> > > > Reply-To: tomcat-user@jakarta.apache.org
> > > > To: tomcat-user@jakarta.apache.org
> > > > Subject: Re: newbe: class directory question
> > > >
> > > > Ok - I have basically the same question when it comes to Servlets.
I've
> > > > created the proper directory structure for a new web application
under
> > > > $TOMCAT_HOME/webapps, placed a new context in server.xml,
> > >
> > > You don't actually have to do this, if the directory is under
"webapps" --
> > > Tomcat will recognize it automatically.
> > >
> > > > and created a
> > > > web.xml file pointing to the servlet class, but still I can't find
it
> > > > without using /servlet/ as part of my URL.  How come?
> > > >
> > >
> > > Have you got a <servlet-mapping> in your /WEB-INF/web.xml file?
> > >
> > > The only way to solve problems like this is details - please post the
> > > directory structure and its contents, the contents of the web.xml
file,
> > > and the URL you are trying.  Otherwise, there's no hope of helping you
> > > figure out where you haven't got things quite right.
> > >
> > > Craig
> > >
> > >
> > > > ----- Original Message -----
> > > > From: "Craig R. McClanahan" <cr...@apache.org>
> > > > To: <to...@jakarta.apache.org>
> > > > Sent: Sunday, September 09, 2001 3:21 PM
> > > > Subject: Re: newbe: class directory question
> > > >
> > > >
> > > > >
> > > > >
> > > > > On Sun, 9 Sep 2001, Bo Xu wrote:
> > > > >
> > > > > > Date: Sun, 09 Sep 2001 18:11:11 -0400
> > > > > > From: Bo Xu <bo...@cybershop.ca>
> > > > > > Reply-To: tomcat-user@jakarta.apache.org
> > > > > > To: tomcat-user@jakarta.apache.org
> > > > > > Subject: Re: newbe: class directory question
> > > > > >
> > > > > > THEchad@smallerworld.net wrote:
> > > > > >
> > > > > > > Hi everyone,
> > > > > > >
> > > > > > > I have a question about the directory structure, or maybe a
> > question
> > > > about
> > > > > > > servlets themselves; I'm not sure yet.
> > > > > > >
> > > > > > > 1) Does every class file that I'm going to be using have to be
in
> > the
> > > > > > > WEB-INF\classes directory while using Tomcat?
> > > > > > > 2) Do all JSP/Servlet servers/containers have this directory?
> > > > > > >
> > > > > > > THE chad
> > > > > >
> > > > > > only for your first question :-)
> > > > > >
> > > > > > * class can be put in:
> > > > > >     - WEB-INF/classes
> > > > > >           or
> > > > > >     - $CATALINA_HOME/classes
> > > > > >           or
> > > > > >     - $CATALINA_HOME/common/classes
> > > > > >
> > > > > >
> > > > > > * jar can be put in:
> > > > > >     - WEB-INF/lib
> > > > > >          or
> > > > > >     - $CATALINA_HOME/lib
> > > > > >           or
> > > > > >     - $CATALINA_HOME/common/lib
> > > > > >
> > > > > >
> > > > > > good email for you :-)
> > > > > >
> > > > >
> > > > > Just a caution, related to your second question.
> > > > >
> > > > > All servlet containers supporting the Servlet 2.2 or 2.3 specs do
> > indeed
> > > > > support unpacked classes in WEB-INF/classes, or JAR'd classes in
> > > > > WEB-INF/lib.  This is defined in the servlet specification, which
can
> > be
> > > > > downloaded from:
> > > > >
> > > > >   http://java.sun.com/products/servlet/download.html
> > > > >
> > > > > and makes useful reading in order to understand what is portable
and
> > what
> > > > > is not.
> > > > >
> > > > > Most containers provide mechanisms to make classes available to
all
> > web
> > > > > applications, but this is *not* standardized, or even guaranteed
to be
> > > > > available.
> > > > >
> > > > > Craig
> > > > >
> > > >
> > > >
> > >
> >
> >
>


Re: newbe: class directory question

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

On Sun, 9 Sep 2001, Charles Webber wrote:

> Date: Sun, 9 Sep 2001 20:58:00 -0700
> From: Charles Webber <ch...@earthlink.net>
> Reply-To: tomcat-user@jakarta.apache.org
> To: tomcat-user@jakarta.apache.org
> Subject: Re: newbe: class directory question
>
> Thanks Craig - here is some more detailed info:
> web.xml file does contain a <servlet-mapping> section.  The name of the
> servlet is ShowParameters, which is part of a package called coreservlets.
> The web.xml file contains the following:
> <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
>     "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
> <web-app>
>   <servlet>
>     <servlet-name>ShowParameters</servlet-name>
>     <servlet-class>coreservlets.ShowParameters</servlet-class>
>   </servlet>
>   <servlet-mapping>
>     <servlet-name>ShowParameters</servlet-name>
>     <url-pattern>/book</url-pattern>
> </web-app>
>
> The server.xml file contains the following in the context section:
>  <Context path="/book"
>                  docBase="webapps/book"
>                  crossContext="false"
>                  debug="0"
>                  reloadable="true" >
>         </Context>
>
> My HTML file contains a form, and the action is
> "/book/coreservlets.ShowParameters".
>
> However, the submit button doesn't point Tomcat to the correct place, as the
> servlet isn't found.
> Any suggestions?  Any other questions?
> Thanks
>

Since you *still* didn't say what URL you were trying to submit to :-), I
will make an assumption.

The correct URL for the "book" servlet would be:

  http://localhost:8080/book/book

because you're using "/book" both as the context path *and* as the servlet
path.  URL patterns in <servlet-mapping> entries are relative to the
context path of the web application, not from the base of th server.

See the servlet spec for more information.

Craig


> ----- Original Message -----
> From: "Craig R. McClanahan" <cr...@apache.org>
> To: <to...@jakarta.apache.org>
> Sent: Sunday, September 09, 2001 5:31 PM
> Subject: Re: newbe: class directory question
>
>
> >
> >
> > On Sun, 9 Sep 2001, Charles Webber wrote:
> >
> > > Date: Sun, 9 Sep 2001 17:30:28 -0700
> > > From: Charles Webber <ch...@earthlink.net>
> > > Reply-To: tomcat-user@jakarta.apache.org
> > > To: tomcat-user@jakarta.apache.org
> > > Subject: Re: newbe: class directory question
> > >
> > > Ok - I have basically the same question when it comes to Servlets.  I've
> > > created the proper directory structure for a new web application under
> > > $TOMCAT_HOME/webapps, placed a new context in server.xml,
> >
> > You don't actually have to do this, if the directory is under "webapps" --
> > Tomcat will recognize it automatically.
> >
> > > and created a
> > > web.xml file pointing to the servlet class, but still I can't find it
> > > without using /servlet/ as part of my URL.  How come?
> > >
> >
> > Have you got a <servlet-mapping> in your /WEB-INF/web.xml file?
> >
> > The only way to solve problems like this is details - please post the
> > directory structure and its contents, the contents of the web.xml file,
> > and the URL you are trying.  Otherwise, there's no hope of helping you
> > figure out where you haven't got things quite right.
> >
> > Craig
> >
> >
> > > ----- Original Message -----
> > > From: "Craig R. McClanahan" <cr...@apache.org>
> > > To: <to...@jakarta.apache.org>
> > > Sent: Sunday, September 09, 2001 3:21 PM
> > > Subject: Re: newbe: class directory question
> > >
> > >
> > > >
> > > >
> > > > On Sun, 9 Sep 2001, Bo Xu wrote:
> > > >
> > > > > Date: Sun, 09 Sep 2001 18:11:11 -0400
> > > > > From: Bo Xu <bo...@cybershop.ca>
> > > > > Reply-To: tomcat-user@jakarta.apache.org
> > > > > To: tomcat-user@jakarta.apache.org
> > > > > Subject: Re: newbe: class directory question
> > > > >
> > > > > THEchad@smallerworld.net wrote:
> > > > >
> > > > > > Hi everyone,
> > > > > >
> > > > > > I have a question about the directory structure, or maybe a
> question
> > > about
> > > > > > servlets themselves; I'm not sure yet.
> > > > > >
> > > > > > 1) Does every class file that I'm going to be using have to be in
> the
> > > > > > WEB-INF\classes directory while using Tomcat?
> > > > > > 2) Do all JSP/Servlet servers/containers have this directory?
> > > > > >
> > > > > > THE chad
> > > > >
> > > > > only for your first question :-)
> > > > >
> > > > > * class can be put in:
> > > > >     - WEB-INF/classes
> > > > >           or
> > > > >     - $CATALINA_HOME/classes
> > > > >           or
> > > > >     - $CATALINA_HOME/common/classes
> > > > >
> > > > >
> > > > > * jar can be put in:
> > > > >     - WEB-INF/lib
> > > > >          or
> > > > >     - $CATALINA_HOME/lib
> > > > >           or
> > > > >     - $CATALINA_HOME/common/lib
> > > > >
> > > > >
> > > > > good email for you :-)
> > > > >
> > > >
> > > > Just a caution, related to your second question.
> > > >
> > > > All servlet containers supporting the Servlet 2.2 or 2.3 specs do
> indeed
> > > > support unpacked classes in WEB-INF/classes, or JAR'd classes in
> > > > WEB-INF/lib.  This is defined in the servlet specification, which can
> be
> > > > downloaded from:
> > > >
> > > >   http://java.sun.com/products/servlet/download.html
> > > >
> > > > and makes useful reading in order to understand what is portable and
> what
> > > > is not.
> > > >
> > > > Most containers provide mechanisms to make classes available to all
> web
> > > > applications, but this is *not* standardized, or even guaranteed to be
> > > > available.
> > > >
> > > > Craig
> > > >
> > >
> > >
> >
>
>


Re: newbe: class directory question

Posted by Charles Webber <ch...@earthlink.net>.
Thanks Craig - here is some more detailed info:
web.xml file does contain a <servlet-mapping> section.  The name of the
servlet is ShowParameters, which is part of a package called coreservlets.
The web.xml file contains the following:
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
  <servlet>
    <servlet-name>ShowParameters</servlet-name>
    <servlet-class>coreservlets.ShowParameters</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ShowParameters</servlet-name>
    <url-pattern>/book</url-pattern>
</web-app>

The server.xml file contains the following in the context section:
 <Context path="/book"
                 docBase="webapps/book"
                 crossContext="false"
                 debug="0"
                 reloadable="true" >
        </Context>

My HTML file contains a form, and the action is
"/book/coreservlets.ShowParameters".

However, the submit button doesn't point Tomcat to the correct place, as the
servlet isn't found.
Any suggestions?  Any other questions?
Thanks

----- Original Message -----
From: "Craig R. McClanahan" <cr...@apache.org>
To: <to...@jakarta.apache.org>
Sent: Sunday, September 09, 2001 5:31 PM
Subject: Re: newbe: class directory question


>
>
> On Sun, 9 Sep 2001, Charles Webber wrote:
>
> > Date: Sun, 9 Sep 2001 17:30:28 -0700
> > From: Charles Webber <ch...@earthlink.net>
> > Reply-To: tomcat-user@jakarta.apache.org
> > To: tomcat-user@jakarta.apache.org
> > Subject: Re: newbe: class directory question
> >
> > Ok - I have basically the same question when it comes to Servlets.  I've
> > created the proper directory structure for a new web application under
> > $TOMCAT_HOME/webapps, placed a new context in server.xml,
>
> You don't actually have to do this, if the directory is under "webapps" --
> Tomcat will recognize it automatically.
>
> > and created a
> > web.xml file pointing to the servlet class, but still I can't find it
> > without using /servlet/ as part of my URL.  How come?
> >
>
> Have you got a <servlet-mapping> in your /WEB-INF/web.xml file?
>
> The only way to solve problems like this is details - please post the
> directory structure and its contents, the contents of the web.xml file,
> and the URL you are trying.  Otherwise, there's no hope of helping you
> figure out where you haven't got things quite right.
>
> Craig
>
>
> > ----- Original Message -----
> > From: "Craig R. McClanahan" <cr...@apache.org>
> > To: <to...@jakarta.apache.org>
> > Sent: Sunday, September 09, 2001 3:21 PM
> > Subject: Re: newbe: class directory question
> >
> >
> > >
> > >
> > > On Sun, 9 Sep 2001, Bo Xu wrote:
> > >
> > > > Date: Sun, 09 Sep 2001 18:11:11 -0400
> > > > From: Bo Xu <bo...@cybershop.ca>
> > > > Reply-To: tomcat-user@jakarta.apache.org
> > > > To: tomcat-user@jakarta.apache.org
> > > > Subject: Re: newbe: class directory question
> > > >
> > > > THEchad@smallerworld.net wrote:
> > > >
> > > > > Hi everyone,
> > > > >
> > > > > I have a question about the directory structure, or maybe a
question
> > about
> > > > > servlets themselves; I'm not sure yet.
> > > > >
> > > > > 1) Does every class file that I'm going to be using have to be in
the
> > > > > WEB-INF\classes directory while using Tomcat?
> > > > > 2) Do all JSP/Servlet servers/containers have this directory?
> > > > >
> > > > > THE chad
> > > >
> > > > only for your first question :-)
> > > >
> > > > * class can be put in:
> > > >     - WEB-INF/classes
> > > >           or
> > > >     - $CATALINA_HOME/classes
> > > >           or
> > > >     - $CATALINA_HOME/common/classes
> > > >
> > > >
> > > > * jar can be put in:
> > > >     - WEB-INF/lib
> > > >          or
> > > >     - $CATALINA_HOME/lib
> > > >           or
> > > >     - $CATALINA_HOME/common/lib
> > > >
> > > >
> > > > good email for you :-)
> > > >
> > >
> > > Just a caution, related to your second question.
> > >
> > > All servlet containers supporting the Servlet 2.2 or 2.3 specs do
indeed
> > > support unpacked classes in WEB-INF/classes, or JAR'd classes in
> > > WEB-INF/lib.  This is defined in the servlet specification, which can
be
> > > downloaded from:
> > >
> > >   http://java.sun.com/products/servlet/download.html
> > >
> > > and makes useful reading in order to understand what is portable and
what
> > > is not.
> > >
> > > Most containers provide mechanisms to make classes available to all
web
> > > applications, but this is *not* standardized, or even guaranteed to be
> > > available.
> > >
> > > Craig
> > >
> >
> >
>


Re: newbe: class directory question

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

On Sun, 9 Sep 2001, Charles Webber wrote:

> Date: Sun, 9 Sep 2001 17:30:28 -0700
> From: Charles Webber <ch...@earthlink.net>
> Reply-To: tomcat-user@jakarta.apache.org
> To: tomcat-user@jakarta.apache.org
> Subject: Re: newbe: class directory question
>
> Ok - I have basically the same question when it comes to Servlets.  I've
> created the proper directory structure for a new web application under
> $TOMCAT_HOME/webapps, placed a new context in server.xml,

You don't actually have to do this, if the directory is under "webapps" --
Tomcat will recognize it automatically.

> and created a
> web.xml file pointing to the servlet class, but still I can't find it
> without using /servlet/ as part of my URL.  How come?
>

Have you got a <servlet-mapping> in your /WEB-INF/web.xml file?

The only way to solve problems like this is details - please post the
directory structure and its contents, the contents of the web.xml file,
and the URL you are trying.  Otherwise, there's no hope of helping you
figure out where you haven't got things quite right.

Craig


> ----- Original Message -----
> From: "Craig R. McClanahan" <cr...@apache.org>
> To: <to...@jakarta.apache.org>
> Sent: Sunday, September 09, 2001 3:21 PM
> Subject: Re: newbe: class directory question
>
>
> >
> >
> > On Sun, 9 Sep 2001, Bo Xu wrote:
> >
> > > Date: Sun, 09 Sep 2001 18:11:11 -0400
> > > From: Bo Xu <bo...@cybershop.ca>
> > > Reply-To: tomcat-user@jakarta.apache.org
> > > To: tomcat-user@jakarta.apache.org
> > > Subject: Re: newbe: class directory question
> > >
> > > THEchad@smallerworld.net wrote:
> > >
> > > > Hi everyone,
> > > >
> > > > I have a question about the directory structure, or maybe a question
> about
> > > > servlets themselves; I'm not sure yet.
> > > >
> > > > 1) Does every class file that I'm going to be using have to be in the
> > > > WEB-INF\classes directory while using Tomcat?
> > > > 2) Do all JSP/Servlet servers/containers have this directory?
> > > >
> > > > THE chad
> > >
> > > only for your first question :-)
> > >
> > > * class can be put in:
> > >     - WEB-INF/classes
> > >           or
> > >     - $CATALINA_HOME/classes
> > >           or
> > >     - $CATALINA_HOME/common/classes
> > >
> > >
> > > * jar can be put in:
> > >     - WEB-INF/lib
> > >          or
> > >     - $CATALINA_HOME/lib
> > >           or
> > >     - $CATALINA_HOME/common/lib
> > >
> > >
> > > good email for you :-)
> > >
> >
> > Just a caution, related to your second question.
> >
> > All servlet containers supporting the Servlet 2.2 or 2.3 specs do indeed
> > support unpacked classes in WEB-INF/classes, or JAR'd classes in
> > WEB-INF/lib.  This is defined in the servlet specification, which can be
> > downloaded from:
> >
> >   http://java.sun.com/products/servlet/download.html
> >
> > and makes useful reading in order to understand what is portable and what
> > is not.
> >
> > Most containers provide mechanisms to make classes available to all web
> > applications, but this is *not* standardized, or even guaranteed to be
> > available.
> >
> > Craig
> >
>
>


Re: newbe: class directory question

Posted by Charles Webber <ch...@earthlink.net>.
Ok - I have basically the same question when it comes to Servlets.  I've
created the proper directory structure for a new web application under
$TOMCAT_HOME/webapps, placed a new context in server.xml, and created a
web.xml file pointing to the servlet class, but still I can't find it
without using /servlet/ as part of my URL.  How come?

----- Original Message -----
From: "Craig R. McClanahan" <cr...@apache.org>
To: <to...@jakarta.apache.org>
Sent: Sunday, September 09, 2001 3:21 PM
Subject: Re: newbe: class directory question


>
>
> On Sun, 9 Sep 2001, Bo Xu wrote:
>
> > Date: Sun, 09 Sep 2001 18:11:11 -0400
> > From: Bo Xu <bo...@cybershop.ca>
> > Reply-To: tomcat-user@jakarta.apache.org
> > To: tomcat-user@jakarta.apache.org
> > Subject: Re: newbe: class directory question
> >
> > THEchad@smallerworld.net wrote:
> >
> > > Hi everyone,
> > >
> > > I have a question about the directory structure, or maybe a question
about
> > > servlets themselves; I'm not sure yet.
> > >
> > > 1) Does every class file that I'm going to be using have to be in the
> > > WEB-INF\classes directory while using Tomcat?
> > > 2) Do all JSP/Servlet servers/containers have this directory?
> > >
> > > THE chad
> >
> > only for your first question :-)
> >
> > * class can be put in:
> >     - WEB-INF/classes
> >           or
> >     - $CATALINA_HOME/classes
> >           or
> >     - $CATALINA_HOME/common/classes
> >
> >
> > * jar can be put in:
> >     - WEB-INF/lib
> >          or
> >     - $CATALINA_HOME/lib
> >           or
> >     - $CATALINA_HOME/common/lib
> >
> >
> > good email for you :-)
> >
>
> Just a caution, related to your second question.
>
> All servlet containers supporting the Servlet 2.2 or 2.3 specs do indeed
> support unpacked classes in WEB-INF/classes, or JAR'd classes in
> WEB-INF/lib.  This is defined in the servlet specification, which can be
> downloaded from:
>
>   http://java.sun.com/products/servlet/download.html
>
> and makes useful reading in order to understand what is portable and what
> is not.
>
> Most containers provide mechanisms to make classes available to all web
> applications, but this is *not* standardized, or even guaranteed to be
> available.
>
> Craig
>


Re: newbe: class directory question

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

On Sun, 9 Sep 2001, Bo Xu wrote:

> Date: Sun, 09 Sep 2001 18:11:11 -0400
> From: Bo Xu <bo...@cybershop.ca>
> Reply-To: tomcat-user@jakarta.apache.org
> To: tomcat-user@jakarta.apache.org
> Subject: Re: newbe: class directory question
>
> THEchad@smallerworld.net wrote:
>
> > Hi everyone,
> >
> > I have a question about the directory structure, or maybe a question about
> > servlets themselves; I'm not sure yet.
> >
> > 1) Does every class file that I'm going to be using have to be in the
> > WEB-INF\classes directory while using Tomcat?
> > 2) Do all JSP/Servlet servers/containers have this directory?
> >
> > THE chad
>
> only for your first question :-)
>
> * class can be put in:
>     - WEB-INF/classes
>           or
>     - $CATALINA_HOME/classes
>           or
>     - $CATALINA_HOME/common/classes
>
>
> * jar can be put in:
>     - WEB-INF/lib
>          or
>     - $CATALINA_HOME/lib
>           or
>     - $CATALINA_HOME/common/lib
>
>
> good email for you :-)
>

Just a caution, related to your second question.

All servlet containers supporting the Servlet 2.2 or 2.3 specs do indeed
support unpacked classes in WEB-INF/classes, or JAR'd classes in
WEB-INF/lib.  This is defined in the servlet specification, which can be
downloaded from:

  http://java.sun.com/products/servlet/download.html

and makes useful reading in order to understand what is portable and what
is not.

Most containers provide mechanisms to make classes available to all web
applications, but this is *not* standardized, or even guaranteed to be
available.

Craig