日期:2014-05-18  浏览次数:20736 次

SSH的DAO 不能注入,main方法测试能注入,发布后就不行
我是新手,Spring版本为3.1,userService能注入Action,但是userDAO不能注入userService,
虽然用main方法中读取applicationContext.xml文件后getBean()能注入,但发布后就不行了,报错userDAO的NullPointerException,但在userService中我也写了getset方法啊,配置文件中配好了,这是为什么呢?
求大神救救我吧!!

下面是日志,我在userService的setUserDAO方法中输出了一条语句,“set user dao!”,启动时用调用到这个方法

···
org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
INFO - RDBMS: MySQL, version: 5.5.15
INFO - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.11 ( $Date: 2005-09-21 18:20:03 +0000 (Wed, 21 Sep 2005) $, $Revision: 4287 $ )
INFO - Using dialect: org.hibernate.dialect.MySQLInnoDBDialect
INFO - Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory
INFO - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
INFO - Automatic flush during beforeCompletion(): disabled
INFO - Automatic session close at end of transaction: disabled
INFO - JDBC batch size: 15
INFO - JDBC batch updates for versioned data: disabled
INFO - Scrollable result sets: enabled
INFO - JDBC3 getGeneratedKeys(): enabled
INFO - Connection release mode: auto
INFO - Maximum outer join fetch depth: 2
INFO - Default batch fetch size: 1
INFO - Generate SQL with comments: disabled
INFO - Order SQL updates by primary key: disabled
INFO - Order SQL inserts for batching: disabled
INFO - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
INFO - Using ASTQueryTranslatorFactory
INFO - Query language substitutions: {}
INFO - JPA-QL strict compliance: disabled
INFO - Second-level cache: enabled
INFO - Query cache: disabled
INFO - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
INFO - Optimize cache for minimal puts: disabled
INFO - Structured second-level cache entries: disabled
INFO - Echoing all SQL to stdout
INFO - Statistics: disabled