ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nigel Parker" <>
Subject RE: Cant access JDBC driver twice in same Ant run
Date Tue, 27 Nov 2001 08:55:30 GMT

Thanks for your reply, Jim.

In reply to your question, I am running the application via the <java> task.
I tried doing what you suggested and ran with fork=true. But for some reason
the application wont run this way. It gives me always:

java.lang.NoClassDefFoundError: D:\Song\cwf\classes
Exception in thread "main"

D:\Song\cwf\classes is the root directory of the application. This happens
already the first time I run the application. So it does sound as if class
loading is the area to investigate further.


-----Opprinnelig melding-----
Fra: Doyle, Jim []
Sendt: 26. november 2001 22:10
Til: Nigel Parker
Emne: RE: Cant access JDBC driver twice in same Ant run

Given that the driver lookup is based on the availability of drivers in
the classpath, and occasionally Ant has interesting class loading conflicts,
perhaps it's a class loading issue?  You're running your application with
the "<java>" task, correct?  The first thing I would try is to run it with
"<java fork="yes">", so that your application is run in an entirely separate


> -----Original Message-----
> From: Nigel Parker []
> Sent: Sunday, November 25, 2001 4:38 PM
> To:
> Subject: Cant access JDBC driver twice in same Ant run
> I have recently converted the administration of my Java JDBC
> application to
> Ant, and am very pleased with the new flexibility it gives
> me. One of the
> reasons for doing the conversion was to automate regression
> tests. I have
> however hit on the following problem which eludes all my
> attempts to get
> round:
> When I run the application once in a single <target>
> everything works fine.
> When I run the application twice in dependent targets, the second time
> always fails with:
> java.sql.SQLException: No suitable driver
> 	at java.sql.DriverManager.getConnection
> Ive tried all combinations for loading the driver I can think
> of, like:
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance()
> java.sql.DriverManager.deregisterDriver()
> java.sql.DriverManager.registerDriver()
> I tried inserting the driver name as a system property: <sysproperty
> key="jdbc.drivers" value="sun.jdbc.odbc.JdbcOdbcDriver"/>
> I tried also
> java.sql.DriverManager.getDriver("jdbc:odbc:SongFase2") just
> before my call to getConnection with an identical URL. The
> correct driver is
> returned so it must be there, but getConnection() in the
> second application
> run still gives me the above exception.
> Can someone help me and tell me what am I doing wrong?
> thanks
> Nigel Parker

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message