Re: Using a dynamic library with Java
Re: Using a dynamic library with Java
- Subject: Re: Using a dynamic library with Java
- From: email@hidden
- Date: Wed, 1 Feb 2006 12:29:32 -0700
> I'm trying to use the Oracle Mail (Collaboration
Suite) from a
> WebObjects application, and instead of using the JDBC "thin"
(Type IV)
> driver, it use their Type 3 (JDBC + OCI), so a native OCI dynamic
> library is required, I took the one from their InstantClient for OS
X.
> I adjusted the java.library.path in my XCode project to the correct
> path, I even copied the libs in /Library/Java/Extensions, I always
get
> this error :
>
> Error: com.webobjects.foundation.NSForwardException
> [java.lang.UnsatisfiedLinkError] null
> Reason: no ocijdbc10 in java.library.path
> ...
>
> I do have 'libocijdbc10.dylib' in the path, so I really don't know
why
> it's doesn't to load. Does using dynamic C/C++ library works
with Java
> on OS X ?
I'm assuming that you have printed out the value of
java.library.path and it includes the path to the OCI driver.
Have not done it on OS X, and never used Oracle Mail,
but having installed OCI and native DB2 drivers for WebObjects use, often
the native libraries have dependencies themselves, and if those cannot
be resolved you will get the UnsatisfiedLinkError, so you often have to
get the libraries in their normal installed state onto your java.library.path,
not just move the native libs onto the java path.
We always try to get the native stuff working outside
of Java first (or with the vendor's Java tools), then we add them to the
appropriate paths (System path on Win, LD_LIBRARY_PATH on Solaris, I think
it's DYLD_LIBRARY_PATH or something similar on Mac OS X, or you can manipulate
java.library.path). We even found an instance where I think the DB2 drivers
would give a UnsatisfiedLinkError if the JDBC URL was wrong because it
had an invalid parameter for the native code which then wouldn't load (or
something similar). Usually the error messages are extremely unhelpful.
So for example, on our Solaris install, we have the
Oracle Instant Client installed to /app/oracle, and it has several native
libraries in there, not just ocijdbc10, and I bet ocijdbc10 has dependencies
on some of those. We just put /app/oracle on our LD_LIBRARY_PATH and it
works for us (plus some other environment variables we set for other things).
Also, at least on Solaris, the environment that WebObjects
applications are run in can be quite different from the command line shell
you're using, so you may have to manipulate the startup scripts for WebObjects
to get their environment suitable for the native code. I believe we had
to manipulate $NEXT_ROOT/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd
to get our environment variables right for our setup.
Good luck,
Logan _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden