gpt4 book ai didi

java - 在 eclipse : SEVERE: ContainerBase. addChild : start: org. apache.catalina.LifecycleException 中获取错误:

转载 作者:行者123 更新时间:2023-11-28 23:34:38 24 4
gpt4 key购买 nike

我正在使用 apache-tomcat-7.0.55 和 java 1.7.0_67 从 Dynamic Web Project eclipe kepler SR2 运行 servlet 文件在 Eclipse 的服务器控制台中运行 XmlServlet.java 时出现以下错误。我在 PC 和项目中使用相同版本的 java 运行时。

我也没有走同样的路。

[控制台错误和浏览器 404]

    Sep 05, 2014 9:04:14 PM org.apache.catalina.core.AprLifecycleListener init

INFO: The APR based Apache Tomcat Native library which allows optimal performance in

production environments was not found on the java.library.path:

C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;

C:\Windows\system32;C:\Windows;

C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;

C:/Program Files/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;
C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;F:\Techie\Jee_Kepler;;.
Sep 05, 2014 9:04:14 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Sep 05, 2014 9:04:14 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Sep 05, 2014 9:04:14 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 952 ms
Sep 05, 2014 9:04:14 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Sep 05, 2014 9:04:14 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.55
Sep 05, 2014 9:04:15 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [163] milliseconds.
Sep 05, 2014 9:04:15 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor F:\Techie\Jee_Kepler\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\loca lhost\educate.xml
Sep 05, 2014 9:04:15 PM org.apache.catalina.startup.SetContextPropertiesRule begin
WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to
'org.eclipse.jst.jee.server:educate' did not find a matching property.
Sep 05, 2014 9:04:15 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Context/Loader} Setting property 'useSystemClassLoaderAsParent'
to 'false' did not find a matching property.

Sep 05, 2014 9:04:15 PM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component
[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/educate]]
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:649)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:672)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1862)
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: Invalid <url-pattern> XmlServletPath in servlet mapping

at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3298)
at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3273)
at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1438)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1344)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:876)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:374)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5378)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 10 more

Sep 05, 2014 9:04:15 PM org.apache.catalina.startup.HostConfig deployDescriptor
SEVERE: Error deploying configuration descriptor F:\Techie\Jee_Kepler\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\loca lhost\educate.xml
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/educate]]
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:649)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:672)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1862)
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)

Sep 05, 2014 9:04:15 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deployment of configuration descriptor F:\Techie\Jee_Kepler\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\loca lhost\educate.xml has finished in 261 ms
Sep 05, 2014 9:04:15 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Sep 05, 2014 9:04:15 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Sep 05, 2014 9:04:15 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1174 ms

[Web.xml文件]

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>educate</display-name>

<servlet>
<servlet-name> xmlServlet </servlet-name>
<servlet-class> com.schoolmanager.handler.MyXmlServlet </servlet-class>
</servlet>

<servlet-mapping>
<servlet-name> xmlServlet </servlet-name>
<url-pattern>XmlServletPath</url-pattern>
</servlet-mapping>

</web-app>

[Servlet 文件:XmlServlet.java]

package com.schoolmanager.handler;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class XmlServlet extends javax.servlet.http.HttpServlet {

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// TODO Auto-generated method stub
System.out.println("check servlet");
}
}

最佳答案

你只需要做一个修改

<servlet-mapping>
<servlet-name>XmlServlet</servlet-name>
<url-pattern>/XmlServlet</url-pattern>
</servlet-mapping>

在 url-pattern 中的 XmlServlet 之前添加反斜杠并检查。

关于java - 在 eclipse : SEVERE: ContainerBase. addChild : start: org. apache.catalina.LifecycleException 中获取错误:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25689281/

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