标题翻译
Tomcat v9.0 Server Starting Error In Eclipse
问题
我试图运行我的动态网页项目,但服务器无法启动,我收到的唯一消息是:“Server Tomcat v9.0 在 localhost 上启动失败”。
注意:之前服务器正常运行。
英文翻译
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.
答案1
得分: -1
注意:在尝试任何操作之前,请运行您的Servlet(或JSP)并检查是否没有异常。
我在这里找到了答案:“https://stackoverflow.com/questions/13244233/server-tomcat-v7-0-server-at-localhost-failed-to-start-without-stack-trace-whi”。
首先,如果服务器在此之前正常工作,并且您确定没有触及服务器设置或类似的任何内容,请不要尝试删除服务器、.snap文件、.tmp文件或更改设置,问题可能出在web.xml文件中。
因此,我找到了两个解决方案:
第一个解决方案是删除web.xml文件中的Servlet映射。
编辑前的文件:
...
<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>
...
编辑后:
<display-name>something</display-name>
<welcome-file-list>
...
</welcome-file-list>
...
或者最好的方法是在<?xml version="1.0" encoding="UTF-8"?>
下方添加<element>
标签(不要忘记用</element>
关闭标签)。
所以您的XML文件将会是这样的:
...
<?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>
英文翻译
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 : "https://stackoverflow.com/questions/13244233/server-tomcat-v7-0-server-at-localhost-failed-to-start-without-stack-trace-whi"
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>
专注分享java语言的经验与见解,让所有开发者获益!
评论