tomcat6上的webapp启动失败

时间:2013-03-02 17:15:53

标签: java mysql tomcat jdbc centos

我正在尝试在tomcat6 / CentOS5上部署一个webapp

我进行了配置,但是当我尝试启动webapp时,它失败了 所以这里的人说在渴望系统中做了一些修改,这里是新的日志。

/usr/local/tomcat/logs/catalina.out的最后一行是:

------------- org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: start: Starting web application at '/'
------------- org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.ambraproject.configuration.WebAppListener
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
        at org.ambraproject.configuration.WebAppListener.<clinit>(WebAppListener.java:40)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4150)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
        at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1276)
        at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:625)
        at org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:136)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:194)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
            ... 30 more
------------- org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Skipped installing application listeners due to previous error(s)
    Mar 2, 2013 5:46:07 PM org.apache.catalina.core.ApplicationContext log
    INFO: HTMLManager: list: Listing contexts for virtual host 'localhost'

来自/ usr / local / tomcat / webapps / ROOT / WEB-INF的webxml文件是:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee">

  <display-name>Ambra</display-name>

  <context-param>
    <param-name>webAppRootKey</param-name>
    <param-value>/WEB-INF/propertyConfigurer.xml /WEB-INF/countryList.xml /WEB-INF/profaneWords.xml /WEB-INF/applicationContext.xml</param-value>
  </context-param>

  <context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>log4j.properties</param-value>
  </context-param>



  <resource-ref>
    <description>Main Ambra Database</description>
    <res-ref-name>jdbc/AmbraDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>

  <resource-env-ref>
    <description>File Store for Ambra</description>
    <resource-env-ref-name>ambra/FileStore</resource-env-ref-name>
    <resource-env-ref-type>org.ambraproject.filestore.FileStoreService</resource-env-ref-type>
  </resource-env-ref>

  <filter>
    <description>Filter out any request that matches regexp</description>
    <filter-name>SinkHoleFilter</filter-name>
    <filter-class>org.ambraproject.web.GatekeeperFilter</filter-class>
    <init-param>
      <param-name>regexp</param-name>
      <param-value>.*\.ftl$</param-value>
    </init-param>
  </filter>

  <filter>
    <filter-name>UrlRewriteFilter</filter-name>
    <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
  </filter>

  <filter>
    <filter-name>MultipleRequestFilter</filter-name>
    <filter-class>org.ambraproject.web.MultipleRequestFilter</filter-class>
    <init-param>
      <param-name>includePattern_fetchArticle</param-name>
      <param-value>.*\/article\/info.*</param-value>
    </init-param>
    <init-param>
      <param-name>includePattern_browseIssue</param-name>
      <param-value>.*browseIssue\.action.*</param-value>
    </init-param>
    <init-param>
      <param-name>includePattern_browseVolume</param-name>
      <param-value>.*browseVolume\.action.*</param-value>
    </init-param>
  </filter>

  <filter>
    <description>Sets the virtual journal context.
Should be 1st in the chain as other Filters, e.g. caching, may rely on the journal context.</description>
    <filter-name>VirtualJournalContextFilter</filter-name>
    <filter-class>org.ambraproject.web.VirtualJournalContextFilter</filter-class>
  </filter>

  <filter>
    <description>Should immediately follow VirtualJournalContext in Filter chain.
If a virtual journal context is set, check to see if requested resource has a virtual journal override.
If so, wrap request with virtual journal override values in FilterChain.</description>
    <filter-name>VirtualJournalMappingFilter</filter-name>
    <filter-class>org.ambraproject.web.VirtualJournalMappingFilter</filter-class>
  </filter>

  <filter>
    <filter-name>DummySSOFilter</filter-name>
    <filter-class>org.ambraproject.web.DummySSOFilter</filter-class>
    <!-- uncomment these if you want to be logged in by default when you start the server
    <init-param>
      <param-name>auth.id</param-name>
      <param-value>foo</param-value>
    </init-param>
    <init-param>
      <param-name>email</param-name>
      <param-value>foobar@b.com</param-value>
    </init-param>
    -->
    <init-param>
      <param-name>casUrl</param-name>
      <param-value>https://localhost:7443/cas/</param-value>
    </init-param>
    <init-param>
      <param-name>wrapRequest</param-name>
      <param-value>false</param-value>
    </init-param>
  </filter>

  <filter>
    <filter-name>CAS Filter</filter-name>
    <filter-class>org.ambraproject.service.cas.client.filter.CASFilterWrapper</filter-class>
    <init-param>
      <param-name>edu.yale.its.tp.cas.client.filter.loginUrl</param-name>
      <param-value>https://localhost:7443/cas/login</param-value>
    </init-param>
    <init-param>
      <param-name>edu.yale.its.tp.cas.client.filter.validateUrl</param-name>
      <param-value>https://localhost:7443/cas/proxyValidate</param-value>
    </init-param>
    <init-param>
      <param-name>edu.yale.its.tp.cas.client.filter.serverName</param-name>
      <param-value>localhost:8080</param-value>
    </init-param>
    <init-param>
      <param-name>edu.yale.its.tp.cas.client.filter.wrapRequest</param-name>
      <param-value>false</param-value>
    </init-param>
  </filter>

  <filter>
    <filter-name>gzip</filter-name>
    <filter-class>org.mortbay.servlet.GzipFilter</filter-class>
    <init-param>
      <param-name>minGzipSize</param-name>
      <param-value>100</param-value>
    </init-param>
    <init-param>
      <param-name>mimeTypes</param-name>
      <param-value>text/html,text/plain,text/css,text/javascript,application/xml,application/atom+xml</param-value>
    </init-param>
  </filter>

  <filter>
    <filter-name>journalStaticResources</filter-name>
    <filter-class>org.ambraproject.web.JournalStaticResourceFilter</filter-class>
  </filter>

  <filter>
    <filter-name>struts2</filter-name>
    <!--
    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    -->
    <filter-class>org.ambraproject.struts2.AmbraStruts2Dispatcher</filter-class>
    <init-param>
      <param-name>packages</param-name>
      <param-value>struts</param-value>
    </init-param>
  </filter>

  <!--
  <filter>
    <filter-name>DebuggingFilter</filter-name>
    <filter-class>org.ambraproject.web.DebuggingFilter</filter-class>
  </filter>
  -->


  <filter-mapping>
    <filter-name>SinkHoleFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
  </filter-mapping>

  <filter-mapping>
    <filter-name>MultipleRequestFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
  </filter-mapping>

  <filter-mapping>
    <filter-name>UrlRewriteFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
  </filter-mapping>

  <filter-mapping>
    <filter-name>VirtualJournalContextFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>ERROR</dispatcher>
  </filter-mapping>

  <filter-mapping>
    <filter-name>VirtualJournalMappingFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

  <filter-mapping>
    <filter-name>DummySSOFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

  <filter-mapping>
    <filter-name>CAS Filter</filter-name>
    <url-pattern>/annotation/secure/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

  <filter-mapping>
    <filter-name>CAS Filter</filter-name>
    <url-pattern>/user/secure/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

  <filter-mapping>
    <filter-name>CAS Filter</filter-name>
    <url-pattern>/rate/secure/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

  <filter-mapping>
    <filter-name>CAS Filter</filter-name>
    <url-pattern>/admin/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

  <filter-mapping>
    <filter-name>gzip</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

  <filter-mapping>
    <filter-name>journalStaticResources</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>ERROR</dispatcher>
  </filter-mapping>

  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>ERROR</dispatcher>
  </filter-mapping>

  <!--
  <filter-mapping >
    <filter-name>DebuggingFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>
-->

    <listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>


  <!-- The configuration WebAppListener to pull in the configuration stuff automatically. -->
  <listener>
    <listener-class>org.ambraproject.configuration.WebAppListener</listener-class>
  </listener>
  <!-- to hook in the spring container -->
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <!-- to hook in the scope management system that provides scopes like session, request for Servlet 2.4 and Spring 2.0 above  -->
  <listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
  </listener>

  <!-- Count the number of active sessions and make it available.   -->
  <listener>
    <listener-class>org.ambraproject.web.SessionCounter</listener-class>
  </listener>



  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

  <error-page>
    <error-code>404</error-code>
    <location>/static/pageNotFound.action</location>
  </error-page>

  <session-config>
    <session-timeout>1440</session-timeout>
  </session-config>
</web-app>

2 个答案:

答案 0 :(得分:0)

在war文件中创建WEB-INF/classes/logging.properties,其中包含以下内容:

org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandler

这将帮助您找到Error listnerStart行的真正问题。我之前使用过它,发现ClassNotFound错误和其他原因。

更多信息here

答案 1 :(得分:0)

您的类路径中是否有Apache commons-logging jar文件?它似乎是一个类,它是你遗漏的公共日志记录的一部分。