Apache Tomcat Setup and Web Project Deployment in Visual Studio code
In this article we will learn to setup apache tomcat in Visual Studio Code and then we will see how to create a war file from a web project and deployment in tomcat and run application.
Important to know:
- Visual Studio code does not come with any embedded application server.
- As we know to work with web application we required server integration.
-In Visual Studio Code , We need third party extension to integrate appliaction server like tomcat.
So, Lets learn Apache Tomcat Setup and Web Project Deployment
Step 2: Create war file buy running command 'mvn clean package'
check if BUILD SUCCESS , if yes Then Congrats....
Step3: Install 'Community Server Connectors' extension
Step4: Download latest tomcat server from the link https://tomcat.apache.org/
Step4: After Installed Community Server Connectors Now you can see servers at the bottom of visual studio
Step5: right click on Community Server Connectors and choose Create New Server. A prompt will open and ask Download server?
Choose yes if you dont have already .
Choose No, use server on disk and select desired server location.
You can see your server and right click on server and choose to 'Start Server'
Congrats, Started Server, verify your server where you already configured with port number like http://localhost:8089/
Step5: For deployement right click on tomat server and choose 'Add Deployment'.
Step6: Choose type of deployment like file
Step7: Choose war file further will ask you 'Do you want to edit optional deployment parameters' and chooose No
Step8: right click on tomat server and choose 'Publish Server (Full)'.
Step9: right click on tomat server and choose 'Publish Server (Full)' and start the server again after that you will see (Starting) (Synchronised).
Step10: Deployment sucessfull, right click and go to 'Sever action' and choose 'show in browser' Deployment' and choose localhost for example http://localhost:8089/servletapp/