You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sergio Arrighi <se...@iminholding.com> on 2009/03/13 15:02:27 UTC

Servlet mapping issue

Hello to everyone,

I've developed a tree menu which uses a Servlet and AJAX posts. I've 
exported it as a jar and now I want to include it in another webapp. The 
problem is that this webapp cannot reach the servlet obviously because 
it's not mapped in web.xml.
Here's my question.... Is it possible to add a servlet mapping which 
points directly to the servlet contained in the .jar file of my tree menu?

Thanks

Sergio
-- 
	*I.M.I.N. Holding s.r.l.*
Sergio Arrighi
sergio.arrighi@iminholding.com <ma...@iminholding.com>
Cell. 3455805121

Vicolo Molino, 2
21052 Busto Arsizio
Varese
Tel. +39 0331324679
Fax. +39 0331324678
www.iminholding.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Servlet mapping issue

Posted by André Warnier <aw...@ice-sa.com>.
Sergio Arrighi wrote:
  [...]

Thanks for the info you put here.  That was very clear, if even I
understand.

> 
> When I try my application and I click on the button which make an AJAX 
> post request on this servlet the browser returns an error (404 not found)
> 
I think what you need to provide here, is the exact URL that your AJAX
POST is posting to, so that we can have an idea of what the 404 is due to.
Do you know ?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Servlet mapping issue

Posted by Gregor Schneider <rc...@googlemail.com>.
What's in your access-log?

Rgds

Gregor
-- 
just because your paranoid, doesn't mean they're not after you...
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Servlet mapping issue

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Sergio Arrighi [mailto:sergio.arrighi@iminholding.com] 
> Subject: Re: Servlet mapping issue
> 
> When I try my application and I click on the button which 
> make an AJAX post request on this servlet the browser returns
> an error (404 not found)

For initial testing, take AJAX out of the picture; just enter the URL for the servlet in the browser's address bar and see if you get a response (or use wget or curl or equivalent):
http://<server>/APP1/TreeMenuServlet

As others have stated, definitely look in the logs for any problem reporting.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Servlet mapping issue

Posted by David Smith <dn...@cornell.edu>.
Sergio Arrighi wrote:
> Hi!
> Thanks for the really quick answer.
> It's probabily something really basic to do, but I'm a newbie and I'm
> not able to do it:
> I have an application (lets call it APP1) and it's organized like this:
>
> APP1
> ----- WEB-INF
> +++++++ lib
> ............................. myJar.jar (contains the package
> org.imin.treemenu)
> -.-.-.-.-.-.-.-..-.-.-.-.-.-.-.- myServlet
> (org.imin.treemenu.TreeMenuServlet)
> ----- web.xml
>
> Now I need to register _myServlet_ in the deploy descriptor and I
> write these lines in web.xml:
> <servlet>
>        <description></description>
>        <display-name>TreeMenuServlet</display-name>
>        <servlet-name>TreeMenuServlet</servlet-name>
>        <servlet-class>org.imin.treemenu.TreeMenuServlet</servlet-class>
> </servlet>
> <servlet-mapping>
>        <servlet-name>TreeMenuServlet</servlet-name>
>        <url-pattern>/TreeMenuServlet</url-pattern>
> </servlet-mapping>
>
> When I try my application and I click on the button which make an AJAX
> post request on this servlet the browser returns an error (404 not found)
>
> Sorry to bother but I'm new!
> Thanks
>
> Sergio
>
> Caldarale, Charles R ha scritto:
>>> From: Sergio Arrighi [mailto:sergio.arrighi@iminholding.com]
>>> Subject: Servlet mapping issue
>>>
>>> Here's my question.... Is it possible to add a servlet mapping which
>>> points directly to the servlet contained in the .jar file
>>> of my tree menu?
>>>     
>>
>> Well... yes.  Servlet mapping is explained in the servlet spec, and
>> there are numerous examples that ship with Tomcat.
>>
>> Is there more to your question?  Perhaps some constraints that you
>> haven't mentioned?
>>
>>  - Chuck
>>
>>
>>
>
What URL is your AJAX posting to?  Also take a look at your logs for any
relevant messages.  Maybe there was a problem setting up your servlet. 
The servlet mapping looks good as you defined it in your webapp's
WEB-INF/web.xml file.

--David

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Servlet mapping issue

Posted by Sergio Arrighi <se...@iminholding.com>.
Hi!
Thanks for the really quick answer.
It's probabily something really basic to do, but I'm a newbie and I'm 
not able to do it:
I have an application (lets call it APP1) and it's organized like this:

APP1
----- WEB-INF
+++++++ lib
............................. myJar.jar (contains the package 
org.imin.treemenu)
-.-.-.-.-.-.-.-..-.-.-.-.-.-.-.- myServlet 
(org.imin.treemenu.TreeMenuServlet)
----- web.xml

Now I need to register _myServlet_ in the deploy descriptor and I write 
these lines in web.xml:
<servlet>
        <description></description>
        <display-name>TreeMenuServlet</display-name>
        <servlet-name>TreeMenuServlet</servlet-name>
        <servlet-class>org.imin.treemenu.TreeMenuServlet</servlet-class>
</servlet>
<servlet-mapping>
        <servlet-name>TreeMenuServlet</servlet-name>
        <url-pattern>/TreeMenuServlet</url-pattern>
</servlet-mapping>

When I try my application and I click on the button which make an AJAX 
post request on this servlet the browser returns an error (404 not found)

Sorry to bother but I'm new!
Thanks

Sergio

Caldarale, Charles R ha scritto:
>> From: Sergio Arrighi [mailto:sergio.arrighi@iminholding.com] 
>> Subject: Servlet mapping issue
>>
>> Here's my question.... Is it possible to add a servlet mapping 
>> which points directly to the servlet contained in the .jar file
>> of my tree menu?
>>     
>
> Well... yes.  Servlet mapping is explained in the servlet spec, and there are numerous examples that ship with Tomcat.
>
> Is there more to your question?  Perhaps some constraints that you haven't mentioned?
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>   

-- 
	*I.M.I.N. Holding s.r.l.*
Sergio Arrighi
sergio.arrighi@iminholding.com <ma...@iminholding.com>
Cell. 3455805121

Vicolo Molino, 2
21052 Busto Arsizio
Varese
Tel. +39 0331324679
Fax. +39 0331324678
www.iminholding.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Servlet mapping issue

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Sergio Arrighi [mailto:sergio.arrighi@iminholding.com] 
> Subject: Servlet mapping issue
> 
> Here's my question.... Is it possible to add a servlet mapping 
> which points directly to the servlet contained in the .jar file
> of my tree menu?

Well... yes.  Servlet mapping is explained in the servlet spec, and there are numerous examples that ship with Tomcat.

Is there more to your question?  Perhaps some constraints that you haven't mentioned?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org