I'm trying to run my dynamic web project , but the server won't to start and the only message i get is this "Server Tomcat v9.0 Server at localhost failed to start". Note : the server was working normally before that.
-
try to check if the port in use or not – Ibrahim AlTamimi May 30 '20 at 20:02
-
@IbrahimAlTamimi i tried to that and it's not in use – Yacine_Dev_Artist May 30 '20 at 20:04
-
1Refer https://stackoverflow.com/questions/13244233/server-tomcat-v7-0-server-at-localhost-failed-to-start-without-stack-trace-whi – Pandurang May 31 '20 at 02:41
1 Answers
NOTE : before you try to do anything try to run your servlet(or jsp) and check if there is no exception.
i found the answer here : ""Server Tomcat v7.0 Server at localhost failed to start" without stack trace while it works in terminal"
first if the server was working normally before that and you're sure that you don't touch anything on the server settings or something like that ,don't try to delete the server or .snap file or .tmp file or playing with setting, the problem may be on the web.xml file.
so i found two solutions :
the first one is you have to delete the servlet mapping on your web.xml file
file before editing :
...
<display-name>something<display-name>
<servlet>
<servlet-name>Welcome<servlet-name>
<servlet-class>DemoServlet<servlet-class>
</servlet>
<servlet-mapping>
<servlet-name> Welcome <servlet-name>
<url-pattern>/welcome</url-pattern>
<welcome-file-list>
...
</welcome-file-list>
...
after :
<display-name>something<display-name>
<welcome-file-list>
...
</welcome-file-list>
...
or the best thing is your just need to add <element>
tag just below <?xml version="1.0" encoding="UTF-8"?>
(and don't forget to close the tag by </element>
).
so your xml file will be like that :
...
<?xml version="1.0" encoding="UTF-8"?>
<element>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>something<display-name>
<servlet>
<servlet-name>Welcome<servlet-name>
<servlet-class>DemoServlet<servlet-class>
</servlet>
<servlet-mapping>
<servlet-name> Welcome <servlet-name>
<url-pattern>/welcome</url-pattern>
<welcome-file-list>
...
</welcome-file-list>
</web-app>
</element>

- 135
- 1
- 2
- 9