gpt4 book ai didi

java - org.apache.catalina.LifecycleException tomcat错误

转载 作者:行者123 更新时间:2023-11-28 22:43:03 26 4
gpt4 key购买 nike

我在eclipse上的错误日志

Dec 07, 2013 12:52:11 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive C:\apache-tomcat-7.0.42\ROOT\QMSa.war
Dec 07, 2013 12:52:19 PM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/QMSa]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1653)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: The servlets named [uploadServlet] and [FileUploadDBServlet.FileUploadDBServlet] are both mapped to the url-pattern [/uploadServlet] which is not permitted
at org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:335)
at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2450)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2132)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2093)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2086)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1293)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5322)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 10 more

Dec 07, 2013 12:52:19 PM org.apache.catalina.startup.HostConfig deployWAR
SEVERE: Error deploying web application archive C:\apache-tomcat-7.0.42\ROOT\QMSa.war
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/QMSa]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1653)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

我在 webapps 文件夹中部署了我的 WAR 文件。在 eclipse 上我得到了这个错误。

我为 tomcat 和 eclipse 使用相同版本的 JRE。这也是我的 web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">

<display-name>Welcome to Tomcat</display-name>
<description>
hello
</description>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

<servlet>
<servlet-name>uploadServlet</servlet-name>
<servlet-class>FileUploadDBServlet.FileUploadDBServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>uploadServlet</servlet-name>
<url-pattern>/uploadServlet</url-pattern>
</servlet-mapping>
</web-app>

我从 index.html 页面发送了一个表单。表单的操作由

给出
<form method="post" name="myForm" id="question_form" action="uploadServlet" enctype="multipart/form-data" onsubmit="return validateForm()" >

请提供帮助

更新

@WebServlet("/uploadServlet")
@MultipartConfig(maxFileSize = 16177215) // upload file's size up to 16MB
public class FileUploadDBServlet extends HttpServlet {

// database connection settings
private String dbURL = "jdbc:mysql://localhost:3306/elect";
private String dbUser = "root";
private String dbPass = "root";

protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// gets values of text fields

最佳答案

您似乎也在为您的 servlet 类使用注解,这导致了 Web 容器的冲突/困惑。

关于java - org.apache.catalina.LifecycleException tomcat错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20438877/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com