• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ant junit task cannot find driver on classpath

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My junit task running in ant can't find the right driver. The error is :

java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)

When I run the Junit in Eclipse, it works fine. I have the db drivers on the classpath, but I must be missing something.

We have a utility project (DataConn) for handling db connections. It contains examples that require the db drivers. When I compile this project earlier in the build script, it compiles fine. I tried commenting out the classpath ref that has the drivers on it, just to test it, and it fails.

For the junit classpath, I have a refid that points to the classpath used by the DataConn project. But apparently something is wrong.

I'll try to include relevant snippets of the build file



DataConn.lib is where the driver jars are. Again, I tested that this is working because the compilation of the DataConn project works with this classpath, and fails when it's commented out.


FYI, the test.compile target step is successful as well.

In the test suite, there is a static initializer method which sets the 'jdbc.drivers' System property with a semicolon-delimited list of the drivers. Then it does other calls to our DataConn project to set up the connection pool. This all works fine when running this suite from within Eclipse.

I'm using ant 1.7 on WinXP. Any gotchas in this area I should look for? Any ideas?

Thanks
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic