SSH項目練習的時候報錯:[applicationContext.xml]: Invocation of init method failed;

來源:互聯網
上載者:User

標籤:

這裡是控制台的報錯資訊:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: could not instantiate id generator [entity-name=com.tes.entity.Cost] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4729) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)Caused by: org.hibernate.MappingException: could not instantiate id generator [entity-name=com.tes.entity.Cost] at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:109) at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:197) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1313) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335) ... 24 moreCaused by: org.hibernate.MappingException: Dialect does not support sequences at org.hibernate.dialect.Dialect.getSequenceNextValString(Dialect.java:619) at org.hibernate.id.SequenceGenerator.configure(SequenceGenerator.java:65) at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:104) ... 32 more

下面是applicationContext.xml檔案資訊:

<!-- 配置SessionFactory --><bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><!-- 依賴資料來源 --><property name="dataSource" ref="db"/><!-- Hibernate架構相關配置 --><property name="hibernateProperties"><props><!-- 設定資料庫方言 --><prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop><!-- 顯示SQL --> <prop key="hibernate.show_sql">true</prop><!-- 格式化SQL --> <prop key="hibernate.formate_sql">true</prop><!-- 查詢快取 <prop key="hibernate.cache.use_query_cache">true</prop> //二級緩衝 <prop key="hibernate.cache.use_second_level_cache">false</prop> --> </props></property><property name="mappingResources"><list><value>com/tes/entity/Cost.hbm.xml</value></list></property></bean>

  

SSH項目練習的時候報錯:[applicationContext.xml]: Invocation of init method failed;

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.