tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raj Alexander <ralexan...@decisionsys.com>
Subject RE: New webapp problem
Date Wed, 26 Apr 2000 18:49:16 GMT
Craig, I was going off your last response in removing the web.xml from the
..webapps/myapp/WEB-INF or do I still need on there?

-----Original Message-----
From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
Sent: Wednesday, April 26, 2000 1:42 PM
To: tomcat-user@jakarta.apache.org
Subject: Re: New webapp problem


Raj Alexander wrote:

> Craig, Thanks for the help. I did have it in lower case in the context
path
> I just copied it incorrectly in the email message. I removed the web.xml
and
> restarted the web server. Unfortunately, it's still not working when I use
> "http://mysystem.com:8080/myapp/servlet/myservlet". I noticed that in the
> tomcat.log the following message:
> "Context log: path="/myapp" File not found
> /xa10a/ssdtest/tomcat/jakarta-tomcat/webapps/myapp/WEB-INF/web.xml, using
> only defaults"
> Is this okay? Is there anything else that I'm missing.
>

No that's not OK.  That means that Tomcat did not find, or could not read, a
web.xml file for your web application at the path indicated.  Therefore, it
only
defined the default mappings found in $TOMCAT_HOME/conf/web.xml for you.

Are you sure you've got your web.xml file at this path?  Are you sure that
OS
permissions make it possible for Tomcat to read that file, as well as access
all
the directories above it?

>
> Thanks for help.
> Raj Alexander
>

Craig McClanahan


>
> -----Original Message-----
> From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
> Sent: Wednesday, April 26, 2000 10:22 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Re: New webapp problem
>
> Raj Alexander wrote:
>
> > Hello,
> > I'm having a problem setting up a new webapp. The servlet works fine in
> the
> > example webapp directory but for some reason it doesn't work in the
> > /myapp/WEB-INF/classes directory. I updated server.xml with the new
> context
> > and I also set it up using the admin tool. I created a new web.xml with
> > following info.
> >
> > <?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-mapping>
> >    <servlet-name>invoker</servlet-name>
> >     <url-pattern>/myapp/*</url-pattern>
> >    </servlet-mapping>
> > </web-app>
> >
>
> You probably don't want to do this, because you telling the path "/myapp"
to
> act
> just like "/servlet" does -- call the invoker servlet.
>
> >
> > I should be able to access the servlet using
> > "http://mysystem.com:8080/myapp/servlet/myservlet". I'm getting the
> > following error "Error:404 Location:/myapp/servlet/myservlet". My
> server.xml
> > is setup with the following context.
> >
> >         <!-- Myapp -->
> >         <Context path="/Myapp" docBase="webapps/Myapp"
> > defaultSessionTimeOut="30" isWARExpanded="true" isWARValidated="false"
> > isInvokerEnabled="true" isWorkDirPersistent="false"  debug="0"
> > reloadable="true" >
> >         </Context>
>
> First issue -- URLs are case sensitive.  You should correct the context
path
> to
> "/myapp".
>
> Second issue -- to make this URL work, you don't need any web.xml entries
at
> all
> -- the only thing you need to do is ensure that your servlet is in a file
> named
> "myservlet.class" in the WEB-INF/classes directory (or in a JAR file under
> WEB-INF/lib).
>
> URL mapping is for cases where you want to name your servlet something
> *other*
> than "/servlet/xxx".  For example, let's say you wanted to use a URL like
> this:
>
>     http://mysystem.com:8080/myapp/myservlet
>
> (i.e. without the "/servlet" part).  You would put entries like this in
> web.xml:
>
>     <servlet>
>         <servlet-name>MyServletName</servlet-name>
>         <servlet-class>com.mysystem.mypackage.MyServlet</servlet-class>
> // Or
> whatever your Java class name is
>     </servlet>
>
>     <servlet-mapping>
>         <servlet-name>MyServletName</servlet-name>
>         </url-pattern>/myservlet</url-pattern>
>     </servlet-mapping>
>
> Note that the servlet name is never visible -- it is just a link between
the
> servlet class and the URL pattern(s) that call it.
>
> Note also that the URL doesn't have to have anything to do with the Java
> class
> name.  You can use any legal URL pattern that you like, and no one can
even
> tell
> that you're invoking a servlet.
>
> Hope that helps.
>
> >
> > Thanks in advance.
> > Raj Alexander
> >
>
> Craig McClanahan
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org


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

Mime
View raw message