如题:java.lang.NullPointerException异常
代码如下:
applicationContext.xml的内容
<?xml version= "1.0 " encoding= "UTF-8 "?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN " "http://www.springframework.org/dtd/spring-beans.dtd ">
<beans>
<bean id= "dataSource "
class= "org.apache.commons.dbcp.BasicDataSource ">
<property name= "driverClassName ">
<value> com.microsoft.jdbc.sqlserver.SQLServerDriver </value>
</property>
<property name= "url ">
<value> jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs </value>
</property>
<property name= "username ">
<value> sa </value>
</property>
<property name= "password ">
<value> 123 </value>
</property>
</bean>
<bean id= "sessionFactory "
class= "org.springframework.orm.hibernate3.LocalSessionFactoryBean ">
<property name= "dataSource ">
<ref bean= "dataSource " />
</property>
<property name= "mappingResources ">
<list>
<value> com/yourcompany/hibernate/usermanager.hbm.xml </value>
</list>
</property>
<property name= "hibernateProperties ">
<props>
<prop key= "hibernate.dialect "> org.hibernate.dialect.SQLServerDialect </prop>
<prop key= "hibernate.show_sql ">
true
</prop>
</props>
</property>
</bean>
<bean id= "transactionManager "
class= "org.springframework.orm.hibernate3.HibernateTransactionManager ">
<property name= "sessionFactory ">
<ref local= "sessionFactory " />
</property>
</bean>
<!-- Spring的数据访问异常转换器(Data Access Exception Translator)定义 -->
<bean id= "jdbcExceptionTranslator " class= "org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator ">
<property name= "dataSource ">
<ref bean= "dataSource " />
</property>
</bean>
<!-- Hibernate Template定义 -->
<bean id= "hibernateTemplate " class= "org.springframework.orm.hibernate3.HibernateTemplate ">
<property name= "sessionFactory ">
<ref bean= "sessionFactory " />
</property>
<property name= "jdbcExceptionTranslator ">
<ref bean= "jdbcExceptionTranslator " />
</property>
</bean>
<!--baseTransactionProxy -->
<bean abstract= "true " class= "org.springframework.transaction.interceptor.TransactionProxyFactoryBean " id= "baseTransactionProxy ">
<property name= "transactionManager ">
<ref bean= "transactionManager " />
</property>
<property name= "transactionAttributes ">
<props>
<prop key= "save* "> PROPAGATION_REQUIRED </prop>
<prop key= "update* "> PROPAGATION_REQUIRED </prop>
<prop key= "find* "> PROPAGATION_REQUIRED </prop>