• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

No suitable driver Error in Test Class

 
Greenhorn
Posts: 21
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

<property name="url" value="dbc:Db2://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.
 
Franz van Betteraey
Greenhorn
Posts: 21
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
We should throw him a surprise party. It will cheer him up. We can use this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic