tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Violeta Georgieva <miles...@gmail.com>
Subject Re: Erroneous duplicate servlet mapping exception (IllegalArgumentException)
Date Thu, 05 Mar 2015 09:22:32 GMT
Hi,

2015-03-05 1:53 GMT+02:00 Adam Ryan <adam.john.ryan@gmail.com>:
>
> Hi,
>
> I had my tomcat webapp running fine (using Tomcat 8.0.9) in Eclipse Luna,
> and I decided to have a play around with the build path. After changing a
> few things and then changing everything back to its previous state, I am
> now getting an IllegalArgumentException:
>
> "The servlets named [api.rest.BaseServlet] and [src.api.rest.BaseServlet]
> are both mapped to the url-pattern [/BaseServlet] which is not permitted"
>
> I understand what the exception is telling me, but I only have one class
> named BaseServlet, which is in the api.rest package. I have no idea why
> "src" is being prepended to my package name in the second instance above.
> Whatever the reason is, it is causing my Tomcat server to not start up.
>
> I have defined the BaseServlet class in my web.xml file as follows:
>
>     <servlet>
>         <servlet-name>BaseServlet</servlet-name>
>         <servlet-class>api.rest.BaseServlet</servlet-class>
>     </servlet>
>
>     <servlet-mapping>
>         <servlet-name>BaseServlet</servlet-name>
>         <url-pattern>/BaseServlet</url-pattern>
>     </servlet-mapping>
>
> But as I said, this used to work until today. I must have not changed
> something back to its original state in my build path, but I can't figure
> out what. I'm hoping I don't have to recreate my project and tomcat server
> just to make this work.
>
> Any help is appreciated.

You said you changed the build path.
Did you change the sources location?
Did you change the package name?
Do you have WebServlet annotation defined for your servlet?
Check the classes that you are deploying.

Regards,
Violeta

> Thanks,
> Adam

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message