java - Hibernate dialect not defined error -


i have been facing issue application , not know wrong:

exception in thread "main" org.springframework.beans.factory.beancreationexception: error creating bean name 'auditeventmanager' defined in class path resource [manager-service.xml]: cannot resol ve reference bean 'transactionmanager' while setting bean property 'transactionmanager'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name ' transactionmanager' defined in class path resource [manager-persistence-standalone.xml]: cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exceptio n org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory' defined in class path resource [manager-persistence.xml]: invocation of init method failed;  nested exception org.hibernate.hibernateexception: 'hibernate.dialect' must set when no connection avalable         @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolvereference(beandefinitionvalueresolver.java:275)         @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolvevalueifnecessary(beandefinitionvalueresolver.java:104)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.applypropertyvalues(abstractautowirecapablebeanfactory.java:1245)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.populatebean(abstractautowirecapablebeanfactory.java:1010)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:472)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory$1.run(abstractautowirecapablebeanfactory.java:409)         @ java.security.accesscontroller.doprivileged(accesscontroller.java:224)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:380)         @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:264)         @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:222)         @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:261)         @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:185)         @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:164)         @ org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:423)         @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:728)         @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:380)         @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:139)         @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:93)         @ msimport.import.main(import.java:567) caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'transactionmanager' defined in class path resource [manager-persistence-standalone.xml]: cannot resol ve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionf actory' defined in class path resource [manager-persistence.xml]: invocation of init method failed; nested exception org.hibernate.hibernateexception: 'hibernate.dialect' must set when no connec tion avalable         @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolvereference(beandefinitionvalueresolver.java:275)         @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolvevalueifnecessary(beandefinitionvalueresolver.java:104)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.applypropertyvalues(abstractautowirecapablebeanfactory.java:1245)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.populatebean(abstractautowirecapablebeanfactory.java:1010)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:472)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory$1.run(abstractautowirecapablebeanfactory.java:409)         @ java.security.accesscontroller.doprivileged(accesscontroller.java:224)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:380)         @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:264)         @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:222)         @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:261)         @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:185)         @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:164)         @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolvereference(beandefinitionvalueresolver.java:269)         ... 18 more caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory' defined in class path resource [manager-persistence.xml]: invocation of init method f ailed; nested exception org.hibernate.hibernateexception: 'hibernate.dialect' must set when no connection avalable         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1338)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:473)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory$1.run(abstractautowirecapablebeanfactory.java:409)         @ java.security.accesscontroller.doprivileged(accesscontroller.java:224)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:380)         @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:264)         @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:222)         @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:261)         @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:185)         @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:164)         @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolvereference(beandefinitionvalueresolver.java:269)         ... 31 more caused by: org.hibernate.hibernateexception: 'hibernate.dialect' must set when no connection avalable         @ org.hibernate.dialect.resolver.dialectfactory.builddialect(dialectfactory.java:107)         @ org.hibernate.cfg.settingsfactory.buildsettings(settingsfactory.java:134)         @ org.hibernate.cfg.configuration.buildsettingsinternal(configuration.java:2119)         @ org.hibernate.cfg.configuration.buildsettings(configuration.java:2115)         @ org.hibernate.cfg.configuration.buildsessionfactory(configuration.java:1339)         @ org.springframework.orm.hibernate3.localsessionfactorybean.newsessionfactory(localsessionfactorybean.java:814)         @ org.springframework.orm.hibernate3.localsessionfactorybean.buildsessionfactory(localsessionfactorybean.java:732)         @ org.springframework.orm.hibernate3.abstractsessionfactorybean.afterpropertiesset(abstractsessionfactorybean.java:211)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokeinitmethods(abstractautowirecapablebeanfactory.java:1369)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1335)         ... 41 more 

this happens if can't connect database, or hibernate can't work out dialect use. important bit is:

org.hibernate.hibernateexception: 'hibernate.dialect' must set when no connection available 

if don't provide database dialect, hibernate tries work out dialect use using metadata returned jdbc driver. however, if can't connect database, or reason can't find metadata, can't this, , message.

  1. check database connection url, , make sure database available, , check jdbc driver class specified correctly.
  2. in general, specify hibernate dialect, avoid problems. see hibernate session configuration - optional configuration.

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -