Coach Thrasher
troubleshooting hibernate3 configuration
I've been trying to get hibernate 3 to run on my Tomcat 5.5 system for hours now. I finally found the problem/solution, but man, what a pain to find! The error being thrown from tomcat was:
"database product name cannot be null"
This was being thrown when hibernate was first loading. I found the message on line 57 of org.hibernate.dialect.DialectFactory:
throw new HibernateException( "database product name cannot be null" );
I traced the call through the code back to the Environment.java file - it appeard that the configuration/environment was not getting loaded.
I was trying to use the hibernate.cfg.xml file to configure hibernate, so after switching between hibernate.properties and the .cfg.xml several times, I finally found the answer: neither one was getting picked up.
The solution is to initalize hibernate to load the .cfg.xml (which is implied to live in the classpath somewhere). Here's the fix on my HibernateDataAdapter singleton:
Configuration config = new Configuration(); config.configure().buildSessionFactory();//default loading form hibernate.cfg.xml
With this change, it finally works. Geeze, what a pain - 6 hours wasted.
Jason
Posted at 03:54PM Aug 30, 2005 by jason in Software | Comments[0]