提示空指针java.lang.NullPointerException
这是applicationContext。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:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"
default-autowire="byName" default-lazy-init="true">
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass"
value="com.mysql.jdbc.Driver">
</property>
<!-- 服务器数据库 -->
<property name="jdbcUrl"
value="jdbc:mysql://localhost:3306/senlin?useUnicode=true&characterEncoding=UTF-8">
</property>
<property name="user" value="root"></property>
<property name="password" value="123456"></property>
<property name="minPoolSize" value="20"/>
<property name="maxPoolSize" value="100"/>
<property name="maxIdleTime" value="10"/>
<property name="acquireIncrement" value="5"/>
<property name="maxStatements" value="0"/>
<property name="initialPoolSize" value="20"/>
<property name="idleConnectionTestPeriod" value="10"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="packagesToScan">
<list>
<value>cn.edu.zucc.senlin.model.User</value>
</list>
</property>
</bean>
<!-- 配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<!-- 配置事务的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<!-- 哪些类的哪些方法参与事务 -->
<aop:config proxy-target-class="true">
<aop:advisor pointcut="execution(* cn.edu.zucc.senlin.dao.*.*(..))" advice-ref="txAdvice"/>
</aop:config>
<bean id="userManage" class="cn.edu.zucc.senlin.action.UserManage" scope="prototype">
<!-- <property name="userDAO" ref="userDAO"></property> -->
</bean>
<bean id="userDAO" class="cn.edu.zucc.senlin.dao.UserDAO">
</bean>
<bean id="baseDAO" class="cn.edu.zucc.senlin.dao.BaseDAO">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
</beans>
这是web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- 加载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>
<!-- struts2 的配置 -->
<filter>
<!-- 定义核心Filter的名字 -->
<filter-name>struts2</filter-name>
<!-- 定义核心Filter的实现类 -->
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<!-- FilterDispatcher用来初始化Struts 2并且处理所有的Web请求 -->
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>