DRMAA and the shared.library.path

1.8k Views Asked by At

I try to use the sun grid engine with the DRMAA api by following the tutorial found at: http://gridscheduler.sourceforge.net/howto/drmaa_java.html. For this I need to load the c library located in /srv/sge/lib/lx24-amd64/drmaa.so. Now I execute my command with this code: java -jar scriptName.jar -Dshared.library.path=/srv/sge/lib/lx24-amd64/ as described in https://blogs.oracle.com/templedf/entry/drmaa_and_the_shared_library. But still I get the this exception:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no drmaa in java.library.path

This exception is thrown when trying to retrieve the session:

session = SessionFactory.getFactory().getSession();

OS is linux 64 bit, java is 64 bit and SGE is 64 bit, so this is all compatible.

Does anyone know what is going wrong?

3

There are 3 best solutions below

0
On

The case seems to be that in some distributions the libdrmaa.so has a library version number libdrmaa.so.1.0 while the libdrmaa.so without version number is missing. The drmaa.jar seems to just look for the one without. You can check which of the libdrmaa.so libraries are available in your system using

# ldconfig -p | grep libdrmaa

Which (in my case) either says

libdrmaa.so.1.0 (libc6,x86-64) => /lib64/libdrmaa.so.1.0

or

libdrmaa.so.1.0 (libc6,x86-64) => /lib64/libdrmaa.so.1.0
libdrmaa.so (libc6,x86-64) => /lib64/libdrmaa.so

The second case is the good one!

For Fedora distributions I reported this as a bug and it seems that they fix it in F18 and F19 soon. https://bugzilla.redhat.com/show_bug.cgi?id=671880

It is an easy fix in Fedora to simply install the package "gridengine-devel" where this soft-link is included.

If the libdrmaa.so without version number is not there and you are on another distribution, you can fix it manually as system administrator by typing

# cd /usr/lib64
# sudo ln -sf libdrmaa.so.1.0 libdrmaa.so
# sudo ldconfig
0
On

None of the previous answers worked for me. I've managed to solve this problem defining in my environment the following variable

export LD_LIBRARY_PATH=<path to the drmaa lib>
0
On

You will want to change shared.library.path to java.library.path (I believe that is a mistake in the blog post you referenced.

Also, place the -D switch before the -jar switch in your command, otherwise it is interpreted as an argument to the main function in the jar file rather than an argument to the JVM.

So, your example command should now look like this:

java -Djava.library.path=/srv/sge/lib/lx24-amd64/ -jar scriptName.jar