2013-04-06 23:49:57,734  INFO (org.springframework.web.context.ContextLoader:189) - Root WebApplicationContext: initialization started
2013-04-06 23:49:57,875  INFO (org.springframework.web.context.support.XmlWebApplicationContext:412) - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@87400: display name [Root WebApplicationContext]; startup date [Sat Apr 06 23:49:57 CST 2013]; root of context hierarchy
2013-04-06 23:49:58,125  INFO (org.springframework.beans.factory.xml.XmlBeanDefinitionReader:323) - Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
2013-04-06 23:49:59,203  INFO (org.springframework.web.context.support.XmlWebApplicationContext:427) - Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@87400]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1553d18
2013-04-06 23:49:59,734  INFO (org.springframework.beans.factory.support.DefaultListableBeanFactory:414) - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1553d18: defining beans [sessionFactory,AdminDAO,VoteDAO,VoterDAO,VoteContextDAO,adminService,VoteService,VoterService,VoteContextService,transactionManager,transactionInterceptor,ProxyCreator,login,logout,createAdmin]; root of factory hierarchy
2013-04-06 23:49:59,890  INFO (org.hibernate.cfg.Environment:514) - Hibernate 3.2.5
2013-04-06 23:49:59,890  INFO (org.hibernate.cfg.Environment:547) - hibernate.properties not found
2013-04-06 23:49:59,890  INFO (org.hibernate.cfg.Environment:681) - Bytecode provider name : cglib
2013-04-06 23:49:59,921  INFO (org.hibernate.cfg.Environment:598) - using JDK 1.4 java.sql.Timestamp handling
2013-04-06 23:50:00,187  INFO (org.hibernate.cfg.Configuration:1441) - configuring from url: file:/C:/Tomcat/webapps/toupiao/WEB-INF/classes/hibernate.cfg.xml
2013-04-06 23:50:00,437  INFO (org.hibernate.cfg.Configuration:553) - Reading mappings from resource : model/Admin.hbm.xml
2013-04-06 23:50:00,703  INFO (org.hibernate.cfg.HbmBinder:300) - Mapping class: model.Admin -> admin
2013-04-06 23:50:00,765  INFO (org.hibernate.cfg.Configuration:553) - Reading mappings from resource : model/Vote.hbm.xml
2013-04-06 23:50:00,796  INFO (org.hibernate.cfg.HbmBinder:300) - Mapping class: model.Vote -> vote
2013-04-06 23:50:00,796  INFO (org.hibernate.cfg.Configuration:553) - Reading mappings from resource : model/Votecontext.hbm.xml
2013-04-06 23:50:00,812  INFO (org.hibernate.cfg.HbmBinder:300) - Mapping class: model.Votecontext -> votecontext
2013-04-06 23:50:00,812  INFO (org.hibernate.cfg.Configuration:553) - Reading mappings from resource : model/Voter.hbm.xml
2013-04-06 23:50:00,828  INFO (org.hibernate.cfg.HbmBinder:300) - Mapping class: model.Voter -> voter
2013-04-06 23:50:00,828  INFO (org.hibernate.cfg.Configuration:1541) - Configured SessionFactory: null
2013-04-06 23:50:00,828  INFO (org.springframework.orm.hibernate3.LocalSessionFactoryBean:738) - Building new Hibernate SessionFactory
2013-04-06 23:50:01,078  INFO (org.hibernate.connection.DriverManagerConnectionProvider:41) - Using Hibernate built-in connection pool (not for production use!)
2013-04-06 23:50:01,078  INFO (org.hibernate.connection.DriverManagerConnectionProvider:42) - Hibernate connection pool size: 20
2013-04-06 23:50:01,078  INFO (org.hibernate.connection.DriverManagerConnectionProvider:45) - autocommit mode: false
2013-04-06 23:50:01,093  INFO (org.hibernate.connection.DriverManagerConnectionProvider:80) - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/vote
2013-04-06 23:50:01,093  INFO (org.hibernate.connection.DriverManagerConnectionProvider:86) - connection properties: {user=root, password=****, release_mode=on_close}
2013-04-06 23:50:01,437  INFO (org.hibernate.cfg.SettingsFactory:89) - RDBMS: MySQL, version: 5.1.47-community
2013-04-06 23:50:01,437  INFO (org.hibernate.cfg.SettingsFactory:90) - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.14 ( $Date: 2006-10-18 17:40:15 +0200 (Wed, 18 Oct 2006) $, $Revision: 5888 $ )
2013-04-06 23:50:01,531  INFO (org.hibernate.dialect.Dialect:152) - Using dialect: org.hibernate.dialect.MySQLDialect
2013-04-06 23:50:01,562  INFO (org.hibernate.transaction.TransactionFactoryFactory:31) - Using default transaction strategy (direct JDBC transactions)
2013-04-06 23:50:01,562  INFO (org.hibernate.transaction.TransactionManagerLookupFactory:33) - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2013-04-06 23:50:01,562  INFO (org.hibernate.cfg.SettingsFactory:143) - Automatic flush during beforeCompletion(): disabled
2013-04-06 23:50:01,562  INFO (org.hibernate.cfg.SettingsFactory:147) - Automatic session close at end of transaction: disabled
2013-04-06 23:50:01,562  INFO (org.hibernate.cfg.SettingsFactory:154) - JDBC batch size: 15
2013-04-06 23:50:01,562  INFO (org.hibernate.cfg.SettingsFactory:157) - JDBC batch updates for versioned data: disabled
2013-04-06 23:50:01,562  INFO (org.hibernate.cfg.SettingsFactory:162) - Scrollable result sets: enabled
2013-04-06 23:50:01,562  INFO (org.hibernate.cfg.SettingsFactory:170) - JDBC3 getGeneratedKeys(): enabled
2013-04-06 23:50:01,562  INFO (org.hibernate.cfg.SettingsFactory:178) - Connection release mode: on_close
2013-04-06 23:50:01,562  INFO (org.hibernate.cfg.SettingsFactory:202) - Maximum outer join fetch depth: 2
2013-04-06 23:50:01,562  INFO (org.hibernate.cfg.SettingsFactory:205) - Default batch fetch size: 1
2013-04-06 23:50:01,562  INFO (org.hibernate.cfg.SettingsFactory:209) - Generate SQL with comments: disabled
2013-04-06 23:50:01,562  INFO (org.hibernate.cfg.SettingsFactory:213) - Order SQL updates by primary key: disabled
2013-04-06 23:50:01,562  INFO (org.hibernate.cfg.SettingsFactory:217) - Order SQL inserts for batching: disabled
2013-04-06 23:50:01,562  INFO (org.hibernate.cfg.SettingsFactory:386) - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2013-04-06 23:50:01,578  INFO (org.hibernate.hql.ast.ASTQueryTranslatorFactory:24) - Using ASTQueryTranslatorFactory
2013-04-06 23:50:01,578  INFO (org.hibernate.cfg.SettingsFactory:225) - Query language substitutions: {}
2013-04-06 23:50:01,578  INFO (org.hibernate.cfg.SettingsFactory:230) - JPA-QL strict compliance: disabled
2013-04-06 23:50:01,578  INFO (org.hibernate.cfg.SettingsFactory:235) - Second-level cache: enabled
2013-04-06 23:50:01,593  INFO (org.hibernate.cfg.SettingsFactory:239) - Query cache: disabled
2013-04-06 23:50:01,593  INFO (org.hibernate.cfg.SettingsFactory:373) - Cache provider: org.hibernate.cache.NoCacheProvider
2013-04-06 23:50:01,593  INFO (org.hibernate.cfg.SettingsFactory:254) - Optimize cache for minimal puts: disabled
2013-04-06 23:50:01,593  INFO (org.hibernate.cfg.SettingsFactory:263) - Structured second-level cache entries: disabled
2013-04-06 23:50:01,609  INFO (org.hibernate.cfg.SettingsFactory:283) - Echoing all SQL to stdout
2013-04-06 23:50:01,625  INFO (org.hibernate.cfg.SettingsFactory:290) - Statistics: disabled
2013-04-06 23:50:01,625  INFO (org.hibernate.cfg.SettingsFactory:294) - Deleted entity synthetic identifier rollback: disabled
2013-04-06 23:50:01,625  INFO (org.hibernate.cfg.SettingsFactory:309) - Default entity-mode: pojo
2013-04-06 23:50:01,625  INFO (org.hibernate.cfg.SettingsFactory:313) - Named query checking : enabled
2013-04-06 23:50:01,734  INFO (org.hibernate.impl.SessionFactoryImpl:161) - building session factory
2013-04-06 23:50:02,796  INFO (org.hibernate.impl.SessionFactoryObjectFactory:82) - Not binding factory to JNDI, no JNDI name configured
2013-04-06 23:50:03,031  INFO (org.springframework.beans.factory.support.DefaultListableBeanFactory:396) - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1553d18: defining beans [sessionFactory,AdminDAO,VoteDAO,VoterDAO,VoteContextDAO,adminService,VoteService,VoterService,VoteContextService,transactionManager,transactionInterceptor,ProxyCreator,login,logout,createAdmin]; root of factory hierarchy
2013-04-06 23:50:03,031  INFO (org.springframework.orm.hibernate3.LocalSessionFactoryBean:184) - Closing Hibernate SessionFactory
2013-04-06 23:50:03,031  INFO (org.hibernate.impl.SessionFactoryImpl:769) - closing
2013-04-06 23:50:03,031  INFO (org.hibernate.connection.DriverManagerConnectionProvider:147) - cleaning up connection pool: jdbc:mysql://localhost/vote
2013-04-06 23:50:03,031 ERROR (org.springframework.web.context.ContextLoader:215) - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adminService' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: sessionFactory or hibernateTemplate is required

<?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="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
<!-- dao -->
<bean id="AdminDAO" class="dao.impl.AdminImpl">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>

<!-- service -->
<bean id="adminService" class="service.impl.AdminServiceImpl">
<property name="ad">
<ref bean="AdminDAO" />
</property>
</bean>
</beans>
网上查了大半天资料,答案诸如此类:由于Spring中的“asm-2.2.3.jar”和Hibernate中的“asm.jar”包冲突。解决办法是移除Spring2.0 AOP Libraries中的“asm-2.2.3.jar”即可;缺少JAR包commons-pool.jar  ejb3-persistence.jar;我都照做了,问题依旧,请高人帮我查查错误处在哪啊...SSH

解决方案 »

  1.   

    hibernate.properties not found 需要一个小的配置文件
      

  2.   

    改为:
    <bean id="adminService" class="service.impl.AdminServiceImpl">
    <property name="ad">
    <ref bean="AdminDAO" />
    </property>
    <property name="sessionFactory" ref="sessionFactory"></property> 
    </bean>
      

  3.   

     INFO (org.hibernate.impl.SessionFactoryObjectFactory:82) - Not binding factory to JNDI, no JNDI name configured
    看看那配置文件的sessionfactory有关的配置
      

  4.   

     Error creating bean with name 'adminService' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: sessionFactory or hibernateTemplate is required
    <bean id="adminService" class="service.impl.AdminServiceImpl">
    这个类继承那个类了吗建议看看
    http://justplayoop1.iteye.com/blog/1461642
      

  5.   

    是继承HibernateDaoSupport这个类吗,我继承了啊
      

  6.   

    看下http://justplayoop1.iteye.com/blog/1461642文章:
    继承了org.springframework.orm.hibernate3.support.HibernateDaoSupport,spring在初始化容器的时候会对这个对象作一个check, 看下HibernateDaoSupport源码中的checkDaoConfig()方法 就清楚啦:     protected final void checkDaoConfig() {      
                if (this.hibernateTemplate == null) {      
                    throw new IllegalArgumentException ("'sessionFactory' or 'hibernateTemplate' is required");    
                 }      
             }   所以,在AdminServiceImpl对象一定要注入一个sessionFactory or hibernateTemplate对象。
      

  7.   

    我也看过了,能详细解释一下吗,我已经把DAO注入进来了啊