0
votes

On Ubuntu 16.04, I stop the tomcat7 server with:

sudo tomcat7 stop

Then I created a war file as follows:

mkdir test
created index.html within test
jar -cf test.war test

I copy the war file into the webapps directory:

webapps/test.war

I bring up tomcat using the command: sudo service tomcat7 start

which works, so that the following url shows the server working:

localhost:8080

As I understand it, the following URL should go to the .war file localhost:8080/test

It does not work. (404 error) What am I doing wrong?

1
You need web.xml also for the new app test. Refer this link. jetbrains.com/help/idea/… else you can access the static HTML page directly by giving the whole URL. localhost:8080/test/index.htmldeepanmurugan

1 Answers

1
votes

Follow the below procedure to create war file:

1) mkdir test 2) Go to the test directory and create index.html 3) create war file using the below command:

jar -cf test.war .

4) Move created test.war file into the webapps folder. Restart tomcat service and test.After restart check your webapps folder for an extracted folder test. You will see index.html file inside webapps/test folder.

jar -cf test.war test command will create test folder inside test.war. so you need to access i.e http://localhost/test/test/