You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Larry Isaacs <La...@sas.com> on 2001/12/13 14:16:16 UTC

RE: Servlet-Mapping/Url-Pattern not recognized - Please - help .. ..

I would focus first on getting http://myhost:8080/myApp/doHello
to work.  If it doesn't, http://www.myhost.com/myApp/doHello
isn't going to work either.

At this point it is usually good to check the log's to see
if there are any clues as to why the URL failed.  There is
usually more there than what you can get from the response
returned to the browser.  If necessary, add or increase the
debug="<level>" setting on various modules in the server.xml
to get more log output.  To see if the servlet mapping is
or isn't matching the URL, add debug="1" to <SimpleMapper1 />.

Cheers,
Larry

> -----Original Message-----
> From: Franciszek Michal Misa [mailto:fmisa@sympatico.ca]
> Sent: Thursday, December 13, 2001 5:22 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Servlet-Mapping/Url-Pattern not recognized - Please 
> - help ....
> 
> 
> Hi All,
> 
> I'm trying to:
>        - configure the older Tomcat3.3Final   (installed from Binary
> RPM)
>        - on a linux (RedHatv7.1) system
>        - running apache-1.3.22-1.7.1
> 
> Both Tomcat and apache are up and running - seem to be working - at
> least I can execute all the "sample" JSP pages and Servlets .....
> However, my attempts at configuring my own web application are not
> completely successful ??
> I've poured over all the documentation .... the key pieces of
> information seem to be spread out !!
> 
> I've installed my application into: (All permissions are open - world
> execute)
> /var/tomcat/webapps/myApp/ index.html
>                                                  WEB-INF/web.xml
> 
> classes/MyHelloWorld.class
> 
> I've configured all environment variables, and agent (mod_jk) property
> files etc.
> 
> BUT I can only execute my servlet using the following URLs:
> http://myhost:8080/myApp/servlet/MyHelloWorld
> OK
> http://www.myhost.com/myApp/servlet/MyHelloWorld                   OK
> 
> The following URLs do not work ???
> http://myhost:8080/myApp/doHello
> FAIL:Not Found (404)
> http://www.myhost.com/myApp/doHello
> FAIL:Not Found (404)
> 
> I think I'm a little confused with what can be configured in 
> httpd.conf
> vs. web.xml and uriworkermap.properties ........ vs. what's 
> picked-up by
> DEFAULT
> ?
> 
> Some configuration recipes would be GREATLY appreciated .....
> 
> Please help
> 
> Thanks
> 
> I've configured my web server and tomcat in the following way .......
> 
> 
> 
> 
> 
>  APACHE
> 
>  httpd.conf:
> 
>  LoadModule jk_module         modules/mod_jk.so
>  AddModule mod_jk.c
>  ....
>  ....
>  <IfModule mod_jk.c>
>   JkWorkersFile
>  /etc/tomcat/conf/jk/workers.properties
>   JkLogFile /var/log/httpd/mod_jk.log
>   JkLogLevel info
>  </IfModule>
> 
>  NameVirtualHost www.host.com
> 
>  # VirtualHost example:
>  # Almost any Apache directive may go into a
>  VirtualHost container.
>  #
>  <VirtualHost  www.host.com>
>      ServerAdmin xxx@xxx
>      DocumentRoot
>  /var/www/html/virtual/www.host.com
>      ServerName  www.host.com
>      ErrorLog logs/www.host.com-error_log
>      CustomLog logs/www.host.com-access_log
>  common
> 
>     <IfModule mod_jk.c>
>          Alias /myApp
>  "/var/tomcat/webapps/myApp"
>          <Directory "/var/tomcat/webapps/myApp">
> 
>                 Options Indexes FollowSymLinks
>          </Directory>
>          JkMount /myApp/* ajp12
>          JkMount /myApp/*.jsp ajp12
>          # <Location "/myApp/WEB-INF/">
>          #       AllowOverride None
>          #       deny from all
>          #</Location>
>    </IfModule>
> 
>  </VirtualHost>
> 
> 
> AGENT mod_jk.so
> 
> * I don't see WHY this should be required - but out of desperation -
> I've also added the following line to the mod_jk:
>  uriworkermap.properties
> 
> # Mount the examples context to the ajp12 worker
>  /myApp/*=ajp12
> 
> 
> 
> TOMCAT
> 
> * Configured tomcat.conf java home classpath etc.
> etc. etc.
> 
> * I figure I don't need an  apps-myApp.xml  under
> my tomcat/conf directory  - should be picked up by
> DEFAULT context path ?
> 
> web.xml  - Application deployment descriptor ....
> <?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>
>     <display-name>
>         My display name
>     </display-name>
>     <description>
>         Some description here
>     </description>
> 
>         <servlet>
>             <servlet-name>myHelloWorld</servlet-name>
>             <servlet-class>MyHelloWorld</servlet-class>
>         </servlet>
> 
>         <servlet-mapping>
>             <servlet-name>myHelloWorld</servlet-name>
>              <url-pattern>/doHello</url-pattern>
>          </servlet-mapping>
> </web-app>
> 
> 
> 
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
> 

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Servlet-Mapping/Url-Pattern not recognized - Please - help ....

Posted by Franciszek Michal Misa <fm...@sympatico.ca>.
Thanks Larry -
I never learn my lesson - the log files !!!!

An examination of the log files revealed the following error while trying
to parse my Deployment Descriptor:

> 2001-12-13 11:52:04 - Ctx(/franksTestApp) : Validating web.xml
> 2001-12-13 11:52:04 - Ctx(/franksTestApp) : web.xml: Error org.xml.sax.SAXParseException: Element "servlet" does not allow "servlet-mapping"
> here.
>

A close look at my web.xml revealed my DOCTYPE tag was slightly off:
I changed:
< DOCTYPE web-app
to:
<!DOCTYPE web-app

Restarted the server - and now both URLs WORK :)) - no parsing error ....
http://myhost:8080/myApp/doHello                              OK
http://www.myhost.com/myApp/doHello                       OK

Thanks Larry .......
Also ..... Thanks Andy for replying too .....

Cheers

Frank


I really appreciate the help ........

Larry Isaacs wrote:

> I would focus first on getting http://myhost:8080/myApp/doHello
> to work.  If it doesn't, http://www.myhost.com/myApp/doHello
> isn't going to work either.
>
> At this point it is usually good to check the log's to see
> if there are any clues as to why the URL failed.  There is
> usually more there than what you can get from the response
> returned to the browser.  If necessary, add or increase the
> debug="<level>" setting on various modules in the server.xml
> to get more log output.  To see if the servlet mapping is
> or isn't matching the URL, add debug="1" to <SimpleMapper1 />.
>
> Cheers,
> Larry
>
> > -----Original Message-----
> > From: Franciszek Michal Misa [mailto:fmisa@sympatico.ca]
> > Sent: Thursday, December 13, 2001 5:22 AM
> > To: tomcat-user@jakarta.apache.org
> > Subject: Servlet-Mapping/Url-Pattern not recognized - Please
> > - help ....
> >
> >
> > Hi All,
> >
> > I'm trying to:
> >        - configure the older Tomcat3.3Final   (installed from Binary
> > RPM)
> >        - on a linux (RedHatv7.1) system
> >        - running apache-1.3.22-1.7.1
> >
> > Both Tomcat and apache are up and running - seem to be working - at
> > least I can execute all the "sample" JSP pages and Servlets .....
> > However, my attempts at configuring my own web application are not
> > completely successful ??
> > I've poured over all the documentation .... the key pieces of
> > information seem to be spread out !!
> >
> > I've installed my application into: (All permissions are open - world
> > execute)
> > /var/tomcat/webapps/myApp/ index.html
> >                                                  WEB-INF/web.xml
> >
> > classes/MyHelloWorld.class
> >
> > I've configured all environment variables, and agent (mod_jk) property
> > files etc.
> >
> > BUT I can only execute my servlet using the following URLs:
> > http://myhost:8080/myApp/servlet/MyHelloWorld
> > OK
> > http://www.myhost.com/myApp/servlet/MyHelloWorld                   OK
> >
> > The following URLs do not work ???
> > http://myhost:8080/myApp/doHello
> > FAIL:Not Found (404)
> > http://www.myhost.com/myApp/doHello
> > FAIL:Not Found (404)
> >
> > I think I'm a little confused with what can be configured in
> > httpd.conf
> > vs. web.xml and uriworkermap.properties ........ vs. what's
> > picked-up by
> > DEFAULT
> > ?
> >
> > Some configuration recipes would be GREATLY appreciated .....
> >
> > Please help
> >
> > Thanks
> >
> > I've configured my web server and tomcat in the following way .......
> >
> >
> >
> >
> >
> >  APACHE
> >
> >  httpd.conf:
> >
> >  LoadModule jk_module         modules/mod_jk.so
> >  AddModule mod_jk.c
> >  ....
> >  ....
> >  <IfModule mod_jk.c>
> >   JkWorkersFile
> >  /etc/tomcat/conf/jk/workers.properties
> >   JkLogFile /var/log/httpd/mod_jk.log
> >   JkLogLevel info
> >  </IfModule>
> >
> >  NameVirtualHost www.host.com
> >
> >  # VirtualHost example:
> >  # Almost any Apache directive may go into a
> >  VirtualHost container.
> >  #
> >  <VirtualHost  www.host.com>
> >      ServerAdmin xxx@xxx
> >      DocumentRoot
> >  /var/www/html/virtual/www.host.com
> >      ServerName  www.host.com
> >      ErrorLog logs/www.host.com-error_log
> >      CustomLog logs/www.host.com-access_log
> >  common
> >
> >     <IfModule mod_jk.c>
> >          Alias /myApp
> >  "/var/tomcat/webapps/myApp"
> >          <Directory "/var/tomcat/webapps/myApp">
> >
> >                 Options Indexes FollowSymLinks
> >          </Directory>
> >          JkMount /myApp/* ajp12
> >          JkMount /myApp/*.jsp ajp12
> >          # <Location "/myApp/WEB-INF/">
> >          #       AllowOverride None
> >          #       deny from all
> >          #</Location>
> >    </IfModule>
> >
> >  </VirtualHost>
> >
> >
> > AGENT mod_jk.so
> >
> > * I don't see WHY this should be required - but out of desperation -
> > I've also added the following line to the mod_jk:
> >  uriworkermap.properties
> >
> > # Mount the examples context to the ajp12 worker
> >  /myApp/*=ajp12
> >
> >
> >
> > TOMCAT
> >
> > * Configured tomcat.conf java home classpath etc.
> > etc. etc.
> >
> > * I figure I don't need an  apps-myApp.xml  under
> > my tomcat/conf directory  - should be picked up by
> > DEFAULT context path ?
> >
> > web.xml  - Application deployment descriptor ....
> > <?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>
> >     <display-name>
> >         My display name
> >     </display-name>
> >     <description>
> >         Some description here
> >     </description>
> >
> >         <servlet>
> >             <servlet-name>myHelloWorld</servlet-name>
> >             <servlet-class>MyHelloWorld</servlet-class>
> >         </servlet>
> >
> >         <servlet-mapping>
> >             <servlet-name>myHelloWorld</servlet-name>
> >              <url-pattern>/doHello</url-pattern>
> >          </servlet-mapping>
> > </web-app>
> >
> >
> >
> > --
> > To unsubscribe:   <ma...@jakarta.apache.org>
> > For additional commands: <ma...@jakarta.apache.org>
> > Troubles with the list: <ma...@jakarta.apache.org>
> >
>
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>