我有一个由 shell 脚本触发的 java 文件。如果我在命令行执行shell脚本,它会毫无问题地执行java文件,但是如果我从浏览器执行这个shell脚本(我有一个在linux服务器中执行这个shell脚本的index.php),它不会在shell脚本中执行java文件。如果我从 shell 脚本中删除 java 执行行,shell 脚本将正确执行。
下面是我从浏览器执行时收到的错误。
Error From browser:Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00007fcf589ac000, 2555904, 1) failed; error='Permission denied' (errno=13) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (malloc) failed to allocate 2555904 bytes for committing reserved memory. # An error report file with more information is saved as: # /tmp/hs_err_pid306.log
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 2555904 bytes for committing reserved memory.
# Possible reasons:
# The system is out of physical RAM or swap space
# In 32 bit mode, the process size limit was hit
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Use 64 bit Java on a 64 bit OS
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
# Out of Memory Error (os_linux.cpp:2726), pid=306, tid=140528680765184
#
# JRE version: (7.0_51-b13) (build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.51-b03 mixed mode linux-amd64 compressed oops)
Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
请帮我解决这个问题。上周就被这个问题困扰了。 :|
最佳答案
权限问题。 您可能以与浏览器不同的用户身份运行此 java 文件。
包含更多信息的错误报告文件保存为:#/tmp/hs_err_pid306.log 这个错误说明了什么?
关于java 文件是从命令行执行的,而不是从浏览器(apache)执行的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23343155/