问题描述
老是报空指针异常。以下是applicationContext.xml的配置文件,<beanid="dataSource"class="org.logicalcobwebs.proxool.ProxoolDataSource"><propertyname="driver"value="oracle.jdbc.driver.OracleDriver"/><propertyname="driverUrl"value="jdbc:oracle:thin:@127.0.0.1:1521:PROMANDB"/><propertyname="user"value="root"/><propertyname="password"value="123"/><propertyname="houseKeepingSleepTime"value="20000"/><propertyname="prototypeCount"value="5"/><propertyname="minimumConnectionCount"value="10"/><propertyname="maximumConnectionCount"value="150"/><propertyname="simultaneousBuildThrottle"value="100"/><propertyname="houseKeepingTestSql"value="select1fromdual"/></bean><!--以下为spring管理下的oraclehibernatesessinoFactory配置其中mappingResources为开发时需添加的映射文件相对路径名称--><beanid="sessionFactory"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><propertyname="dataSource"><refbean="dataSource"/></property><propertyname="mappingLocations"><list><value>classpath:com/gocom/beans/tbNodeFileInfoMapping.hbm.xml</value><value>classpath:com/gocom/beans/tbProjectInfoMapping.hbm.xml</value></list></property><propertyname="hibernateProperties"><props><propkey="hibernate.show_sql">true</prop><propkey="hibernate.dialect">org.hibernate.dialect.Oracle9iDialect</prop><propkey="hibernate.hbm2ddl.auto">update</prop></props></property></bean><!--以下为spring提供的hibernate事务管理类--><beanid="hibernateTransactionManager"class="org.springframework.orm.hibernate3.HibernateTransactionManager"><propertyname="sessionFactory"><refbean="sessionFactory"/></property></bean><!--将Dao注入进来--><beanid="tbProjectInfoDao"class="com.gocom.dao.TbProjectInfoDao"><propertyname="sessionFactory"><refbean="sessionFactory"/></property></bean><!--以下为事务代理类,其中"key"为匹配方法名称前缀--><beanid="daoProxy"class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"abstract="true"><propertyname="proxyTargetClass"><value>true</value></property><propertyname="transactionManager"><refbean="hibernateTransactionManager"/></property><propertyname="transactionAttributes"><props><propkey="save*">PROPAGATION_REQUIRED</prop><propkey="update*">PROPAGATION_REQUIRED</prop><propkey="delete*">PROPAGATION_REQUIRED</prop><propkey="find*">PROPAGATION_REQUIRED,readOnly</prop></props></property></bean><!--以下为视图映射配置--><beanid="viewResolver"class="org.springframework.web.servlet.view.XmlViewResolver"/><beanid="viewResolverInternalResource"class="org.springframework.web.servlet.view.InternalResourceViewResolver"><propertyname="viewClass"value="org.springframework.web.servlet.view.JstlView"/><propertyname="prefix"value=""/><propertyname="suffix"value=".jsp"/></bean>而在dao里调用getHibernateTemplate().save(obj)来保存对象的时候报空指针异常,java.lang.NullPointerExceptionatcom.gocom.dao.TbProjectInfoDao.saveProjectInfo(TbProjectInfoDao.java:14)atcom.gocom.controller.AddProjectController.handleRequest(AddProjectController.java:66)atorg.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)atorg.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:874)atorg.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:808)atorg.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)atorg.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:709)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:802)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)atorg.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)atorg.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)atorg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)atorg.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)atorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)atorg.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)atorg.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)atorg.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)atorg.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)atorg.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)atjava.lang.Thread.run(Thread.java:595其中的saveProjectInfo()方法就是publicvoidsaveProjectInfo(TbProjectInfoobj){getHibernateTemplate().save(obj);}请大家帮帮忙·