zoukankan      html  css  js  c++  java
  • org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/localhost]]

    项目原来是部署在weblogic中,今天想看看在tomcat中怎么样,于是就把项目发布在tomcat中,可是启动的时候遇到如下异常:

    严重: ContainerBase.addChild: start:
    org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/localhost]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1099)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1621)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.IllegalArgumentException: Invalid <url-pattern> basePath.java in servlet mapping
    at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3208)
    at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3183)
    at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1302)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1294)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:855)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:345)
    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:5161)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 11 more
    2013-4-8 14:23:00 org.apache.catalina.startup.HostConfig deployDirectory
    严重: Error deploying web application directory D:\tomcat 7.0\apache-tomcat-7.0.27\webapps\localhost
    java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/localhost]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:898)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1099)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1621)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

    仔细查看了一下上面的异常,发现上面加粗的部分,于是找到了web.xml中的相关部分,代码如下:

    <servlet>
    <servlet-name>basePath</servlet-name>
    <servlet-class>com.localhost.website.commons.net.BasePathServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>basePath</servlet-name>
    <url-pattern>basePath.java</url-pattern>
    </servlet-mapping>

    这个是在weblogic中运行的,没有问题,现在发布到了tomcat中遇到了上面的问题,这是时候把

    <url-pattern>basePath.java</url-pattern> 修改成 <url-pattern>/basePath.java</url-pattern>

    启动的时候就没有问题了,原因可能是因为我在weblogic中配置的域名的问题,而没有项目名照成的,当然这个只是猜测,没有具体是查找

  • 相关阅读:
    Microsoft Prerelease Software Visual Studio Code Name "Orcas" January 2007 Community Technology Preview (CTP)
    Attribute Example In MSDN
    AutoEventWireup 20032005
    转ASP.NET中常用的优化性能方法
    转 用whitespace:nowrap;解决中文标签标签换行问题
    RBAC 模型初探[转]
    .net开源相关
    Path.GetExtension 方法
    应用程序注释规范
    Web.config的写入操作
  • 原文地址:https://www.cnblogs.com/andysd/p/3007426.html
Copyright © 2011-2022 走看看