ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nigel Parker" <npar...@online.no>
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.

Nigel



-----Opprinnelig melding-----
Fra: Doyle, Jim [mailto:jdoyle@iso-ne.com]
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
process.

Jim

> -----Original Message-----
> From: Nigel Parker [mailto:nigel.parker@mazeppa.no]
> Sent: Sunday, November 25, 2001 4:38 PM
> To: ant-user@jakarta.apache.org
> 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:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message