I'm currently learning and implementing Jenkin's Pipeline for automated integration for java web application.
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.
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
Everything worked fine with pipeline except for starting Tomcat. below is the pipeline code snippet for tomcat restart.
stage('Restart') {
steps {
echo 'Restarting Tomcat.....'
sh '''
cd ~/PATH-TO-Tomcat/apache-tomcat-8.0.44/bin
./startup.sh
'''
}
}
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.
I tried to start tomcat manually by executing command using terminal, it works okay.
Please help
Thank you