-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: HibernateException: database product name cannot be null
PostPosted: Thu Oct 27, 2005 8:22 am 
Newbie

Joined: Thu Oct 27, 2005 7:59 am
Posts: 5
Hi,

I'm trying to integrate hibernate to tapestry 4.0 (beta-11) and hivemind (1.1).

i have hibernate.properties located in context/WEB-INF/classes the same place where all my classfiles for the webapp are also.

it includes
hibernate.connection.datasource java:comp/env/jdbc/mysql-t4
hibernate.dialect org.hibernate.dialect.MySQLDialect

datasource mysql-t4 has been configured correctly in tomcat (5.5.12) and i can connect and query the database from jsps.

but when i try to run the tapestry-hivemind application i get
org.hibernate.HibernateException: database product name cannot be null

if have tried using also MySQLInnoDBDialect and MySQLMyISAMDialect but it doesnt help

hibernate3.jar is located in catalina_home/shared/lib so the server should
have access to dialect classes (and its not classnotfound exception anyways)

i cant see any exceptions or warnings in console or logs when i deploy and run the webapp.

how can i be sure that the properties file is loaded correctly? is there something else that could be wrong? is the properties file in wrong place?


Hibernate version:
3.0.5

Full stack trace of any exception that occurs:
# org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57)
# org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)
# org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:374)
# org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:110)
# org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
# org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
# com.ttdev.customerCRUD.DefaultSessionCreator.<init>(DefaultSessionCreator.java:12)
# sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
# sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
# sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
# java.lang.reflect.Constructor.newInstance(Constructor.java:494)
# java.lang.Class.newInstance0(Class.java:350)
# java.lang.Class.newInstance(Class.java:303)
# org.apache.hivemind.util.InstanceCreationUtils.createInstance(InstanceCreationUtils.java:54)
# org.apache.hivemind.impl.CreateClassServiceConstructor.constructCoreServiceImplementation(CreateClassServiceConstructor.java:35)
# org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructCoreServiceImplementation(AbstractServiceModelImpl.java:107)
# org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructNewServiceImplementation(AbstractServiceModelImpl.java:157)
# org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructServiceImplementation(AbstractServiceModelImpl.java:139)
# org.apache.hivemind.impl.servicemodel.SingletonServiceModel.getActualServiceImplementation(SingletonServiceModel.java:68)
# $SessionCreator_10731d57dec._service($SessionCreator_10731d57dec.java)
# $SessionCreator_10731d57dec.createSession($SessionCreator_10731d57dec.java)
# $SessionCreator_10731d57deb.createSession($SessionCreator_10731d57deb.java)
# com.ttdev.customerCRUD.DefaultSessionOwner.getSession(DefaultSessionOwner.java:17)
# $SessionOwner_10731d57de9.getSession($SessionOwner_10731d57de9.java)
# $SessionOwner_10731d57dea.getSession($SessionOwner_10731d57dea.java)
# com.ttdev.customerCRUD.HibernateCustomers.getSession(HibernateCustomers.java:11)
# com.ttdev.customerCRUD.HibernateCustomers.listAll(HibernateCustomers.java:14)
# $Customers_10731d57de6.listAll($Customers_10731d57de6.java)
# $Customers_10731d57de5.listAll($Customers_10731d57de5.java)
# com.ttdev.customerCRUD.DefaultHomeService.listAll(DefaultHomeService.java:16)
# $HomeService_10731d57da2.listAll($HomeService_10731d57da2.java)
# $HomeService_10731d57da1.listAll($HomeService_10731d57da1.java)
# com.ttdev.customerCRUD.Home.pageBeginRender(Home.java:19)
# org.apache.tapestry.AbstractPage.firePageBeginRender(AbstractPage.java:478)
# org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:268)
# org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:368)
# org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse(ResponseRendererImpl.java:71)
# $ResponseRenderer_10731d57cec.renderResponse($ResponseRenderer_10731d57cec.java)
# $ResponseRenderer_10731d57ceb.renderResponse($ResponseRenderer_10731d57ceb.java)
# org.apache.tapestry.engine.HomeService.service(HomeService.java:65)
# $IEngineService_10731d57d4b.service($IEngineService_10731d57d4b.java)
# org.apache.tapestry.services.impl.EngineServiceInnerProxy.service(EngineServiceInnerProxy.java:74)
# org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:65)
# org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:248)
# org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:60)
# $WebRequestServicer_10731d57d30.service($WebRequestServicer_10731d57d30.java)
# $WebRequestServicer_10731d57d2f.service($WebRequestServicer_10731d57d2f.java)
# $WebRequestServicer_10731d57d2c.service($WebRequestServicer_10731d57d2c.java)
# $WebRequestServicer_10731d57d2b.service($WebRequestServicer_10731d57d2b.java)
# org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:56)
# $ServletRequestServicer_10731d57d10.service($ServletRequestServicer_10731d57d10.java)
# $ServletRequestServicer_10731d57d0f.service($ServletRequestServicer_10731d57d0f.java)
# org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55)
# $ServletRequestServicerFilter_10731d57d0c.service($ServletRequestServicerFilter_10731d57d0c.java)
# $ServletRequestServicerFilter_10731d57d0b.service($ServletRequestServicerFilter_10731d57d0b.java)
# $ServletRequestServicer_10731d57d11.service($ServletRequestServicer_10731d57d11.java)
# org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52)
# $ServletRequestServicerFilter_10731d57d0a.service($ServletRequestServicerFilter_10731d57d0a.java)
# $ServletRequestServicerFilter_10731d57d09.service($ServletRequestServicerFilter_10731d57d09.java)
# $ServletRequestServicer_10731d57d11.service($ServletRequestServicer_10731d57d11.java)
# org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
# $ServletRequestServicerFilter_10731d57d0e.service($ServletRequestServicerFilter_10731d57d0e.java)
# $ServletRequestServicerFilter_10731d57d0d.service($ServletRequestServicerFilter_10731d57d0d.java)
# $ServletRequestServicer_10731d57d11.service($ServletRequestServicer_10731d57d11.java)
# $ServletRequestServicer_10731d57d04.service($ServletRequestServicer_10731d57d04.java)
# $ServletRequestServicer_10731d57d03.service($ServletRequestServicer_10731d57d03.java)
# org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:141)
# org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:97)
# javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
# javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
# org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
# org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
# org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
# org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
# org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
# org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
# org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
# org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
# org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
# org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
# org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
# org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
# org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
# java.lang.Thread.run(Thread.java:595)

mapping file:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.ttdev.customerCRUD.Customer" table="customers">
<id name="id">
<generator class="sequence"/>
</id>
<property name="customerId"/>
<property name="name"/>
<property name="address"/>
</class>
</hibernate-mapping>

Name and version of the database you are using:
mysql-5.0.15-win32


Top
 Profile  
 
 Post subject: same result with mysql 4.1
PostPosted: Thu Oct 27, 2005 9:22 am 
Newbie

Joined: Thu Oct 27, 2005 7:59 am
Posts: 5
I changed the database, when i suspected that mysql 5.0 isnt supported.

I get the same result with
MySQL 4.1.15-win32
Apache Derby 10.1.1


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 27, 2005 6:48 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Looks like the Hibernate classes are not able to see the hibernate.properties file. Can things placed in shared/lib access resources located in a web app classloader? I would not think so...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 1:07 am 
Newbie

Joined: Thu Oct 27, 2005 7:59 am
Posts: 5
steve wrote:
Looks like the Hibernate classes are not able to see the hibernate.properties file. Can things placed in shared/lib access resources located in a web app classloader? I would not think so...


i tried placing the hibernate.properties (and tried using hibernate.cfg.xml also) to shared/lib and it didnt help too. i have all tapestry/hivemind/hibernate/mysql-connector related jars in shared/lib and tomcat can see them there.

also under servletcontext i have

org.apache.catalina.jsp_classpath that includes
/C:/dev/workspace/CustomerCRUD/context/WEB-INF/classes/;/C:/apps/apache-tomcat-5.5.12/shared/classes/; ... ;/C:/apps/apache-tomcat-5.5.12/shared/lib/mysql-connector-java-3.1.11-bin.jar; ...

/conf/Catalina/localhost/CustomerCRUD.xml
has
<Context docBase="C:/dev/workspace/CustomerCRUD/context" ...

so classpath to properties in context/WEB-INF/classes should be found.

obviously the exception is thrown by org.hibernate.dialect.DialectFactory, if i cant solve this in couple of hours, i try to change

String dialectName = props.getProperty( Environment.DIALECT );

to

String dialectName = props.getProperty( Environment.DIALECT,"org.hibernate.dialect.MySQLDialect" );

and compile hibernate3.jar again, but it would be nice to find out whats really causing this. [/i]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 4:06 am 
Newbie

Joined: Thu Oct 27, 2005 7:59 am
Posts: 5
updating to Hibernate 3.1 rc2 helped.

since i'm changing an existing example to be used as skeleton app for my own, and i'm changing it to use other db than postgre i still need to change the mapping file apparently, but that should be trivial.

i'm very happy i found a solution, altough why exactly the properties couldn't be read remains mystery.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.