Java 拒绝在低权限用户的 Linux 中启动(作为 root 工作正常)
我被踩住了。
作为 root 时:
root@web01 [~]# uname -a
Linux web01 2.6.32-71.29.1.el6.x86_64 #1 SMP Mon Jun 27 19:49:27 BST 2011 x86_64 x86_64 x86_64 GNU/Linux`
root@web01 [~]# java -version
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)
作为低权限用户时:
user@web01 [~]# java -Xmx32m -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
更新:
ulimit -a 的输出(当作为低权限用户运行时):
core file size (blocks, -c) 200000
data seg size (kbytes, -d) 200000
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 7875
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) 200000
open files (-n) 100
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 35
virtual memory (kbytes, -v) 200000
file locks (-x) unlimited
I'm stomped.
While as root:
root@web01 [~]# uname -a
Linux web01 2.6.32-71.29.1.el6.x86_64 #1 SMP Mon Jun 27 19:49:27 BST 2011 x86_64 x86_64 x86_64 GNU/Linux`
root@web01 [~]# java -version
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)
While as a low-privilege user:
user@web01 [~]# java -Xmx32m -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
UPDATED:
Output of ulimit -a (when run as the low privilege user):
core file size (blocks, -c) 200000
data seg size (kbytes, -d) 200000
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 7875
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) 200000
open files (-n) 100
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 35
virtual memory (kbytes, -v) 200000
file locks (-x) unlimited
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这就是你的罪魁祸首。具有 32M 堆的 Java Vm 不适合这样的情况:
Here's your culprit. A Java Vm with 32M heap won't fit into that:
将以下行添加到 /etc/security/limits.conf
将
替换为您的 Linux 用户。 -as(地址空间)将用于修改虚拟/实际内存。Add following lines to the /etc/security/limits.conf
Replace
<user>
with your linux user. -as(address space) will be used to modify virtual/actual memory.