I have a very simple code to run. The hibernate xml mapping
files must be correct because I downloaded form a tutorial.
The hibernate properties file is:
hibernate.dialect net.sf.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql:///test
hibernate.connection.username db2admin
hibernate.connection.password
I run the code as below from a command line shell.
All the jar files and zip files, and class files are in the
directory.
However, I still get this error message:
net.sf.hibernate.HibernateException: JDBC Driver class not found: com.mysql.jdbc.Driver
Please help.
Thanks,
C:\Projects\HN\hntest\classes>java -cp .;ant-1.5.3.jar;ant-optional-1.5.3.jar;c3p0-0.8.4.5.jar;cglib-full-2.0.1.jar;commons-collections-2.1.jar;commons-dbcp-1.1.jar;commons-lang-1.0.1.jar;commons-logging-1.0.3.jar;commons-pool-1.1.jar;concurrent-1.3.2.jar;connector.jar;dom4j-1.4.jar;ehcache-0.7.jar;hibernate2.jar;hsqldb.jar;jaas.jar;jboss-cache.jar;jboss-common.jar;jboss-jmx.jar;jboss-system.jar;jcs-1.0-dev.jar;jdbc2_0-stdext.jar;jgroups-2.2.1.jar;jta-spec1_0_1.jar;jta.jar;junit-3.8.1.jar;log4j-1.2.8.jar;odmg-3.0.jar;oscache-2.0.jar;proxool-0.8.3.jar;swarmcache-1.0rc2.jar;xalan-2.4.0.jar;xerces-2.4.0.jar;xml-apis.jar;db2java.zip;mysql-connector-java-3.0.14-production.zip HBTest
10:53:54,155 INFO Environment:462 - Hibernate 2.1.3
10:53:54,165 INFO Environment:496 - loaded properties from resource hibernate.properties: {hibernate.connection.username=db2admin, hibernate.connection.password=, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.connection.url=jdbc:mysql:///test, hibernate.connection.driver_class=com.mysql.jdbc.Driver}
10:53:54,165 INFO Environment:519 - using CGLIB reflection optimizer
10:53:54,165 INFO Environment:530 - JVM does not support Statement.getGeneratedKeys()
10:53:54,175 INFO Environment:541 - JVM does not support LinkedHasMap, LinkedHashSet - ordered maps and sets disabled
10:53:54,175 INFO Environment:544 - using workaround for JVM bug in java.sql.Timestamp
10:53:54,175 INFO Configuration:347 - Mapping resource: com/ibm/hibernate_article/Employee.hbm.xml
10:53:55,157 INFO Binder:229 - Mapping class: com.ibm.hibernate_article.Employee -> employee
10:53:55,257 INFO Configuration:347 - Mapping resource: com/ibm/hibernate_article/Department.hbm.xml
10:53:55,697 INFO Binder:229 - Mapping class: com.ibm.hibernate_article.Department -> department
10:53:55,697 INFO Configuration:613 - processing one-to-many association mappings
10:53:55,697 INFO Configuration:622 - processing one-to-one association property references
10:53:55,697 INFO Configuration:647 - processing foreign key constraints
10:53:55,747 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.MySQLDialect
10:53:55,747 INFO SettingsFactory:62 - Use outer join fetching: false
10:53:55,757 INFO DriverManagerConnectionProvider:42 - Using Hibernate built-in connection pool (not for production use!)
10:53:55,757 INFO DriverManagerConnectionProvider:43 - Hibernate connection pool size: 20
10:53:55,757 FATAL DriverManagerConnectionProvider:62 - JDBC Driver class not found: com.mysql.jdbc.Driver
net.sf.hibernate.HibernateException: JDBC Driver class not found: com.mysql.jdbc.Driver
at net.sf.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:63)
at net.sf.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:83)
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:64)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1132)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:766)
at HBTest.main(HBTest.java:42)
|