-->
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.  [ 2 posts ] 
Author Message
 Post subject: org.hibernate.HibernateException: Could not instantiate dial
PostPosted: Thu Aug 25, 2005 11:23 pm 
Newbie

Joined: Thu Aug 25, 2005 10:20 pm
Posts: 1
environment:
hsqldb 1.8 (tried hsqldb 1.7.3 later)
jboss 4.0.2
hibernate 3.0.5 (tried hibernate 3.1 beta2 later)

and it ran into Initial SessionFactory creation failed.org.hibernate.HibernateException: Could not instantiate dialect class
does anyone encounter the same problem?

Code:
10:43:26,406 INFO  [EjbModule] Deploying Hello
10:43:26,578 INFO  [EJBDeployer] Deployed: file:/F:/jboss-4.0.2/server/default/deploy/helloEJB.jar
10:43:31,640 INFO  [TomcatDeployer] undeploy, ctxPath=/helloWeb, warUrl=file:/F:/jboss-4.0.2/server/default/tmp/deploy/tmp40188helloWeb-exp.war/
10:43:31,703 WARN  [DeploymentInfo] Could not delete file:/F:/jboss-4.0.2/server/default/tmp/deploy/tmp40188helloWeb-exp.war/ restart will delete it
10:43:32,515 INFO  [TomcatDeployer] deploy, ctxPath=/helloWeb, warUrl=file:/F:/jboss-4.0.2/server/default/tmp/deploy/tmp40191helloWeb-exp.war/
10:43:38,203 INFO  [Configuration] configuring from resource: /hibernate.cfg.xml
10:43:38,203 INFO  [Configuration] Configuration resource: /hibernate.cfg.xml
10:43:38,218 INFO  [Configuration] Mapping resource: hello/db/Product.hbm.xml
10:43:38,234 INFO  [HbmBinder] Mapping class: hello.db.Product -> PRODUCT
10:43:38,234 INFO  [Configuration] Mapping resource: hello/db/Customer.hbm.xml
10:43:38,250 INFO  [HbmBinder] Mapping class: hello.db.Customer -> CUSTOMER
10:43:38,250 INFO  [Configuration] Mapping resource: hello/db/Invoice.hbm.xml
10:43:38,265 INFO  [HbmBinder] Mapping class: hello.db.Invoice -> INVOICE
10:43:38,265 INFO  [Configuration] Mapping resource: hello/db/Item.hbm.xml
10:43:38,281 INFO  [HbmBinder] Mapping class: hello.db.Item -> ITEM
10:43:38,281 INFO  [Configuration] Configured SessionFactory: null
10:43:38,281 INFO  [Configuration] processing extends queue
10:43:38,281 INFO  [Configuration] processing collection mappings
10:43:38,281 INFO  [HbmBinder] Mapping collection: hello.db.Product.items -> ITEM
10:43:38,281 INFO  [HbmBinder] Mapping collection: hello.db.Customer.invoices -> INVOICE
10:43:38,281 INFO  [HbmBinder] Mapping collection: hello.db.Invoice.items -> ITEM
10:43:38,281 INFO  [Configuration] processing association property references
10:43:38,281 INFO  [Configuration] processing foreign key constraints
10:43:38,296 INFO  [DriverManagerConnectionProvider] Using Hibernate built-in connection pool (not for production use!)
10:43:38,296 INFO  [DriverManagerConnectionProvider] Hibernate connection pool size: 20
10:43:38,296 INFO  [DriverManagerConnectionProvider] autocommit mode: false
10:43:38,296 INFO  [DriverManagerConnectionProvider] using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:hsql://localhost/test
10:43:38,296 INFO  [DriverManagerConnectionProvider] connection properties: {user=sa}
10:43:38,359 INFO  [SettingsFactory] RDBMS: HSQL Database Engine, version: 1.8.0
10:43:38,359 INFO  [SettingsFactory] JDBC driver: HSQL Database Engine Driver, version: 1.8.0
10:43:38,406 INFO  [Dialect] Using dialect: org.hibernate.dialect.HSQLDialect
10:43:38,531 INFO  [STDOUT] Initial SessionFactory creation failed.org.hibernate.HibernateException: Could not instantiate dialect class
10:43:38,531 ERROR [[action]] Servlet.service() for servlet action threw exception
java.lang.ExceptionInInitializerError
   at hello.db.HibernateUtil.<clinit>(HibernateUtil.java:19)
   at hello.web.HelloAction.execute(HelloAction.java:24)
   at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
   at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
   at java.lang.Thread.run(Thread.java:534)
Caused by: org.hibernate.HibernateException: Could not instantiate dialect class
   at org.hibernate.dialect.Dialect.getDialect(Dialect.java:524)
   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:109)
   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1509)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1054)
   at hello.db.HibernateUtil.<clinit>(HibernateUtil.java:15)
   ... 26 more
Caused by: java.lang.ClassCastException
   at org.hibernate.dialect.Dialect.getDialect(Dialect.java:518)
   ... 30 more


Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Code:


Top
 Profile  
 
 Post subject: classloader?
PostPosted: Fri Aug 26, 2005 1:31 am 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
That is most likely caused by classloading issues, please make sure that you have only one copy of hibernate jar loadable by application classloader.

In short: the classloading issue may apper really weird on the surface it like

object of class Dialect cannot be cast to variable of Dialect type, very careful examination may show that they have different classloaders and therefore they are not compatioble according to JVM.
This is when runtime affects language semantic, JVM is trying to do

{classloaderInstance1}.Class d = ({classloaderInstance1}.Class) obj;

so if obj is loaded by classloaderInstance2 then the cast fails.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.