-->
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: No suitable driver found for derby
PostPosted: Tue Apr 19, 2011 10:47 pm 
Newbie

Joined: Tue Apr 19, 2011 7:26 pm
Posts: 4
Environment:
Eclipse Helios Service Release 2
Hibernate 3.3.2
derbyclient.jar 10.7.1.1

I'm following a Hibernate video tutorial at http://www.youtube.com/watch?v=WKWnbhc4_6g&feature=mfu_in_order&list=UL. The presenter seems to know what's he's doing and the app runs fine when he runs it. I have been following these instructions to the letter and can't figure out why I'm getting this error running Derby with Hibernate. I'm using all of the .jar versions that he is using. I've been looking searching online for a solution and checked out a few forums (including this one) and basically the suggestions have been to check the .jar file to make sure it has the correct class file (org.apache.derby.jdbc.ClientDriver) inside the derbyclient.jar file and also to make sure that the configuration file is correct. I'm not seeing what is wrong. I need another set of eyes to look over my work.

Here is the stacktrace:


Code:
22:27:10,368  INFO Version:15 - Hibernate Annotations 3.4.0.GA
22:27:10,391  INFO Environment:500 - Hibernate 3.2.0.cr5
22:27:10,400  INFO Environment:533 - hibernate.properties not found
22:27:10,403  INFO Environment:667 - Bytecode provider name : cglib
22:27:10,409  INFO Environment:584 - using JDK 1.4 java.sql.Timestamp handling
22:27:10,509  INFO Version:14 - Hibernate Commons Annotations 3.1.0.GA
22:27:10,524  INFO Configuration:1350 - configuring from resource: hibernate.cfg.xml
22:27:10,524  INFO Configuration:1327 - Configuration resource: hibernate.cfg.xml
22:27:10,637 DEBUG DTDEntityResolver:38 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
22:27:10,638 DEBUG DTDEntityResolver:40 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
22:27:10,640 DEBUG DTDEntityResolver:50 - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
22:27:10,691 DEBUG Configuration:1311 - hibernate.connection.driver_class=org.apache.derby.jdbc.ClientDriver
22:27:10,692 DEBUG Configuration:1311 - connection.url=jdbc.derby://localhost:1527/HibernateDb;create=true
22:27:10,692 DEBUG Configuration:1311 - username=user
22:27:10,694 DEBUG Configuration:1311 - connection.password=password
22:27:10,694 DEBUG Configuration:1311 - connection.pool_size=2
22:27:10,695 DEBUG Configuration:1311 - dialect=org.hibernate.dialect.DerbyDialect
22:27:10,695 DEBUG Configuration:1311 - current_session_context_class=thread
22:27:10,695 DEBUG Configuration:1311 - cache.provider_class=org.hibernate.cache.NoCacheProvider
22:27:10,696 DEBUG Configuration:1311 - show_sql=true
22:27:10,697  INFO Configuration:1465 - Configured SessionFactory: null
22:27:10,697 DEBUG Configuration:1466 - properties: {hibernate.connection.password=password,
22:27:10,733  INFO Dialect:141 - Using dialect: org.hibernate.dialect.DerbyDialect
22:27:10,831 DEBUG AnnotationConfiguration:258 - Execute first pass mapping processing
22:27:10,925 DEBUG AnnotationConfiguration:529 - Process hbm files
22:27:10,925 DEBUG AnnotationConfiguration:537 - Process annotated classes
22:27:10,934  INFO AnnotationBinder:419 - Binding entity from annotated class: com.hibernate.chapter1.Employee
22:27:10,967 DEBUG Ejb3Column:161 - Binding column DTYPE. Unique false. Nullable false.
22:27:10,999 DEBUG EntityBinder:295 - Import with entity name Employee
22:27:11,021  INFO EntityBinder:422 - Bind entity com.hibernate.chapter1.Employee on table Employee
22:27:11,032 DEBUG AnnotationBinder:1022 - Processing com.hibernate.chapter1.Employee property annotation
22:27:11,114 DEBUG AnnotationBinder:1133 - Processing annotations of com.hibernate.chapter1.Employee.empID
22:27:11,123 DEBUG Ejb3Column:161 - Binding column empID. Unique false. Nullable false.
22:27:11,124 DEBUG AnnotationBinder:1257 - empID is an id
22:27:11,130 DEBUG SimpleValueBinder:220 - building SimpleValue for empID
22:27:11,135 DEBUG PropertyBinder:131 - Building property empID
22:27:11,142 DEBUG AnnotationBinder:1293 - Bind @Id on empID
22:27:11,143 DEBUG AnnotationBinder:1133 - Processing annotations of com.hibernate.chapter1.Employee.empName
22:27:11,144 DEBUG Ejb3Column:161 - Binding column empName. Unique false. Nullable true.
22:27:11,149 DEBUG PropertyBinder:110 - binding property empName with lazy=false
22:27:11,152 DEBUG SimpleValueBinder:220 - building SimpleValue for empName
22:27:11,153 DEBUG PropertyBinder:131 - Building property empName
22:27:11,156 DEBUG AnnotationConfiguration:401 - processing fk mappings (*ToOne and JoinedSubclass)
22:27:11,159 DEBUG Configuration:1044 - processing extends queue
22:27:11,159 DEBUG Configuration:1048 - processing collection mappings
22:27:11,160 DEBUG Configuration:1059 - processing native query and ResultSetMapping mappings
22:27:11,160 DEBUG Configuration:1067 - processing association property references
22:27:11,161 DEBUG Configuration:1089 - processing foreign key constraints
22:27:11,162  INFO AnnotationConfiguration:369 - Hibernate Validator not found: ignoring
22:27:11,255 DEBUG AnnotationConfiguration:258 - Execute first pass mapping processing
22:27:11,256 DEBUG AnnotationConfiguration:529 - Process hbm files
22:27:11,257 DEBUG AnnotationConfiguration:537 - Process annotated classes
22:27:11,257 DEBUG AnnotationConfiguration:401 - processing fk mappings (*ToOne and JoinedSubclass)
22:27:11,258 DEBUG Configuration:1044 - processing extends queue
22:27:11,258 DEBUG Configuration:1048 - processing collection mappings
22:27:11,258 DEBUG Configuration:1059 - processing native query and ResultSetMapping mappings
22:27:11,259 DEBUG Configuration:1067 - processing association property references
22:27:11,268 DEBUG Configuration:1089 - processing foreign key constraints
22:27:11,273  INFO SchemaExport:154 - Running hbm2ddl schema export
22:27:11,275 DEBUG SchemaExport:170 - import file not found: /import.sql
22:27:11,275  INFO SchemaExport:179 - exporting generated schema to database
22:27:11,280  INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
22:27:11,281  INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 2
22:27:11,281  INFO DriverManagerConnectionProvider:45 - autocommit mode: false
22:27:11,300  INFO DriverManagerConnectionProvider:80 - using driver: org.apache.derby.jdbc.ClientDriver at URL: jdbc.derby://localhost:1527/HibernateDb;create=true
22:27:11,301  INFO DriverManagerConnectionProvider:83 - connection properties: {password=password}
22:27:11,302 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0
22:27:11,302 DEBUG DriverManagerConnectionProvider:109 - opening new JDBC connection
22:27:11,305 ERROR SchemaExport:202 - schema export unsuccessful
java.sql.SQLException: No suitable driver found for jdbc.derby://localhost:1527/HibernateDb;create=true
   at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
   at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
   at org.hibernate.tool.hbm2ddl.ManagedProviderConnectionHelper.prepare(ManagedProviderConnectionHelper.java:28)
   at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:180)
   at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:133)
   at com.hibernate.chapter1.TestEmployee.main(TestEmployee.java:18)

      


And here is the hibernate.cfg.xml file:

Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
   "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>

<!-- Database connection settings -->

     <property name="connection.driver_class">org.apache.derby.jdbc.ClientDriver</property>
     <property name="connection.url">jdbc.derby://localhost:1527/HibernateDb;create=true</property>
     <property name="username">user</property>
     <property name="connection.password">password</property>
     
     <!-- JDBC connection pool (use the built-in -->
     <property name="connection.pool_size">2</property>
     
     <!-- SQL dialect -->
     <property name="dialect">org.hibernate.dialect.DerbyDialect</property>
     
     <!-- Enable Hibernate's current session context -->
     <property name="current_session_context_class">thread</property>
     
     <!-- Diable the second level cache -->
     <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
     
     <!-- Echo all executed SQL to stdout -->
     <property name="show_sql">true</property>
     
     <!-- Drop and re-create the database schema on startup -->
    <!--  <property name="htm2ddl.auto">create</property>
     
     <mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"></mapping> -->
     
   
     </session-factory>
     
     </hibernate-configuration>
      


Thanks for your help.


Top
 Profile  
 
 Post subject: Re: No suitable driver found for derby
PostPosted: Wed Apr 20, 2011 2:56 am 
Newbie

Joined: Tue Apr 19, 2011 7:26 pm
Posts: 4
I got some help from another forum. Turns out I needed a colon between jdbc and derby in the "connection.url". I had a period there instead. Works like a charm now. Thanks anyway.


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.