本帖最后由 qq245282209 于 2013-07-21 00:52:58 编辑

解决方案 »

  1.   

    七月 21, 2013 12:45:52 上午 org.apache.catalina.core.StandardContext startInternal
    严重: Error listenerStart
    七月 21, 2013 12:45:52 上午 org.apache.catalina.core.StandardContext startInternal
    严重: Context [/hibernatespring] startup failed due to previous errors
    七月 21, 2013 12:45:52 上午 org.apache.catalina.core.ApplicationContext log
    信息: Closing Spring root WebApplicationContext
    七月 21, 2013 12:45:52 上午 org.springframework.context.support.AbstractApplicationContext doClose
    信息: Closing Root WebApplicationContext: startup date [Sun Jul 21 00:45:51 CST 2013]; root of context hierarchy
    七月 21, 2013 12:45:52 上午 org.springframework.context.support.AbstractApplicationContext doClose
    警告: Exception thrown from ApplicationListener handling ContextClosedEvent
    java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Sun Jul 21 00:45:51 CST 2013]; root of context hierarchy
    at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:347)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1049)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)
    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:559)
    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4819)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5466)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)七月 21, 2013 12:45:52 上午 org.springframework.context.support.AbstractApplicationContext doClose
    警告: Exception thrown from LifecycleProcessor on context close
    java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Sun Jul 21 00:45:51 CST 2013]; root of context hierarchy
    at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:360)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1057)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)
    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:559)
    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4819)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5466)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)七月 21, 2013 12:45:52 上午 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
    信息: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@13f1a01: defining beans [userServlet,UserBiz,userDao,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,c3p0DataSource,sessionFactory,txManager,txAdvice,org.springframework.aop.config.internalAutoProxyCreator,fooServiceOperation,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
    七月 21, 2013 12:45:52 上午 org.apache.coyote.AbstractProtocol start
    信息: Starting ProtocolHandler ["http-bio-8080"]
    七月 21, 2013 12:45:52 上午 org.apache.coyote.AbstractProtocol start
    信息: Starting ProtocolHandler ["ajp-bio-8009"]
    七月 21, 2013 12:45:52 上午 org.apache.catalina.startup.Catalina start
    信息: Server startup in 1710 ms
    我对spring不了解. 所以不知道问题出在哪了. 
    如果有问题的话应该是我的Action或者JSP页面有问题. 
    下面是我的这两个有可能出错的两个源代码
    com.zemo.hibernatespring.action.UserServlet package com.zemo.hibernatespring.action;import java.io.IOException;
    import java.util.List;import javax.annotation.Resource;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;import org.springframework.stereotype.Controller;import com.zemo.hibernatespring.bean.User;
    import com.zemo.hibernatespring.biz.UserBiz;@Controllerpublic class UserServlet extends HttpServlet {
    @Resource
    private UserBiz userBiz;

    private static final long serialVersionUID = -8609429659212933530L;
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    HttpSession session = request.getSession();
    List<User> users = userBiz.getAllUser();
    session.setAttribute("User", users);
    response.sendRedirect(request.getContextPath() + "/result.jsp");
    }
    }
    webapp/userList.jsp<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <!DOCTYPE taglib
    PUBLIC "-//Sun Microsystems, Inc//DTD JSP Tag Library 1//EN"
    "http://javasuncom/j2ee/dtds/web-jsptaglibrary_1_dtd"> 
    <html>
      <head>
        <title>SSH-用户列表</title>
      </head>
      
      <body>
       <table border="1" cellpadding="0" cellspacing="0" align="center" width="800">
       <tr>
       <th>ID</th>
       <th>用户名</th>
       <th>密码</th>
       </tr>
       <c:forEach items="${sessionScope.User}" var="p">
    <tr>
    <td>
    ${p.userId}
    </td>
    <td>
        ${p.userName}
    </td>
    <td>
        ${p.password}
    </td>
    </tr>
    </c:forEach>
       </table>
      </body>
    </html>
      

  2.   

    这是我的spring配置文件<?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:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
           http://www.springframework.org/schema/beans
             http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/tx
         http://www.springframework.org/schema/tx/spring-tx.xsd
         http://www.springframework.org/schema/aop
         http://www.springframework.org/schema/aop/spring-aop.xsd         
             http://www.springframework.org/schema/context
             http://www.springframework.org/schema/context/spring-context.xsd">
    <context:component-scan base-package="com.zemo.hibernatespring" /> <bean
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location" value="classpath:jdbc.properties" />
    </bean> <bean id="c3p0DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
    destroy-method="close">
    <property name="driverClass" value="${jdbc.driver_class}" />
    <property name="jdbcUrl" value="${jdbc.url}" />
    <property name="user" value="${jdbc.username}" />
    <property name="password" value="${jdbc.password}" />
    </bean> <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="c3p0DataSource" />
    <property name="annotatedClasses">
    <list>
    <value>com.zemo.hibernatespring.bean.User</value>
    </list>
    </property>
    <property name="hibernateProperties">
    <value>
    hibernate.dialect=${hibernate.dialect}
    hibernate.show_sql=${hibernate.show_sql}
    hibernate.form_sql=${hibernate.form_sql}
    hibernate.hbm2ddl.aut=${hibernate.hbm2ddl.aut}
                </value>
    </property> </bean>
    <bean id="txManager"
    class="org.springframework.orm.hibernate4.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <tx:advice id="txAdvice" transaction-manager="txManager">
    <!-- the transactional semantics... -->
    <tx:attributes>
    <!-- all methods starting with 'get' are read-only -->
    <tx:method name="get*" read-only="true" />
    <!-- other methods use the default transaction settings (see below) -->
    <tx:method name="*" />
    </tx:attributes>
    </tx:advice>
    <aop:config>
    <aop:pointcut id="fooServiceOperation"
    expression="execution(* com.zemo.hibernatespring.biz..*(..))" />
    <aop:advisor advice-ref="txAdvice" pointcut-ref="fooServiceOperation" />
    </aop:config>
    </beans>
             
      

  3.   

    问题出现在web.xml中<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>这段貌似跟struts有点关系. 
      

  4.   


    这是用tomcat部署后的执行结果. 
      

  5.   

    少Jar包吧
    严重: Context initialization failed
    java.lang.NoClassDefFoundError: org/aspectj/weaver/BCException加个aspectjweaver.jar试试
      

  6.   

    这个解决了.
    帮我看看http://bbs.csdn.net/topics/390524248吧. 
    还是这个程序. 
    不过应该是尾声了..T.T
     我已经弄了一个星期了. 
    要崩溃了.