0

I have a problem when start Tomcat v7.0.

'Staring Tomcat v7.0 Server at localhost' has encountered a problem.
 Server Tomcat v7.0 Server at localhost failed to start.

I found that my the problem was in web.xml file. This file looks like this

<display-name>Exercises</display-name>
<welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
</welcome-file-list>

<servlet>
    <servlet-name>table</servlet-name>
    <servlet-class>servletbasic.MakeTable</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>table</servlet-name>
    <url-pattern>/MakeTable</url-pattern>
</servlet-mapping>

when i removed servlet-mapping tag, Tomcat started well. Here is my project tree

  ---Java Resources

    ---servletbasic

      ---MakeTable.java

I tried changing http port number, but it didn't work.

Thanks for your support!

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
rocketmanu
  • 137
  • 2
  • 3
  • 10

1 Answers1

4

From your logs :

Caused by: java.lang.IllegalArgumentException: The servlets named [table] and [servletbasic.MakeTable] are both mapped to the url-pattern [/MakeTable] which is not permitted

It seems that you have two servlet table and MakeTable which are mapping to the same URL /MakeTable.

This may be caused by mixing two servlet declaration method by annotation-based using @WebServlet annotation in your servlet class and by web.xml-based configuration same as you have posted.

Yagnesh Agola
  • 4,556
  • 6
  • 37
  • 50