Cannot access shared object file

Questions about YourKit Java Profiler
Post Reply
silverm
Posts: 4
Joined: Thu Mar 27, 2014 6:32 pm

Cannot access shared object file

Post by silverm »

I am trying to attach the java profiler to a jvm at startup, and i get above error.

If I log onto the server, and cd to the directory where i untar'd the linux tarball, i get this - works as root, not as user mapred.

[root@vp-node6 yjp-2013-build-13072]# jre64/bin/java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
[root@vp-node6 yjp-2013-build-13072]# sudo -u mapred jre64/bin/java -version
jre64/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory


java permissions

[root@vp-node6 yjp-2013-build-13072]# ls -l jre64/bin
total 324
-rw-r--r-- 1 msilverman msilverman 6391 Mar 24 09:11 ControlPanel
-rwxr-xr-x 1 msilverman msilverman 7718 Mar 24 09:11 java
-rwxr-xr-x 1 msilverman msilverman 19320 Mar 24 09:11 java_vm
-rwxr-xr-x 1 msilverman msilverman 6391 Mar 24 09:11 jcontrol
-rwxr-xr-x 1 msilverman msilverman 7925 Mar 24 09:11 keytool
-rwxr-xr-x 1 msilverman msilverman 8117 Mar 24 09:11 orbd
-rwxr-xr-x 1 msilverman msilverman 7957 Mar 24 09:11 pack200
-rwxr-xr-x 1 msilverman msilverman 7981 Mar 24 09:11 policytool
-rwxr-xr-x 1 msilverman msilverman 7925 Mar 24 09:11 rmid
-rwxr-xr-x 1 msilverman msilverman 7933 Mar 24 09:11 rmiregistry
-rwxr-xr-x 1 msilverman msilverman 7949 Mar 24 09:11 servertool
-rwxr-xr-x 1 msilverman msilverman 8149 Mar 24 09:11 tnameserv
-rwxr-xr-x 1 msilverman msilverman 220104 Mar 24 09:11 unpack200

libjli permissions

[root@vp-node6 yjp-2013-build-13072]# ls -l jre64/lib/amd64/jlibjli.so
total 104
-rw-r--r-- 1 msilverman msilverman 105728 Mar 24 09:11 libjli.so


From the JVM perspective, on load it simply says

Error occurred during initialization of VM
Could not find agent library /home/msilverman/yjp-2013-build-13072/bin/linux-x86-64/libyjpagent.so in absolute path, with error: /home/msilverman/yjp-2013-build-13072/bin/linux-x86-64/libyjpagent.so: cannot open shared object file: Permission denied


I need to run as user mapred - any ideas? I'm sure it's something stupid....
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Cannot access shared object file

Post by Anton Katilin »

I'm afraid I didn't get your question.

Do you have troubles with running Java under different user, or with adding the profiler agent option -agentpath to a command line which works without the profiler agent and does not work with it?

If latter, exactly which command line do you use to start your Java application?

What is the output of "uname -a"?
silverm
Posts: 4
Joined: Thu Mar 27, 2014 6:32 pm

Re: Cannot access shared object file

Post by silverm »

without the -agent it works fine, with the -agent i get the error

Error occurred during initialization of VM
Could not find agent library /home/msilverman/yjp-2013-build-13072/bin/linux-x86-64/libyjpagent.so in absolute path, with error: /home/msilverman/yjp-2013-build-13072/bin/linux-x86-64/libyjpagent.so: cannot open shared object file: Permission denied

[root@vp-node6 yjp-2013-build-13072]# uname -a
Linux vp-node6 2.6.32-279.el6.x86_64 #1 SMP Wed Jun 13 18:24:36 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux


Other symptoms - if i try and attached to a running process (yjp.sh -attach) as root, shell script runs but can't attach to process (because process is running as a different user). If i try and attach as user mapred (sudo -u mapred yjp.sh -attach) it says it can't find java. But JAVA_HOME is defined for user mapred.....
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Cannot access shared object file

Post by Anton Katilin »

What is the output of the following?

ls -l /home/msilverman/yjp-2013-build-13072/bin/linux-x86-64/libyjpagent.so

Perhaps you'll need to chmod libyjpagent.so
silverm
Posts: 4
Joined: Thu Mar 27, 2014 6:32 pm

Re: Cannot access shared object file

Post by silverm »

[msilverman@vp-node1 bin]$ ls -l /home/msilverman/yjp-2013-build-13072/bin/linux-x86-64/libyjpagent.so
-rw-r--r-- 1 msilverman msilverman 2895432 Mar 24 09:06 /home/msilverman/yjp-2013-build-13072/bin/linux-x86-64/libyjpagent.so
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Cannot access shared object file

Post by Anton Katilin »

The file has read access bit set for all users, so it should load just fine. Maybe there is an unresolved dependency issue.

Please let me repeat my previous question: what is the full command line used to launch your Java application?

And what is the output of:

ldd /home/msilverman/yjp-2013-build-13072/bin/linux-x86-64/libyjpagent.so

sudo -u <the user you need> ldd /home/msilverman/yjp-2013-build-13072/bin/linux-x86-64/libyjpagent.so
silverm
Posts: 4
Joined: Thu Mar 27, 2014 6:32 pm

Re: Cannot access shared object file

Post by silverm »

Got it working -- the issue was the permission on /home/msilverman....

Working great, now am able to profile mapreduce jobs on the cluster :)

Thanks for pointing, i figured it had to be something dumb-
Post Reply