-->
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.  [ 7 posts ] 
Author Message
 Post subject: Could not instantiate dialect class
PostPosted: Wed Nov 23, 2005 1:03 am 
Newbie

Joined: Wed Sep 21, 2005 7:47 am
Posts: 5
I am accessing the hibernate session through a jsp page. I am not using any configuration file. i am setting all the properties in a static function of an java class. Then i am calling that static function in the jsp page. But i am getting the following exception.

org.hibernate.HibernateException: Could not instantiate dialect class
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:84)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:42)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:374)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:110)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)


can anybody help me to resolve this issue.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 1:32 am 
Senior
Senior

Joined: Tue Aug 23, 2005 8:52 am
Posts: 181
What dialect class did you specify in that static block?


Top
 Profile  
 
 Post subject: org.hibernate.dialect.MySQLDialect
PostPosted: Wed Nov 23, 2005 1:36 am 
Newbie

Joined: Wed Sep 21, 2005 7:47 am
Posts: 5
This is the code of that static static function. I am calling this function through jsp page.


public static SessionFactory getTemp(){
org.hibernate.SessionFactory sessionFactory=null;
try{
System.out.println("Before Createing session Factory successfully");
org.hibernate.cfg.Configuration Hiberconfig = new Configuration().addResource("player.hbm.xml");
System.out.println("Created the configuration successfully");
//Hiberconfig.addClass(com.player.class);
System.out.println("Added the player class to config");
Hiberconfig.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
System.out.println("Added the Dialect to config");
Hiberconfig.setProperty("hibernate.query.factory_class","org.hibernate.hql.classic.ClassicQueryTranslatorFactory");
Hiberconfig.setProperty("hibernate.connection.driver_class", "com.mysql.jdbc.Driver");
System.out.println("Added the MySql Driver to config");
Hiberconfig.setProperty("hibernate.connection.url", "jdbc:mysql://localhost:3306/hiberdemo");
Hiberconfig.setProperty("hibernate.connection.username", "root");
Hiberconfig.setProperty("hibernate.connection.password", "");
System.out.println("Added the Database connection url to config");
//Fire up Hibernate
sessionFactory = Hiberconfig.buildSessionFactory();
System.out.println("Created session Factory successfully");
}
catch(Exception e){
System.out.println("\nProblem in getTemp()\n ");
}
return sessionFactory;
}


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 3:12 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
put the class org.hibernate.dialect.MySQLDialect in the classpath . this means is will be a .class file under WEB-INF/classes or in jar under /WEB-INF/lib .


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 3:18 am 
Newbie

Joined: Wed Sep 21, 2005 7:47 am
Posts: 5
Thanks,
But already all the classes are in the classpath. The hibernate3.jar is inside the WEB-INF\lib\ directory. So i don't think there is any need to put org.hibernate.dialect.MySQLDialect in the classpath.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 3:28 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
can you run hibernate in debug mode and post the output ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 3:32 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
but before you do that, what happens when you call this?

org.hibernate.util.ReflectHelper.classForName( dialectName ).newInstance()


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