2 smiles man Smiles_man 于 2014.02.11 10:38 提问

非典型SSH项目,启动服务器,出现如下错误,求大神支招

10:19:56.250 WARN org.hibernate.ejb.Ejb3Configuration[1132] - HHH000144: hibernate.connection.autocommit = false breaks the EJB3 specification

10:19:56.745 WARN o.h.e.jdbc.internal.JdbcServicesImpl[169] - HHH000342: Could not obtain connection to query metadata : Driver:net.sf.log4jdbc.DriverSpy@ef57f8 returned null for URL:jdbc:log4jdbc:mysql://localhost:3306/crmdb?useUnicode=true&characterEncoding=utf-8

10:19:56.760 ERROR o.s.web.context.ContextLoader[307] - Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in file [D:\dev\tools\springsource\vfabric-tc-server-developer-2.8.2.RELEASE\base-instance\wtpwebapps\operation-crm\WEB-INF\classes\context\spring-context.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build EntityManagerFactory
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:734) ~[spring-context-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:457) ~[spring-context-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383) ~[spring-web-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283) ~[spring-web-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) [spring-web-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797) [catalina.jar:7.0.35.B]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291) [catalina.jar:7.0.35.B]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.35.B]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) [catalina.jar:7.0.35.B]
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) [catalina.jar:7.0.35.B]
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) [catalina.jar:7.0.35.B]
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657) [catalina.jar:7.0.35.B]
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1637) [catalina.jar:7.0.35.B]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [na:1.6.0_32]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_32]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_32]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_32]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_32]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_32]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in file [D:\dev\tools\springsource\vfabric-tc-server-developer-2.8.2.RELEASE\base-instance\wtpwebapps\operation-crm\WEB-INF\classes\context\spring-context.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build EntityManagerFactory
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:420) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:277) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:139) ~[spring-tx-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.(PersistenceExceptionTranslationInterceptor.java:79) ~[spring-tx-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.(PersistenceExceptionTranslationAdvisor.java:70) ~[spring-tx-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:103) ~[spring-tx-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1475) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1443) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
... 24 common frames omitted
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915) ~[hibernate-entitymanager-4.1.8.Final.jar:4.1.8.Final]
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890) ~[hibernate-entitymanager-4.1.8.Final.jar:4.1.8.Final]
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) ~[hibernate-entitymanager-4.1.8.Final.jar:4.1.8.Final]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:287) ~[spring-orm-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310) ~[spring-orm-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
... 39 common frames omitted
Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:97) ~[hibernate-core-4.1.8.Final.jar:4.1.8.Final]
at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:67) ~[hibernate-core-4.1.8.Final.jar:4.1.8.Final]
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:170) ~[hibernate-core-4.1.8.Final.jar:4.1.8.Final]
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75) ~[hibernate-core-4.1.8.Final.jar:4.1.8.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159) ~[hibernate-core-4.1.8.Final.jar:4.1.8.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) ~[hibernate-core-4.1.8.Final.jar:4.1.8.Final]
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:77) ~[hibernate-core-4.1.8.Final.jar:4.1.8.Final]
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2283) ~[hibernate-core-4.1.8.Final.jar:4.1.8.Final]
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2279) ~[hibernate-core-4.1.8.Final.jar:4.1.8.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1748) ~[hibernate-core-4.1.8.Final.jar:4.1.8.Final]
at org.hibernate.ejb.EntityManagerFactoryImpl.(EntityManagerFactoryImpl.java:94) ~[hibernate-entitymanager-4.1.8.Final.jar:4.1.8.Final]
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905) ~[hibernate-entitymanager-4.1.8.Final.jar:4.1.8.Final]
... 45 common frames omitted
10:19:56.761 DEBUG l.s.c.w.l.ApplicationContextPostListener[35] - Invoke ApplicationContextPostListener contextInitialized

2个回答

p451933505
p451933505   2014.02.11 11:47

你使用的是mysql数据库,检查下connection.url的是否正确,我看你的异常里面显示的是URL:jdbc:log4jdbc:mysql://localhost:3306/crmdb?useUnicode=true&characterEncoding=utf-8,不应该是这样

Smiles_man
Smiles_man 我一开始也关注到这个了,但我和之前项目对比,这句话没有问题,我感觉应该是其他地方影响的
接近 4 年之前 回复
Smiles_man
Smiles_man   2014.02.13 10:04

问题原因找到了,Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
方言没有加到spring-context里面,所以当spring初始化bin类的时候没有找到方言,就会报错

p451933505
p451933505 解决了就好
接近 4 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!