简体   繁体   English

Tomcat7 Ubuntu 14.04将$ CATALINA_HOME指向var / lib / tomcat7 / ROOT

[英]Tomcat7 Ubuntu 14.04 pointing $CATALINA_HOME to var/lib/tomcat7/ROOT

I am looking to create a war file from Yeoman JHipster. 我希望从Yeoman JHipster创建一个战争文件。 I am running Ubuntu 14.04 and installed apache tomcat7 on the machine. 我正在运行Ubuntu 14.04,并在计算机上安装了Apache tomcat7。

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. 它在app / build / libs文件夹中创建了两个文件,名为app_name.war和app_name.war.original。

I renamed the app_name.war.original to ROOT.war and threw it in my var/lib/tomcat7/webapps/ directory. 我将app_name.war.original重命名为ROOT.war并将其扔到我的var / lib / tomcat7 / webapps /目录中。

I replaced the ROOT directory with the ROOT.war 我用ROOT.war替换了ROOT目录

Restared tomcat 重命名的雄猫

sudo service tomcat7 restart

It generated a ROOT directory and kept the ROOT.war file. 它生成了一个ROOT目录并保留了ROOT.war文件。

Do I remove that file and keep the directory? 我要删除该文件并保留目录吗?

Went to localhost:8080 and I am getting a 404 not found. 去了本地主机:8080,我找不到404。 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? 我是否需要映射任何内容以指向此ROOT目录? Why can it not find the index.html inside of the ROOT folder? 为什么在ROOT文件夹中找不到index.html? Am I losing my mind? 我失去理智了吗?

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. 创建ROOT目录,并将ROOT.war留在后面是正常的。 You can just leave the ROOT.war alone from that point on. 从那时起,您可以只留下ROOT.war。 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. 如果替换ROOT.war,则Tomcat将取消部署您的应用程序,删除现有的ROOT目录,并像以前一样使用新的ROOT.war的内容重新创建它,然后从ROOT目录中部署ROOT应用程序。

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. 至于为什么找不到index.html,我将确保展开的ROOT目录中确实存在index.html。 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. 我帮不上忙,因为我不熟悉gradle。 But from everything you've said, Tomcat appears to be working fine, so the issue is with your war file. 但是从您所说的一切来看,Tomcat似乎运行良好,因此问题出在您的war文件上。

  1. You should live the ROOT.war as it is, and put your apps solely inside /webapps folder. 您应该原样保留ROOT.war,并将您的应用程序仅放在/ webapps文件夹中。 ROOT.war has it purpose. ROOT.war有它的目的。 If you want your application to be in context root (accessible on localhost:8080/) then read about how to install war into root context. 如果您希望您的应用程序位于上下文根目录(可在localhost:8080 /上访问),请阅读有关如何将war安装到根上下文中的信息。

  2. After you deploy your WAR, it should be accessible at 部署WAR后,应该可以从以下位置访问它

http://localhost:8080/name_of_war/ 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). 我强烈建议您启用tomcat admin webapp(阅读操作方法,这非常简单,通常只需要取消对用户和角色的注释)。 Afterwards, deploy app via admin application. 之后,通过管理应用程序部署应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM