Problem with Ant/Eclipse/Oracle

T

tewall

I'm trying to do an ant build in Eclipse. The build works find outside
of Eclipse, but within Eclipse I get the following error:

java.lang.UnsatisfiedLinkError: no ocijdbc8 in java.library.path.

ocijdbc8 lives in C:\oracle\ora81\bin. When I run the build outside of
Eclipse, I set the path to include the home for Ant, for Java, and for
Oracle.

Within Eclipse, I don't see how the path is determined. I can't find
what Eclipse thinks the path is, or how to tell it what should be
included in it. I don't know how to get it to recognize the ocijdbc8
dll.

I guess I should mention that the ant build is doing JUnit tests, and
this is what is failing. I can run the JUnit tests find with Eclipse
(not doing the ant build, but just running them as JUnit tests), and
can run them fine outside of Eclipse doing the Ant build, but cannot
run them inside of Eclipse doing an Ant build. So somehow Eclipse is
using the correct path when doing the JUnit tests, but a different, and
incorrect, path when doing the Ant build.

Finally I should mention that the first item in the system path is
C:\oracle\ora81\bin.
 
R

Roedy Green

Within Eclipse, I don't see how the path is determined. I can't find
what Eclipse thinks the path is, or how to tell it what should be
included in it. I don't know how to get it to recognize the ocijdbc8
dll.

Check "build path" You set up the libraries to include for each
project.
 
T

tewall

The project runs fine, just not Ant. I need to know how to set the
path (not classpath) for Ant. I can do this fine when running from a
command script outside of Eclipse, but within Eclipse I'm having a
problem running the JUnit tests, but only when doing Ant, not when
running the JUnit tests in Eclipse apart from Ant.
 
L

Luis

I don't know why it works outside eclipse and not inside (maybe you add
the oracle directory to the path variable in the local command prompt
before invoking Ant?), but in any case, you can extend the java DLL
search path by passing the following parameter to the JVM:

-Djava.library.path=<your path here>

In eclipse you can edit the Ant VM parameters by selecting Run /
External Tools / External Tools ..., and there you should see an entry
for your Ant task. If you edit it, you will see a "JRE" tab that
contains a "VM Arguments" box. There is where you should add that
parameter.

Hope it helps...

Luis.
 
T

tewall

Thanks Luis. I'll try out your suggestions. I've isolated the problem
to be that Eclipse is not finding where to look for the Oracle dll
(e.g. ojdbc10.dll). Actually I'm not 100% sure that's the problem, but
the path is the only thing I can't verify is correct. I know the url,
uid, pwd, and classpath are correct.

Here's the error message I'm getting trying to run

java.lang.UnsatisfiedLinkError:
C:\oracle\product\10.1.0\Client_1\BIN\ocijdbc10.dll: The specified
procedure could not be found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at
oracle.jdbc.driver.T2CConnection.loadNativeLibrary(T2CConnection.java:2854)
at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:221)
at
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:343)
at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:135)
at
oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:78)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:545)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at ....

This is running in Eclipse, not doing an Ant build. Doing the Ant
build gives this error message:

no ocijdbc10 in java.library.path
[junit] java.lang.UnsatisfiedLinkError: no ocijdbc10 in
java.library.path
 
T

tewall

I tried this putting this
-Djava.library.path=C:\oracle\product\10.1.0\Client_1\BIN in the VM
arguments box, but got the same error.

Also, how do I do the first thing you suggested? (you can extend the
java DLL
search path by passing the following parameter to the JVM:

-Djava.library.path=<your path here> )

Thanks.
 
T

tewall

Yes, it exists. I can run the build find from a command line, using
this as my path:

set path=%ANT_HOME%\bin;%JAVA_HOME%\bin;%ORA_HOME%\bin

where ORA_HOME = C:\oracle\product\10.1.0\Client_1

I don't know how to see what Eclipse is using for its path, or
java.library.path. I would think it would use what I set in the VM
arguments setting for the JRE, which is this:

-Djava.library.path=C:\oracle\product\10.1.0\Client_1\BIN (which I
copied from Windows explorer).

I've gotten my JUnit tests to run within Eclipse, using the Oracle 10
client. Everything's working now, except doing the Ant build within
Eclipse, where the Ant build runs the JUnit tests (which need the
Oracle connectivity). I keep getting this error:

no ocijdbc10 in java.library.path
[junit] java.lang.UnsatisfiedLinkError: no ocijdbc10 in
java.library.path
 
T

tewall

I tried getting rid of the JRE VM setting and copying the dll into the
Windows\System32 directory, and that didn't work either. I'm confused
as to how Ant inside of Eclipse is setting its path. It doesn't look
in Windows\System32, it doesn't use the System Environment Variables;
what does it use? How does it know what the path is? How can I see
what it thinks the path is? How can I modify the path? Very
frustrating.

At least I can run the Ant scripts outside of Eclipse.
 
T

tewall

I used echo to get the path, which turned out to be C:\Program
Files\eclipse\plugins\org.eclipse.swt.win32_3.1.0\os\win32\x86. I put
the ocijdbc10.dll there, and that fixed the problem.

This seems kind of kludgy, but it works!

Thanks for the help. I'm open to less kludgy suggestions.
 
T

tewall

I worked with a colleague to get his environment set up to do the Ant
stuff within Eclipse, and he did not have the path problem I do. His
path echos what one would expect; the full path as defined by the
System Environment Variables. Mine only shows this:C:\Program
Files\eclipse\plugins\org.eclipse.swt.win32_3.1.0\os\win32\x86.

We're running different versions of Eclipse, so that's a possibility.
I'm running Version 3.1.0. Another possibility is I've got something
set somewhere to tell it not use the path.

So bottom line is it's working as expected on his machine, but
something's screwy on mine.
 
A

Alex Buell

I worked with a colleague to get his environment set up to do the Ant
stuff within Eclipse, and he did not have the path problem I do. His
path echos what one would expect; the full path as defined by the
System Environment Variables. Mine only shows this:C:\Program
Files\eclipse\plugins\org.eclipse.swt.win32_3.1.0\os\win32\x86.

Try not to use paths with spaces in them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top