How to Generate WAR file and deploy Our Web Service App on Apache Tomcat on Amazon EC2 Linux Server?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this video tutorial i will explain how to generate the war file and deploy the web service application on tomcat server which is installed in ec2 instance before generating the war file we have to make some changes the first change is the class application should extends spring boot servlet initializer and it should override this configure method and it should return builder dot sources then in form.xml file the packaging we have to specify as war by default packaging is jar that we have to change it to var and also we have to include spring boot starter tomcat dependency and scope should be provided and this is to instruct spring boot not to use the inbuilt tomcat server here you can see the class application which is spring boot application and it extends a spring boot servlet insert and override configure method and inform.xml file packaging we have specified as war and also we have included spring boot starter tomcat dependency then use this maven command to generate the war file mvn clean install and then i am skipping the junit test cases here you can see build is successful and war file is generated in this location click on refresh and here you can see the war file has been generated here you can see the application.properties file and here you can see the contacts path name user hyphen app hyphen ws this context path name and war file name should be same before we deploy the war file in the external tomcat server rename that here you can see the database url in that we have mentioned the database name as org underscore db so we have to create this database first and to connect to the database we are using a root as username and password as root and here is the driver class name now we will create the databases org underscore db here you can see amazon aws console and in that i have started this particular ec2 instance copy this ipv4 address and i have connected to ec2 server using this command start the mariadb server and using this command i am going to login to mariadb and it is showing access denied for user root at localhost use this command mysql minus u username is root minus p the password is also root and it is successfully connected and these many databases are there use create database command to create org underscore db database and it is successfully created we can check that and here you can see our underscore db is created next i am going to start the tomcat server and here you can see the tomcat server has been started copy this dns name and the tomcat is running on 8080 port and tomcat webpage has been opened click on manager app click on choose file to deploy the war file and inside the target folder the war file is there which we have generated click on deploy and here you can see the war file has been placed inside web apps folder and it is deploying this war file and here you can see the war file has been deployed successfully and it is running and if you want to stop or reload or undeploy you can use this options click on logs and here you can see the war file has been successfully deployed when i was clicking manager app it was not asking username and password because i already entered username and password when i have tested i am removing the browser history refresh click on manager app and here you can see now it is asking user name and password username is admin and password is admin123 which i already configured it has logged in successfully now i am going to check in or underscore db the tables are created and you can see user stable and addresses table and hibernate underscore sequence table has been created based on the domain objects here you can see user entity class and based on that this usage table is created and here you can see address entity class based on that addresses table is created which will have these columns and users table will have these columns id user id first name last name email encrypted password etc and currently the users table does not have any record and addresses table also does not have any record and users table has columns like id email email verification status email verification token encrypted password first name last name and user id and addresses table has id address underscore id city country postal code street name type and user id these columns are automatically created based on these entity classes now we will see how to send a http request to a web service which is deployed on the remote ec2 server here you can see the tomcat server is up and running and the web service application is deployed and it is successfully running now we will see how to send request using postman and create the user get the user etc to create the user we have to use this url and in that instead of localhost we have to provide a dns name and http method should be post and in the body we have to provide this json it has user details like first name last name email address password and addresses http method should be post and copy this dns name instead of localhost it should be dns name and the port number is 8080 click on body select json click on headers and here you can see the content type is json which we are going to send to the server and the response can be xml or json if you want to specifically json you can mention here on send and here you can see we got status quo as 200 okay and the user is successfully created and we got public user ids this value and here you can see the user table has one record and here you can see the addresses table has two records next we will send request to this login url to get public user id and jwt token and for this particular request http method should be post and in the body we have to pass email address and the password and here is the request url copy the dns name instead of localhost it should be dns name and in the body we provided email address and the password click on send we got status code as 200 okay so it is successful click on headers and here we got public user id and here we got the jwt token next we will see how to get the user details using a public user id for that we have to use this url and http method should be get and here you can see we are using this url to get the user details and http method should be get and public user id copy from here and in the headers we have to pass jwt token so here you can see authorization if it is not there you have to add that and copy this jwt token click on send it could not send the request because here localhost is there we have to put a dns name click on send and here we got the user details based on the public user id we have sent if you want to access sauger ui web page then we have to use this url and this is the dns name we have to provide and at the end sauger hyphen ui.html should be there open link in the new tab and here provide solver hyphen ui.html click on enter and here we got the sauger page and it has apa documentation for the user web service application you can get java source code link from the description of the video in mobile to see the description click on this icon it will expand like this and here you can see the description it contains java source code links click on these links to get the java source code
Info
Channel: Ram N Java
Views: 1,768
Rating: undefined out of 5
Keywords: AWS, Amazon EC2, Apache Tomcat, Web Service Deployment, WAR File, Cloud Computing, Amazon Web Services, EC2 Instance, Java Web Application, Apache Tomcat Deployment, Web Application Hosting, AWS Tutorial, Java WAR File, Tomcat Server, Amazon Linux, Deploying Web Apps, AWS EC2 Deployment, Web Service Hosting, Tomcat Configuration, Deployment Tutorial, Cloud Hosting, Java Web Services, Web Application Deployment, Amazon EC2 Setup, Server Management.
Id: BPc7UiRymb8
Channel Id: undefined
Length: 19min 11sec (1151 seconds)
Published: Fri Apr 29 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.