When ever you deploy website into web server or application server you need to wrap it into WAR file rather than copying files as folder.
Below we will see how to deploy war file into tomcat server.There are two ways to do that.
Method 1
1.You need to export your project as war file.
2.now copy the war file to the tomcat folder.In my case D:\tomcat7\webapps\.
3.After copying the war file to webapps folder you should restart your server to make the folder dispatched in the webapps folder.
4.Now our final step is to make sure what ever we have done in working by typing the local url in browser say if i have copied a war file by name Acme.war I should able to access the folders in project by name http://localhost:8081/Acme/
Method 2
1.In this method you I will use Tomcat manager to deploy the WAR file.
2.If you have used tomcat binary version you need to configure tomcat manager user name and password
as below
- Open D:\tomcat7\conf\tomcat-users.xml
- Add the below entries in tomcat-users.xml
- Now the tomcat manager username and password is set to admin and secret
3.We are ready to go and access the tomcat manager now.
tomcat-users.xml
<role rolename="manager-gui"/> <role rolename="manager-status"/> <role rolename="manager-script"/> <role rolename="manager-jmx"/> <user username="tomcat" password="secret" roles="manager-gui,manager-status,manager-script,manager-jmx"/>
You can see the following browse for WAR option under Deploy Tab
You need to browse for the war file and restart the server.