You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by mike niemaz <ni...@xrce.xerox.com> on 2000/08/31 12:26:18 UTC
tomcat won't find my servlets ;-(((
Hi all,
I'm trying to implement the famous MVC2 controller
based on a simple jsp & servlets files.
It worked fine until I decided to enhance my servlet
& especially until I included it in a new package.
Tomcat do not find the class anymore ;-(((
No matter what path I use or what ApJServMount I
specify in tomcat.conf, it keeps telling me
it can't find the class ....
My servlet CDController is located in myapp/WEB-INF/classes/test/
My jsp which invoke this servlet is at myapp/jsp/ & looks like this:
<%@ page session="true"%>
<html>
<head>
<title>test</title>
</head>
<body bgcolor="#33CCFF">
<font face="Times New Roman,Times" size="+3">
MVC2 application test
</font>
<hr><p>
<center>
<form name="MVCForm"
action="../servlet/CDController"
method="POST">
<b>CD:</b>
<select name=CD>
<option>Yuan | The Guo Brothers</option>
<option>Ibuki | Kodo</option>
</select>
<input type="hidden" name="action"
value="put">
<input type="submit" name="Submit" value="Add
to List">
</form>
</center>
<p>
<jsp:include page="cdUserList.jsp" flush="true"
/>
</body>
</html>
And the supposed servlet handler lines in tomcat.conf is:
ApJServMount /myapp/servlet/ /myapp
I've tried to add "test" after "servlet" or "myapp" but in vain ...
Has anybody worked with servlets that are packaged so far?
Thanx,
--mike
Re: tomcat won't find my servlets ;-(((
Posted by Matt Goss <mg...@rtci.com>.
Mike,
I'm not too sure about more precise path information in the tomcat.conf file.
I know it can be done, and that how it is done depends on how specific a
mapping you are interested in doing. Anyone else care to venture an opinion
on this one???
As for the servlet mapping... This is for mapping a servlet of one name to a
specific URI. For instance, if you have a servlet called myservlet in the
package com.blah.foo.servlets and you wanted every request that had /info in
it to be routed through that servlet then your web.xml should look like:
<servlet>
<servlet-name>myservlet</servlet-name>
<servlet-class>com.blah.foo.servlets.myservlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>myservlet</servlet-name>
<url-pattern>/info</url-pattern>
</servlet-mapping>
then you can use the URL
http://mydomain/mycontextname/info/somemorepath?somedata to access the
servlet.
hope this helps,
Matt
mike niemaz wrote:
> Matt Goss wrote:
>
> > Mike,
> > the apjservmount is used to tell apache to go to tomcat for anything
> > inside a specific context (ie http://mydomain/mycontextname/ gets sent
> > to tomcat)
>
> OK, can I specify more precise paths? If so, what would the syntax
> in the tomcat.conf file?
>
> > The web.xml is used for servlet mappings and such.... for instance:
> > If you have a servlet (myservlet) in a packege (com.blah.foo.servlets)
> > you need a mapping in the web.xml that looks like this:
> > <servlet>
> > <servlet-name>myservlet</servlet-name>
> > <servlet-class>com.blah.foo.servlets.myservlet</servlet-class>
> > </servlet>
> > then you can access the servlet vi the url:
> > http://www.mydomain.com/mycontextname/servlet/myservlet
>
> At the moment my servlet is loaded & works no matter what I write
> in the web.xml file ... kind of annoying though I understand what you
> say.
> You mentionned
> <servlet>
> <servlet-name>xxx</servlet-name>
> <servlet-class>xxx</servlet-class>
> </servlet>
> What is this one for:
> <servlet-mapping>
> <servlet-name>xxx</servlet-name>
> <url-pattern>/xxx</url-pattern>
> </servlet-mapping>
>
> Thanx anyway.
> --mike
Re: tomcat won't find my servlets ;-(((
Posted by mike niemaz <ni...@xrce.xerox.com>.
Matt Goss wrote:
> Mike,
> the apjservmount is used to tell apache to go to tomcat for anything
> inside a specific context (ie http://mydomain/mycontextname/ gets sent
> to tomcat)
OK, can I specify more precise paths? If so, what would the syntax
in the tomcat.conf file?
> The web.xml is used for servlet mappings and such.... for instance:
> If you have a servlet (myservlet) in a packege (com.blah.foo.servlets)
> you need a mapping in the web.xml that looks like this:
> <servlet>
> <servlet-name>myservlet</servlet-name>
> <servlet-class>com.blah.foo.servlets.myservlet</servlet-class>
> </servlet>
> then you can access the servlet vi the url:
> http://www.mydomain.com/mycontextname/servlet/myservlet
At the moment my servlet is loaded & works no matter what I write
in the web.xml file ... kind of annoying though I understand what you
say.
You mentionned
<servlet>
<servlet-name>xxx</servlet-name>
<servlet-class>xxx</servlet-class>
</servlet>
What is this one for:
<servlet-mapping>
<servlet-name>xxx</servlet-name>
<url-pattern>/xxx</url-pattern>
</servlet-mapping>
Thanx anyway.
--mike
Re: tomcat won't find my servlets ;-(((
Posted by Matt Goss <mg...@rtci.com>.
Steve,
If your web pages exist in the context... (ie
webapps/mycontext/somepage.html) they will be served by tomcat via an
url: http://mydomain/mycontext/sompage.html (thus the ajpservmount
command). If they do not reside inside the context... (ie.
wwwroot/somefolder/somepage.html) they will be served by apache via an
url: http://mydomain/somefolder/somepage.html (no tomcat).
HTH
Matt
Steve Buroff wrote:
> **snip***
>
> the apjservmount is used to tell apache to go to tomcat for
> anything
> inside a specific context (ie http://mydomain/mycontextname/
> gets sent
> to tomcat)
>
> Does this mean it will also go to tomcat for .html pages? If so, is
> there away to change that so Apache handles the html and Tomcat the
> servletsand .jsp files? TIA Steve Buroff
>
>
>
Re: tomcat won't find my servlets ;-(((
Posted by Steve Buroff <sj...@lucent.com>.
----- Original Message -----
From: Matt Goss
To: tomcat-user@jakarta.apache.org
Sent: Thursday, August 31, 2000 9:22 AM
Subject: Re: tomcat won't find my servlets ;-(((
Mike,
the apjservmount is used to tell apache to go to tomcat for anything
inside a specific context (ie http://mydomain/mycontextname/ gets sent
to tomcat)
Does this mean it will also go to tomcat for .html pages? If so, is there a
way to change that so Apache handles the html and Tomcat the servlets
and .jsp files? TIA
Steve Buroff
The web.xml is used for servlet mappings and such.... for instance:
If you have a servlet (myservlet) in a packege (com.blah.foo.servlets)
you need a mapping in the web.xml that looks like this:
<servlet>
<servlet-name>myservlet</servlet-name>
<servlet-class>com.blah.foo.servlets.myservlet</servlet-class>
</servlet>
then you can access the servlet vi the url:
http://www.mydomain.com/mycontextname/servlet/myservlet
:) hope this helps
Matt Goss
mike niemaz wrote:
> mike niemaz wrote:
>
> > Hi all,
> > I'm trying to implement the famous MVC2 controller
> > based on a simple jsp & servlets files.
> > It worked fine until I decided to enhance my servlet
> > & especially until I included it in a new package.
> > Tomcat do not find the class anymore ;-(((
> >
> > No matter what path I use or what ApJServMount I
> > specify in tomcat.conf, it keeps telling me
> > it can't find the class ....
>
> ooooopssss, stupid me!
> 4 years of Java coding to "notice" that packaged classes
> are accessible with "dots" such as test.myClass ...
> What am I???
> Still, it is still unclear to me how the ApJServMount line
> can or has to be modified according to projects.
> Also, the web.xml mapping stuff seem to have no incident
> on the way servlets are treated by tomcat .. it MUST be
> wrong but .... i'm still investigating.
> If anybody can light me up on that points.
>
> --mike
Re: tomcat won't find my servlets ;-(((
Posted by Matt Goss <mg...@rtci.com>.
Mike,
the apjservmount is used to tell apache to go to tomcat for anything
inside a specific context (ie http://mydomain/mycontextname/ gets sent
to tomcat)
The web.xml is used for servlet mappings and such.... for instance:
If you have a servlet (myservlet) in a packege (com.blah.foo.servlets)
you need a mapping in the web.xml that looks like this:
<servlet>
<servlet-name>myservlet</servlet-name>
<servlet-class>com.blah.foo.servlets.myservlet</servlet-class>
</servlet>
then you can access the servlet vi the url:
http://www.mydomain.com/mycontextname/servlet/myservlet
:) hope this helps
Matt Goss
mike niemaz wrote:
> mike niemaz wrote:
>
> > Hi all,
> > I'm trying to implement the famous MVC2 controller
> > based on a simple jsp & servlets files.
> > It worked fine until I decided to enhance my servlet
> > & especially until I included it in a new package.
> > Tomcat do not find the class anymore ;-(((
> >
> > No matter what path I use or what ApJServMount I
> > specify in tomcat.conf, it keeps telling me
> > it can't find the class ....
>
> ooooopssss, stupid me!
> 4 years of Java coding to "notice" that packaged classes
> are accessible with "dots" such as test.myClass ...
> What am I???
> Still, it is still unclear to me how the ApJServMount line
> can or has to be modified according to projects.
> Also, the web.xml mapping stuff seem to have no incident
> on the way servlets are treated by tomcat .. it MUST be
> wrong but .... i'm still investigating.
> If anybody can light me up on that points.
>
> --mike
Re: tomcat won't find my servlets ;-(((
Posted by mike niemaz <ni...@xrce.xerox.com>.
mike niemaz wrote:
> Hi all,
> I'm trying to implement the famous MVC2 controller
> based on a simple jsp & servlets files.
> It worked fine until I decided to enhance my servlet
> & especially until I included it in a new package.
> Tomcat do not find the class anymore ;-(((
>
> No matter what path I use or what ApJServMount I
> specify in tomcat.conf, it keeps telling me
> it can't find the class ....
ooooopssss, stupid me!
4 years of Java coding to "notice" that packaged classes
are accessible with "dots" such as test.myClass ...
What am I???
Still, it is still unclear to me how the ApJServMount line
can or has to be modified according to projects.
Also, the web.xml mapping stuff seem to have no incident
on the way servlets are treated by tomcat .. it MUST be
wrong but .... i'm still investigating.
If anybody can light me up on that points.
--mike