ssh配置出错,一直找不出原因
这是applicationContext的配置<beanid="dataSource"class="com.mchange.v2.c3p0.ComboPooledData...
这是applicationContext的配置
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"></property>
<property name="jdbcUrl" value="jdbc:oracle:thin:@localhost:1521:orcl"></property>
<property name="user" value="ssh"></property>
<property name="password" value="ccb"></property>
<property name="minPoolSize" value="1"></property>
<property name="maxPoolSize" value="20"></property>
<property name="initialPoolSize" value="1"></property>
<property name="maxIdleTime" value="20"></property>
</bean>
<!-- Hibernate的SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.jdbc.batch_size">35</prop>
<prop key="hibernate.jdbc.fetch_size">80</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>test1/po/Users.hbm.xml</value>
</list>
</property>
</bean>
<bean id="userDao" class="test1.impl.UsersImpl"> <property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<bean id="mgr" class="test1.impl.UsersManagerImpl">
<property name="userDao">
<ref bean="userDao"/>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
============================================
UsersImpl的一个测试
信息: Server startup in 9532 ms
null
2013-1-3 12:40:18 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
严重: Exception occurred during processing request: null
java.lang.NullPointerException
at test1.impl.UsersImpl.findAll(UsersImpl.java:44)
at test1.action.LoginAction.execute(LoginAction.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597) 展开
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"></property>
<property name="jdbcUrl" value="jdbc:oracle:thin:@localhost:1521:orcl"></property>
<property name="user" value="ssh"></property>
<property name="password" value="ccb"></property>
<property name="minPoolSize" value="1"></property>
<property name="maxPoolSize" value="20"></property>
<property name="initialPoolSize" value="1"></property>
<property name="maxIdleTime" value="20"></property>
</bean>
<!-- Hibernate的SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.jdbc.batch_size">35</prop>
<prop key="hibernate.jdbc.fetch_size">80</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>test1/po/Users.hbm.xml</value>
</list>
</property>
</bean>
<bean id="userDao" class="test1.impl.UsersImpl"> <property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<bean id="mgr" class="test1.impl.UsersManagerImpl">
<property name="userDao">
<ref bean="userDao"/>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
============================================
UsersImpl的一个测试
信息: Server startup in 9532 ms
null
2013-1-3 12:40:18 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
严重: Exception occurred during processing request: null
java.lang.NullPointerException
at test1.impl.UsersImpl.findAll(UsersImpl.java:44)
at test1.action.LoginAction.execute(LoginAction.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597) 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询