Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

Problem with Ant/Eclipse/Oracle

Thread view: 
tewall@lycos.com - 21 Apr 2006 02:14 GMT
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.
Roedy Green - 21 Apr 2006 02:41 GMT
>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.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

tewall@lycos.com - 21 Apr 2006 05:30 GMT
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.
Luis - 21 Apr 2006 08:32 GMT
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.
tewall@lycos.com - 25 Apr 2006 00:12 GMT
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
Roedy Green - 25 Apr 2006 01:38 GMT
>C:\oracle\product\10.1.0\Client_1\BIN\ocijdbc10.dll

does this dll exist?

If you dump the system properties, what does it say
for java.library.path?

See http://mindprod.com/applets/wassup.html
and http://mindprod.com/jgloss/properties.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

tewall@lycos.com - 25 Apr 2006 05:25 GMT
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
tewall@lycos.com - 25 Apr 2006 05:41 GMT
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.
tewall@lycos.com - 25 Apr 2006 17:26 GMT
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.
tewall@lycos.com - 25 Apr 2006 17:46 GMT
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.
Alex Buell - 25 Apr 2006 17:53 GMT
> 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.

Signature

http://www.munted.org.uk

Take a nap, it saves lives.

tewall@lycos.com - 27 Apr 2006 19:29 GMT
Any idea as to why my Eclipse (when running Ant) path is showing
C:\Program
> Files\eclipse\plugins\org.eclipse.swt.win32_3.1.0\os\win32\x86. instead of the system path?
tewall@lycos.com - 25 Apr 2006 00:20 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.