0

I am looking to create a war file from Yeoman JHipster. I am running Ubuntu 14.04 and installed apache tomcat7 on the machine.

Everything seems to be set up. I created a war file using

./gradlew -Pprod clean bootRepackage

inside of the project.

It created two files in the app/build/libs folder named app_name.war, and app_name.war.original.

I renamed the app_name.war.original to ROOT.war and threw it in my var/lib/tomcat7/webapps/ directory.

I replaced the ROOT directory with the ROOT.war

Restared tomcat

sudo service tomcat7 restart

It generated a ROOT directory and kept the ROOT.war file.

Do I remove that file and keep the directory?

Went to localhost:8080 and I am getting a 404 not found. It's making the connection to the server because otherwise it would show up on some can't connect screen.

Do I need to map anything up to point to this ROOT directory? Why can it not find the index.html inside of the ROOT folder? Am I losing my mind?

ZWis212
  • 132
  • 1
  • 13
  • I also forgot to add that if I create my own ROOT directory inside the webapps directory and put just an index.html inside of it, it works fine. I am lost. – ZWis212 Jun 17 '16 at 03:18
  • Can you access `http://localhost:8080/ROOT/index.html`? – f_puras Jun 17 '16 at 08:50

2 Answers2

0

I'm guessing you have a build problem of some kind.

The creation of the ROOT directory, and leaving the ROOT.war behind is normal. You can just leave the ROOT.war alone from that point on. If you replace ROOT.war, then Tomcat will undeploy your application, remove the existing ROOT directory, and recreate it just as it did before with the contents of the new ROOT.war, and then deploy the ROOT application from the ROOT directory.

As to why it can not find the index.html, I would ensure that there is indeed an index.html in the exploded ROOT directory. In fact, I would make sure that everything in there looks like it's supposed to. Otherwise you need to check your build.

That I can't help you with, as I'm unfamiliar with gradle. But from everything you've said, Tomcat appears to be working fine, so the issue is with your war file.

Will Hartung
  • 115,893
  • 19
  • 128
  • 203
  • It's a possibility considering the options. I'm just surprised it can't find it considering it's in the same place as a regular ROOT/index.html – ZWis212 Jun 17 '16 at 13:37
0
  1. You should live the ROOT.war as it is, and put your apps solely inside /webapps folder. ROOT.war has it purpose. If you want your application to be in context root (accessible on localhost:8080/) then read about how to install war into root context.

  2. After you deploy your WAR, it should be accessible at

http://localhost:8080/name_of_war/

I stronlgy suggest you to enable tomcat admin webapp(read how to do this, it's very easy, usually you just need to uncommment user and roles section). Afterwards, deploy app via admin application.

Community
  • 1
  • 1
Mitja Gustin
  • 1,723
  • 13
  • 17
  • I will need to get the admin together. I did option 1 in that link by naming the war file ROOT.war before deploying it. From what I'm reading, I would then access it only by http://localhost:8080 – ZWis212 Jun 17 '16 at 13:35