java.io.FileNotFoundException: /opt/apache-tomcat-7.0.57/conf/server.xml (权限不够)

时间:2021-12-11 17:13:42

1 错误描述

youhaidong@youhaidong:~$ cd /opt/apache-tomcat-7.0.57
youhaidong@youhaidong:/opt/apache-tomcat-7.0.57$ bin/startup.sh
Using CATALINA_BASE:   /opt/apache-tomcat-7.0.57
Using CATALINA_HOME:   /opt/apache-tomcat-7.0.57
Using CATALINA_TMPDIR: /opt/apache-tomcat-7.0.57/temp
Using JRE_HOME:        /usr/lib/jvm/jdk1.7.0_71/jre
Using CLASSPATH:       /opt/apache-tomcat-7.0.57/bin/bootstrap.jar:/opt/apache-tomcat-7.0.57/bin/tomcat-juli.jar
touch: 无法创建"/opt/apache-tomcat-7.0.57/logs/catalina.out": 权限不够
bin/catalina.sh: 385: bin/catalina.sh: cannot create /opt/apache-tomcat-7.0.57/logs/catalina.out: Permission denied
youhaidong@youhaidong:/opt/apache-tomcat-7.0.57$ bin/shutdown.sh
Using CATALINA_BASE:   /opt/apache-tomcat-7.0.57
Using CATALINA_HOME:   /opt/apache-tomcat-7.0.57
Using CATALINA_TMPDIR: /opt/apache-tomcat-7.0.57/temp
Using JRE_HOME:        /usr/lib/jvm/jdk1.7.0_71/jre
Using CLASSPATH:       /opt/apache-tomcat-7.0.57/bin/bootstrap.jar:/opt/apache-tomcat-7.0.57/bin/tomcat-juli.jar
一月 02, 2015 3:23:28 下午 org.apache.catalina.startup.Catalina stopServer
严重: Catalina.stop:
java.io.FileNotFoundException: /opt/apache-tomcat-7.0.57/conf/server.xml (权限不够)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:146)
	at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:466)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:370)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:457)

youhaidong@youhaidong-ThinkPad-Edge-E545:/opt/apache-tomcat-7.0.57$

2 错误原因

由于用户权限不够,导致无法查看Tomcat下的server.xml

3 解决办法

修改用户权限