View previous topic :: View next topic |
Author |
Message |
Farmboy n00b
Joined: 10 Jul 2011 Posts: 22
|
Posted: Fri Jun 08, 2012 5:28 pm Post subject: [solved]java vm cant find libjli.so when running as user |
|
|
Hello,
here is my problem
I am running Gentoo on amd64(not sure that matters).
I emerge sun-jdk version 1.6.0_32.
I can run java -version as root and as user.
Then I set a capabilities flag on /opt/sun-jdk-1.6.0.32/bin/java
with the command
setcap 'CAP_NET_BIND_SERVICE=+ep' /opt/sun-jdk-1.6.0.32/bin/java
I can run java -version as root but not as user.
I get the error message that libjli.so cannot be loaded.
This lib resides in jre/lib/amd64/jli but java doesnt find it when run as user.
I copy the lib to /usr/local/lib64 and run ldconfig.
Now java -version hangs when run as user.
The same effect happen with oracle-jdk 1.7.0.4.
But when I copy the lib to /usr/local/lib64 I can run it as user.
So why is java not picking up the lib as user?
Any ideas?
Thanks for reading
Last edited by Farmboy on Mon Jul 16, 2012 2:09 pm; edited 1 time in total |
|
Back to top |
|
|
anb.clarke n00b
Joined: 05 Apr 2006 Posts: 31
|
Posted: Tue Jun 19, 2012 4:35 am Post subject: |
|
|
You have both sun-jdk 1.6 and oracle-jdk-bin 1.7. Does choosing the user vm defaults with eselect java-vm help in any way?
Code: | gentoo > eselect java-vm list
Available Java Virtual Machines:
[1] oracle-jdk-bin-1.7 system-vm
[2] sun-jdk-1.6
gentoo > eselect java-vm list user
Available Java Virtual Machines:
[1] oracle-jdk-bin-1.7 system-vm
[2] sun-jdk-1.6
gentoo > eselect java-vm set user 1
gentoo > eselect java-vm list user
Available Java Virtual Machines:
[1] oracle-jdk-bin-1.7 system-vm user-vm
[2] sun-jdk-1.6 |
|
|
Back to top |
|
|
Farmboy n00b
Joined: 10 Jul 2011 Posts: 22
|
Posted: Tue Jun 19, 2012 4:39 pm Post subject: |
|
|
No it doesnt.
I already set the vm as user. |
|
Back to top |
|
|
anb.clarke n00b
Joined: 05 Apr 2006 Posts: 31
|
|
Back to top |
|
|
Farmboy n00b
Joined: 10 Jul 2011 Posts: 22
|
Posted: Sat Jun 23, 2012 8:08 am Post subject: |
|
|
The JDK bug you linked is the exact same behaviour I am also getting.
But from reading the bug its not so much that the jdk doesnt support posix capabilities and more that due to the way the binary is build there is a problem resolving the library path. The net effect remains the same though.
The stackoverflow link you posted is the one where i got the idea with the capabilities from.
http://splunk-base.splunk.com/answers/5037/using-setcap-to-allow-non-root-splunk-user-to-start-splunkweb-on-port-443
gave me the following interesting tidbit:
Quote: | You cannot use setcap to grant the capability to splunkd or python in any meaningful way. Processes in linux that are run with escalated privileges cannot use a LD_LIBRARY_PATH which is essential. |
I am not firm enough with binary loading and library resolving on linux to evaluate this.
But it sounds like this could be the problem. |
|
Back to top |
|
|
Farmboy n00b
Joined: 10 Jul 2011 Posts: 22
|
Posted: Tue Jul 03, 2012 3:22 pm Post subject: |
|
|
I just tested out the workaround from the jdk bug report namely changing the rpath with patchelf and it works for me. |
|
Back to top |
|
|
|