Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HibernateException Pls Help

 
jaya lakshmi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Am using Netbeans 5.5 with hibernate 3.05 plugin. with HibernateToolSuite.
I ve included all jar files mentioned in the site. In the Session Factory configuration i ve given
MySQLDialect and DatabaseDriver as org.gjt.mm.mysql.Driver.
When i select open/reload command it throws an exception
org.hibernate.HibernateException: JDBC Driver class not found: org.gjt.mm.mysql.Driver
at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:66)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:366)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)
at net.java.dev.hts.SessionFactoryDescriptor.openSession(SessionFactoryDescriptor.java:471)
at net.java.dev.hts.SessionFactoryDescriptor.access$000(SessionFactoryDescriptor.java:54)
at net.java.dev.hts.SessionFactoryDescriptor$1.run(SessionFactoryDescriptor.java:413)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:499)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:932)
Caused by: java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.netbeans.ProxyClassLoader.loadInOrder(ProxyClassLoader.java:582)
at org.netbeans.ProxyClassLoader.smartLoadClass(ProxyClassLoader.java:531)
at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:163)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:61)



Pls help me where i need to mention the driver classed for databases.
 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Driver class should be mentioned where you are going to

configure a session-factory(i.e) in cfg.xml or in hibernate.properties

amir
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Caused by: java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver


The jar containing this driver class should be in the classpath of your application.
 
jaya lakshmi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your replies it works with hibernate.properties.

It is working perfectly for MySQL. But for SQLServer it is throwing ClassNotfoundException com.microsoft.jdbc.sqlserver.SQLServerDriver
I ve included mssqlserver.jar in lib folder of classpath.

What do i do...
 
Edward Durai
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jaya,

If you use SQLServer,
Use the below jar files

1. msbase.jar
2. mssqlserver.jar
3. msutil.jar

OK.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic