admin
管理员
管理员
  • UID1
  • 粉丝1
  • 关注0
  • 发帖数378
  • 社区居民
  • 忠实会员
  • 原创写手
阅读:601回复:0

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto

楼主#
更多 发布于:2015-12-23 09:05
<2012-10-23 上午11时44分57秒 CST> <Warning> <HTTP> <BEA-101162> <User defined listener org.springframework.web.context.ContextLoaderListener failed:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: could not instantiate id generator.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: could not instantiate id generator
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1175)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:428)
 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
 Truncated. see log file for complete stacktrace
org.hibernate.MappingException: could not instantiate id generator
 at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:98)
 at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152)
 at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:192)
 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
 at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:805)
 Truncated. see log file for complete stacktrace
org.hibernate.MappingException: Dialect does not support sequences
 at org.hibernate.dialect.Dialect.getSequenceNextValString(Dialect.java:595)
 at org.hibernate.id.SequenceGenerator.configure(SequenceGenerator.java:65)
 at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:94)
 at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152)
 at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:192)
 Truncated. see log file for complete stacktrace
>
<2012-10-23 上午11时44分57秒 CST> <Error> <Deployer> <BEA-149231> <Unable to set the activation state to true for the application 'xyssh'.
weblogic.application.ModuleException:
 at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1373)
 at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:468)
 at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
 at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
 at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
 Truncated. see log file for complete stacktrace
org.hibernate.MappingException: Dialect does not support sequences
 at org.hibernate.dialect.Dialect.getSequenceNextValString(Dialect.java:595)
 at org.hibernate.id.SequenceGenerator.configure(SequenceGenerator.java:65)
 at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:94)
 at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152)
 at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:192)
 Truncated. see log file for complete stacktrace
>


看了半天才发现,原来是映射文件中的主键生成方式有问题
<hibernate-mapping>
    <class name="xiayu.com.vo.User" table="user" catalog="xy">
        <id name="merId" type="java.lang.Integer">
            <column name="merId" />
            <generator class="sequence" />
        </id>
        <many-to-one name="dept" class="xiayu.com.vo.Dept" fetch="select">
            <column name="deptId" />
        </many-to-one>
        <property name="merName" type="java.lang.String">
            <column name="merName" length="20" />
        </property>
        <property name="merPwd" type="java.lang.String">
            <column name="merPwd" length="20" />
        </property>
    </class>
</hibernate-mapping>

数据库主键的生成方式是自动增长,在Hibernate反转的时候选成了序列,把这里改成native就可以了

 

 

 

 

 

 

 

异常中心网是一家专门收集整理程序员编程过程中遇到的常见异常(exception)以及各种异常问答中心的网站。异常中心网旨在,减少程序员在编码遇到异常,处理各种异常时间和痛苦,让程序员能更愉快的、快速的定位异常并查找对应的异常解决方案。异常中心网诚心打造最完美的编程社区为程序员用户服务,努力成为最好的程序员乐园程序员社区程序异常中心程序bug中心异常问答中心

 

喜欢0 评分0
游客

返回顶部