• 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中配置的域名的问题,而没有项目名照成的,当然这个只是猜测,没有具体是查找

  • 相关阅读:
    CharacterEncodingFilter详解及源码解析
    SPI 串行Flash闪存W25Q128FV 的使用(STM32F407)_硬件篇
    STM32 TFT LCD
    什么叫状态机:按键消抖实例
    STM32 ADC单通道采集 (STM32F103C8T6 ADC1的0通道 )
    STM32 PWM输出 (STM32F103C8T6 TIM2_CH2 )
    STM32 多通道ADC连续采集之数据到内存 DMA传输
    STM32 DAM之串口通讯
    STM32定时器之PWM 4路输出 TIM3、TIM14
    STM32定时器 TIM14之PWM 可调脉宽输出 呼吸灯
  • 原文地址:https://www.cnblogs.com/andysd/p/3007426.html
Copyright © 2020-2023  润新知