title: Encountered "Could not contact localhost:8005" when running the Tomcat Service Script in Linux
body: <p>I created a tomcat service in linux to be able to automatically run the tomcat. However I encountered an issue where when I startup the tomcat using the service, it throws error. </p>
  
  <pre><code>SEVERE: Could not contact localhost:8005. Tomcat may not be running.
  java.net.ConnectException: Connection refused.....
  </code></pre>
  
  <p>But when I check, the tomcat is running fine because I'm able to access my localhost:8080. Then when I call the service to stop, the tomcat doesn't stop.</p>
  
  <p>My service script basically just call the startup.sh and shutdown.sh. I don't understand why when using the service script, there's error thrown on startup and it cannot shutdown. However, if I manually call the startup.sh and shutdown.sh, no issue is encountered.</p>
  
  <p>Does anyone know how to solve this issue?</p>
  
  <p>Thanks!</p>
  
  <p>I'm using TOMCAT 7 btw.</p>