严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
给你一个模板看看。
3. 在web.xml文件里添加以下配置:
<!-- 下面两配置是为让Tomcat启动时自动加载Spring容器 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!-- struts的配置 -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
4. struts-config.xml文件里的配置:
<form-beans>
<form-bean name="loginform" type="form.LoginForm"></form-bean>
……
</form-beans>
<action-mappings>
<!-- 此处使用Spring提供的代理 -->
<action path="/login" name="loginform"
type="org.springframework.web.struts.DelegatingActionProxy" scope="request">
<forward name="success" path="/main.jsp"></forward>
<forward name="fail" path="/fail.jsp"></forward>
</action>…… </action-mappings>
5. applicationContext.xml文件里的配置:
<!-- sessionFactory的一种配置方法,通过hibernate.cfg.xml -->
<bean id="sessionfactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>