SSI空指针异常,帮忙解决
sprint 配置:
XML code<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="username" value="ssi"/>
<property name="password" value="ssi"/>
<property name="url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
</bean>
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="classpath:SqlMapConfig.xml">
</property>
<property name="dataSource" ref="dataSource">
</property>
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
<bean id="sqlMapClientProxyFactoryBean" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true">
<property name="transactionManager" ref="transactionManager"></property>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="select*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate">
<property name="sqlMapClient" ref="sqlMapClient"></property>
</bean>
<bean id="userDao" class="com.soft.ssi.dao.UserDaoImpl">
<property name="sqlMapClientTemplate" ref="sqlMapClientTemplate"></property>
</bean>
<bean id="userService" class="com.soft.ssi.service.UserServiceImpl">
<property name="userDao" ref="userDao"></property>
</bean>
<bean id="userServicePrxy" parent="sqlMapClientProxyFactoryBean">
<property name="target" ref="userService"></property>
</bean>
<bean name="/user" class="com.soft.ssi.web.UserAction">
<property name="userService" ref="userService"></property>
</bean>
</beans>
userinfo.xml配置
XML code<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap
PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="UserInfo" >
<typeAlias alias="UserInfo" type="com.soft.ssi.po.UserInfo"/>
<insert id="insertUser" parameterClass="UserInfo">
<selectKey resultClass="int" keyProperty="userid" >
<![CDATA[
select SEQ_T_USER.NEXTVAL as userid from dual
]]>
</selectKey>
<![CDATA[
insert t_user(n_userid,v_username,v_password,v_sex,v_old) values(#userid#,#username#,#password#,#sex#,#old#)
]]>
</insert>
</sqlMap>
sqlMapConfig.xml配置
XML code<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<settings
lazyLoadingEnabled="false"
enhancementEnabled="true"
useStatementNamespaces="true" />
<sqlMap resource="com/soft/ssi/po/UserInfo.xml"/>
</sqlMapConfig>