wood burning stoves 2.0*
The moose likes Other Application Frameworks and the fly likes No suitable driver Error in Test Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "No suitable driver Error in Test Class" Watch "No suitable driver Error in Test Class" New topic
Author

No suitable driver Error in Test Class

Franz van Betteraey
Greenhorn

Joined: Jun 20, 2007
Posts: 18
Hi All,

I have a problem writing a Spring-Unit-Test extending AbstractDependencyInjectionSpringContextTests.
The TestClass (Bean) includes a property of a bean that I want to test. Injection of that bean happens well.
The bean to test extends "SimpleJdbcDaoSupport". Every configuration (jdbcTemplate/datasource) is done well (in my opinion).

I want to test a database operation and the method invokation happens well. But than the following error occures:



This happens normally, when the jar with the db drivers are not in the classpath. But they are.

So, does anybody knows about a reason for this problem. Maybe using a Test Class which extends AbstractDependencyInjectionSpringContextTests does not inject all propertys needed in reference bean which I want to test (especially the jdbcTemplate property).

Any help is appreciated.

Best regards
Klaus
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi Klaus,

Every configuration (jdbcTemplate/datasource) is done well (in my opinion).


Should we guess your configuration or are you are going to post it?

Herman
Franz van Betteraey
Greenhorn

Joined: Jun 20, 2007
Posts: 18
Hi Herman,

I will post it :-)



After some more debugging (and logging) I am very sure, that all injection is done correctly and also the class to test (de.mycompany.myproject.dao.myDaoImpl) has a correct refence to the DataSource. So it must be some kind of classpath problem I cant figure out. The necessary DB2 Jar's are in the classpath, but apperently can not be found while establishing the connection.

I assume that ist is hard to comprehend the problem but any hint what to check is still welcome.

Thanks
Klaus
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9932
    
159

<property name="url" value="dbcb2://localhost:55150/myDB"/>


The url value appears incorrect. Shouldn't it be:



The 'j' in jdbc seems to be missing in the url that you posted.


[My Blog] [JavaRanch Journal]
Franz van Betteraey
Greenhorn

Joined: Jun 20, 2007
Posts: 18
Oh my god!

I will

* never ever assert that I did every configuration well
* search for the deep black hole to sink
* thank you 1000 times for finding this mistake

Klaus
 
 
subject: No suitable driver Error in Test Class
 
Similar Threads
No suitable driver
Communication failure during handshake. Is there a server running on localhost:3306?
Spring - MySql Connectivity Error
jdbc connection to ms sql (urgent)
Spring framework test case for DAO: No suitable driver