在Windows上部署Libreplan时出现tomcat错误

时间:2014-12-16 14:24:05

标签: java tomcat7

我已经从存储库中分离了Libreplan的代码库,并在eclipse中导入。现在我正在尝试将libreplan-webapp部署到tomcat7中。我也配置了Tomcat-7.0.39 \ conf \ Catalina \ localhost目录下的数据源文件。 下面给出了libreplan-webapp.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="">
        <Resource name="jdbc/libreplan-ds" auth="Container"
            type="javax.sql.DataSource"
            maxActive="100" maxIdle="30" maxWait="10000"
            username="libreplan" password="libreplan"
            driverClassName="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost/libreplandev" />
</Context>

我按照手册[http://www.libreplan.org/INSTALL.html]中给出的所有指令来构建wepapp并将其部署在tomcat上。 但是我在启动tomcat时遇到错误

SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/libreplan-webapp]]
    at java.util.concurrent.FutureTask.report(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    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: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/libreplan-webapp]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    ... 6 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/beans/factory/ListableBeanFactory
    at java.lang.Class.getDeclaredFields0(Native Method)

这是web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
    xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
  http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>libreplan-webapp</display-name>

    <!--
        It searches all libreplan-business-spring-config.xml files, it can
        found several. There must be at least one. It searches
        libreplan-webapp-spring-config.xml. There must be just one. It
        searches libreplan-override-spring-config.xml to override some
        previous definitions. There could be several or none.
    -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            classpath*:/libreplan-business-spring-config.xml
            classpath:/libreplan-webapp-spring-config.xml
            classpath*:/libreplan-override-spring-config.xml
            classpath:/libreplan-webapp-spring-security-config.xml
        </param-value>
    </context-param>


    <!-- /// -->
    <!-- DSP -->
    <servlet>
        <description><![CDATA[The servlet loads the DSP pages.]]></description>
        <servlet-name>dspLoader</servlet-name>
        <servlet-class>org.zkoss.web.servlet.dsp.InterpreterServlet</servlet-class>
    </servlet>
    <servlet>
        <description><![CDATA[Callback Servlet]]></description>
        <servlet-name>callbackServlet</servlet-name>
        <servlet-class>org.zkoss.ganttz.servlets.CallbackServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>callbackServlet</servlet-name>
        <url-pattern>/callback/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>dspLoader</servlet-name>
        <url-pattern>*.dsp</url-pattern>
    </servlet-mapping>
    <!-- /// -->

    <!-- Spring security -->
    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- //// -->
    <listener>
        <listener-class>org.libreplan.web.LoggingConfiguration</listener-class>
    </listener>

    <!-- ZK -->
    <listener>
        <description>Used to cleanup when a session is destroyed</description>
        <display-name>ZK Session Cleaner</display-name>
        <listener-class>org.zkoss.zk.ui.http.HttpSessionListener</listener-class>
    </listener>

    <!-- Spring listeners -->

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <listener>
        <listener-class>
            org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>

    <!-- end Spring listeners -->

    <!-- Loads all IDataBootstrap and executes them -->
    <listener>
        <listener-class>org.libreplan.web.bootstrap.BootstrapListener</listener-class>
    </listener>

    <servlet>
        <description>ZK loader for ZUML pages</description>
        <servlet-name>zkLoader</servlet-name>
        <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class>
        <!--
            Must. Specifies URI of the update engine (DHtmlUpdateServlet). It
            must be the same as <url-pattern> for the update engine.
        -->
        <init-param>
            <param-name>update-uri</param-name>
            <param-value>/zkau</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>zkLoader</servlet-name>
        <url-pattern>*.zul</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>zkLoader</servlet-name>
        <url-pattern>*.zhtml</url-pattern>
    </servlet-mapping>
    <servlet>
        <description>The asynchronous update engine for ZK</description>
        <servlet-name>auEngine</servlet-name>
        <servlet-class>org.zkoss.zk.au.http.DHtmlUpdateServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>auEngine</servlet-name>
        <url-pattern>/zkau/*</url-pattern>
    </servlet-mapping>
    <!-- //// -->

    <!-- CXF -->
    <servlet>
        <display-name>CXF Servlet</display-name>
        <servlet-name>CXFServlet</servlet-name>
        <servlet-class>
            org.apache.cxf.transport.servlet.CXFServlet
        </servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>CXFServlet</servlet-name>
        <url-pattern>/ws/rest/*</url-pattern>
    </servlet-mapping>

    <session-config>
        <!-- The session timeout is ten minutes. A timer is used to keep the session alive if there is some open page -->
        <session-timeout>10</session-timeout>
    </session-config>

    <welcome-file-list>
        <welcome-file>/common/index.zul</welcome-file>
    </welcome-file-list>

    <error-page>
        <exception-type>java.lang.Throwable</exception-type>
        <location>/common/error.zul</location>
    </error-page>

    <error-page>
        <error-code>404</error-code>
        <location>/common/page_not_found.zul</location>
    </error-page>

    <error-page>
        <error-code>403</error-code>
        <location>/common/access_forbidden.zul</location>
    </error-page>

</web-app>

配置: java版本:1.7.0_55-b13 服务器:Tomcat-7.0.39 操作系统:窗口7 DB:MySql

2 个答案:

答案 0 :(得分:0)

相关错误讯息为"java.lang.NoClassDefFoundError: org/springframework/beans/factory/ListableBeanFactory"

因此,似乎您在运行时没有在类路径中拥有所需的Spring库,或者您的版本较旧。

它很可能是因为它丢失而不是太旧,因为在不久前的Spring 2.0中引入了ListableBeanFactory。

答案 1 :(得分:0)

我自己解决了这个问题,在Windows上运行Libreplan。配置有很多问题。首先,错误消息具有误导性,它与ListableBeanFactory无关。 我做了以下更改: 将libreplan.xml重命名为tomcat \ conf \ Catalina \ localhost文件夹中的libreplan-webapp.xml,因为filename应该是数学应用程序战争名称。 然后我删除了hibernate-annotations依赖,因为注释来自3.5以后的hibernate-core jar。 我在catalina.policy文件中添加了以下条目

grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" {
  ...
  // begin:libreplan
  permission java.io.FilePermission "${catalina.base}${file.separator}webapps${file.separator}libreplan-webapp${file.separator}WEB-INF${file.separator}classes${file.separator}logging.properties", "read";
  // end:libreplan
  ...
};