Select Page

For those core Java developers you will be very comfortable utilising the power of the Tomcat Manager to deploy your applications to your servers. But what happens when you’re working on a server that doesn’t have the usual Tomcat Manager available for you to use, just how do you go about deploying your application easily?

Thankfully, it is fairly straight forward to do, it just requires a couple more steps to get this working.

Ultimately your .war file for your Java web application is just a fancy .zip file and as such we can treat it as so. So follow the simple steps outlined below and you’ll have your Java WAR file deployed on cPanel in no time, all without using the Tomcat Manager.

  • Within your IDE, Clean and Build your project to compile and package the war file so you’ll end up with a file here: /{IDE_FOLDER}/ExampleProject/dist/ExampleProject.war
  • Rename this file to .zip
  • Login to your cPanel account and go to the File Manager
  • Navigate to /public_html
  • Create a folder called: Backup_yyyy_mm_dd (you know…. Just in case)
  • Move all of your current files into the backup folder you just created (excluding any files that aren’t part of your project i.e. .htaccess file, cgi-bin, .well-known (SSL certificates with Let’s Encrypt) and any application live data files such as images or document uploads that only sit within your live system due to user usage etc.
  • Upload your ExampleProject.zip file
  • Unzip the file
  • Done

Note, you shouldn’t need to restart Tomcat as all your new files should get automatically loaded into memory by Tomcat, but if you do notice that some files aren’t showing the latest version then you may need to restart Tomcat to ensure the files are all uploaded. To do this the handy command on the latest version of cPanel (at the time of writing!) is as follows. Simple SSH into your server or use the Terminal functionality that exists within cPanel and run the command;

                ubic restart ea-tomcat85

This will restart the running Tomcat instance for your user only. Simple!

And if all has failed and you need to restore the backup files you backed up at the start, jump into your FTP Client software such as FileZilla where you can easily move all files within your backup folder back to the parent level. Unfortunately this part isn’t out of the box functionality with cPanel, so I’d make sure you can access your server using FileZilla before you attempt this process as you may need to quickly jump back on there and fix it.

The following two tabs change content below.

Michael Cropper

Founder & Managing Director at Contrado Digital Ltd
Michael founded Contrado Digital in 2013. He has experience working with national and multi-national brands in a wide range of industries, helping them achieve awesome results. Michael regularly speaks at local universities and industry events while keeping up with the latest trends in the digital industry.