2015-10-07 1 views
1

Я пытаюсь реализовать ZK с Spring и Hibernate, но когда я пытаюсь скомпилировать (используя Tomcat как сервер), я получаю следующую ошибку:java.lang.ClassNotFoundException: org.zkoss.zk.ui.http.HttpSessionListener

SEVERE: Error configuring application listener of class org.zkoss.zk.ui.http.HttpSessionListener 
java.lang.ClassNotFoundException: org.zkoss.zk.ui.http.HttpSessionListener 
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1332) 
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1166) 
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:520) 
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:501) 
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:120) 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4651) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) 
    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) 

Я попытался изменить конфигурацию web.xml, но ничего не похоже на работу, я буду очень благодарен, если вы можете просто осветить мой путь, я сейчас читаю книгу Spring, но не могу решить все же.

Мой 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>x</display-name> 
    <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> 
    <servlet> 
    <description> 
    The ZK loader for ZUML pages</description> 
    <servlet-name>zkLoader</servlet-name> 
    <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class> 
    <init-param> 
     <param-name>update-uri</param-name> 
     <param-value>/zkau</param-value> 
    </init-param> 
    <load-on-startup>1</load-on-startup> 
    </servlet> 
    <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>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-mapping> 
    <servlet-name>auEngine</servlet-name> 
    <url-pattern>/zkau/*</url-pattern> 
    </servlet-mapping> 
    <welcome-file-list> 
    <welcome-file>index.html</welcome-file> 
    <welcome-file>index.htm</welcome-file> 
    <welcome-file>index.jsp</welcome-file> 
    <welcome-file>default.html</welcome-file> 
    <welcome-file>default.htm</welcome-file> 
    <welcome-file>default.jsp</welcome-file> 
    <welcome-file>index.zul</welcome-file> 
    </welcome-file-list> 

    <context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value>/WEB-INF/SpringContext.xml</param-value> 
    </context-param> 
</web-app> 

Мой SpringContext.xml

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

<beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:aop="http://www.springframework.org/schema/aop" 
     xmlns:context="http://www.springframework.org/schema/context" 
     xmlns:tx="http://www.springframework.org/schema/tx" 
     xmlns:util="http://www.springframework.org/schema/util" 

     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd 
      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd 
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd 
      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd 
      http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd"> 

    <context:annotation-config /> 
    <context:component-scan base-package="com.frd" /> 
    <aop:aspectj-autoproxy /> 

    <tx:annotation-driven transaction-manager="transactionManager"/> 

    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
     <property name="locations"> 
      <list> 
       <value>classpath:hibernate.properties</value> 
       <value>file:hibernate.properties</value> 
      </list> 
     </property> 
    </bean> 

    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> 
     <property name="driverClassName" value="${hibernate.connection.driver_class}" /> 
     <property name="url" value="${hibernate.connection.url}" /> 
     <property name="username" value="${hibernate.connection.username}" /> 
     <property name="password" value="${hibernate.connection.password}" /> 
    </bean> 

    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> 
     <property name="dataSource" ref="dataSource" /> 
     <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"/> 
     <property name="configLocation"> 
      <value>classpath:${hibernate.cfg.file}</value> 
     </property> 
    </bean> 

    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> 
     <property name="sessionFactory" ref="sessionFactory" /> 
    </bean> 
</beans> 

Я не использую Maven.

+0

Вы положили zk.jar в свой WEB-INF/lib? или, может быть, вы поместили другую версию ZK-банок. – jumperchen

ответ

0

Файл JAR, содержащий org.zkoss.zk.ui.http.HttpSessionListener, отсутствует в CLASSPATH.