为朋友配置服务器,这是我第一次处理 Tomcat,我差点就把剩下的那点头发都扯掉了:)
对于他的项目,他需要使用 PHP Java Bridge,我已经将服务器安装到 Tomcat6 并正在运行的程度,桥接也是如此。他可以通过 localhost 调用来访问它,如下所示:
<?php require_once("http://localhost:8080/JavaBridge/java/Java.inc");?>
一切都运行良好。
[root@server home]# wget -q http://localhost:8080/JavaBridge/java/Java.inc
[root@server home]# ls | grep Java.inc
Java.inc
服务运行良好:
[root@server home]# ps ax | grep tomcat
44747 ? Sl 0:03 /usr/lib/jvm/java/bin/java -classpath :/usr/share/tomcat6/bin/bootstrap.jar:/usr/share/tomcat6/bin/tomcat-juli.jar:/usr/share/java/commons-daemon.jar -Dcatalina.base=/usr/share/tomcat6 -Dcatalina.home=/usr/share/tomcat6 -Djava.endorsed.dirs= -Djava.io.tmpdir=/var/cache/tomcat6/temp -Djava.util.logging.config.file=/usr/share/tomcat6/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager org.apache.catalina.startup.Bootstrap start
[root@server home]# /etc/init.d/tomcat6 status
tomcat6 (pid 44747) is running...
现在,如果我们需要重新启动 - 我会得到这个:
[root@server home]# /etc/init.d/tomcat6 restart
Stopping tomcat6: [FAILED]
Starting tomcat6: [ OK ]
有点令人困惑,如果我杀死 pid 然后启动,我最终会得到
[root@server tomcat6]# /etc/init.d/tomcat6 start
: command not found6.conf: line 10:
: command not found6.conf: line 13:
: command not found6.conf: line 19:
: command not found6.conf: line 22:
: command not found6.conf: line 25:
: command not found6.conf: line 28:
: command not found6.conf: line 31:
: command not found6.conf: line 34:
: command not found6.conf: line 37:
: command not found6.conf: line 40:
: command not found6.conf: line 43:
: command not found6.conf: line 46:
Starting tomcat6: chown: `tomcat\r:tomcat\r': invalid user
chown: `tomcat\r:tomcat\r': invalid user does not exist, creating
ln: creating symbolic link `/usr/share/tomcat6\r/work' to `/var/cache/tomcat6': No such file or directory
ln: creating symbolic link `/usr/share/tomcat6\r/temp' to `/var/tmp/tomcat6': No such file or directory
chown: `tomcat\r:tomcat\r': invalid user
[FAILED]
有任何想法吗?
非常感激 :)
答案1
对我来说,这听起来就像有人在某些 Windows 文本编辑器中编辑了/etc/init.d/tomcat6
脚本,现在脚本中有 DOS 换行符而不是 Unix 换行符,这让 init 系统感到困惑。
用于file /etc/init.d/tomcat6
检查这是否正确。如果正确,则使用例如dos2unix /etc/init.d/tomcat6
将文件转换为 Unix 换行符。