For Tomcat situated on root directory in Linux O.S, tomcat Catalina needs to have permission, and for the user who has run the tomcat may face the issue who does not have required permission to do so. So while running tomcat we may face the similar issues as below:
Now start tomcat:
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /home/kchapagain/spark/jdk1.8.0_101
Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
touch: cannot touch '/opt/tomcat/logs/catalina.out': Permission denied
tomcat/bin/catalina.sh: 415: tomcat/bin/catalina.sh: cannot create /opt/tomcat/logs/catalina.out: Permission denied
In order to resolve this issues one's need to give the permission for that user as:sudo chown -R kchapagain:kchapagain /opt/tomcat/
Where "kchapagain" is my os user. And my apache-tomcat location is under /opt and apache-tomcat name is "tomcat".Now start tomcat:
sudo kill -9 `pgrep java || echo 1` //run if java is already in used for specific port to avoid address already bind issue.
sh /opt/tomcat/bin/startup.sh
The output will be similar as:Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /home/kchapagain/spark/jdk1.8.0_101
Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Tomcat started.