JAVA的环境变量写在/etc/profile下
JAVA_HOME=/usr/local/jdk1.6.0_11
export JAVA_HOME
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export CLASSPATH
PATH=$JAVA_HOME/bin:$PATH
export PATH
jboss的启动脚本如下:
#!/bin/bash
#file_name:go.sh
nohup ./catalina.sh run> tomcat.log &
tail -f tomcat.log
在此状态下,用root用户直接运行go.sh来启动jboss没有报任何的错误,当用普通用户通过sudo来运行的时候,刚出错了错误:
# sudo /bin/sh go.sh
出错如下:
WARNING: error instantiating 'org.apache.juli.ClassLoaderLogManager' referenced by java.util.logging.manager, class not found
java.lang.ClassNotFoundException: org.apache.juli.ClassLoaderLogManager not found
<>
WARNING: error instantiating '1catalina.org.apache.juli.FileHandler,' referenced by handlers, class not found
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler,
<>
Exception during runtime initialization
java.lang.ExceptionInInitializerError
<>
Caused by: java.lang.NullPointerException
<>
经过分析,原因无法加载到java的环境变量,所以要修改go.sh启动脚本,添加上环境变量,修改后如下:
#!/bin/bash
#file_name:go.sh
JAVA_HOME=/usr/local/jdk1.6.0_11
export JAVA_HOME
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export CLASSPATH
PATH=$JAVA_HOME/bin:$PATH
export PATH
nohup ./catalina.sh run> tomcat.log &
tail -f tomcat.log
再次运行启动脚本,正常启动
阅读(10364) | 评论(0) | 转发(0) |