title: Jenkins deployment to Tomcat failed
body: <p>I'm currently learning and implementing Jenkin's Pipeline for automated integration for java web application.</p>
  
  <p>My plan is that once developers successfully commit and push their codes, Jenkins on admin server check out the code, build the project, stop the currently running Tomcat, deploy the project to the Tomcat, and restart.</p>
  
  <p>For testing purpose, I'm currently trying everything, including running Tomcat and Jenkins, on local machine. But Jenkins is running its own (by executing command "Java -jar jenkins.war") but not using tomcat</p>
  
  <p>Everything worked fine with pipeline except for starting Tomcat. 
  below is the pipeline code snippet for tomcat restart.</p>
  
  <pre><code>stage('Restart') {
          steps {
              echo 'Restarting Tomcat.....'
              sh ''' 
                  cd ~/PATH-TO-Tomcat/apache-tomcat-8.0.44/bin
                  ./startup.sh
              '''
          }
  }    
  </code></pre>
  
  <p>As you can see, it simply goes to tomcat directory and execute the startup.sh script. However, when executing the restart stage, only the message "Tomcat started." is recored in console log file, but when checking with local host, Tomcat was not started at all. </p>
  
  <p>I tried to start tomcat manually by executing command using terminal, it works okay.</p>
  
  <p>Please help</p>
  
  <p>Thank you</p>