简体   繁体   中英

Apache Tomcat is showing an already made WAR file instead of the home page at localhost:8080

Hello I am trying to pass my project to my instructor through war file. I have already made the war file and I am trying to check if the war file works. But when I run the tomcat and input the localhost:8080 in the browser a WAR file is being deployed instead of the home page

Startup command prompt: 在此处输入图片说明

localhost:8080 在此处输入图片说明

What I am expecting: 在此处输入图片说明 ApacheTomcat Webapps Folder:

在此处输入图片说明

Probably you work with a tomcat version customized by your instructor.

By default when you take a tomcat downloaded from the internet "as-is" you should create a WAR (say, calculator.war ) and put into webapps folder and after that you'll be able to access it by localhost:8080/calculator . That's the default behavior, but its still possible to deploy your custom war to be accessible through localhost:8080 as you've described.

There are a couple of ways to do so, but it looks like in your case there is an entry in $CATALINA_HOME$\\conf\\server.xml that looks something like this:

<Host name="localhost" appBase="webapps" unpackWARs="true"
  autoDeploy="false" deployOnStartup="false">
    <Context path="" docBase="Calculator"></Context>
     ....
</Host>

Or alternatively you have $CATALINA_HOME\\conf\\Catalina\\localhost\\ROOT.xml file that contains information about the Calculator war.

Another direction to check is that in your IDE you don't create ROOT.war out of your Calculator project. This is also a way to deploy stuff in the root context path.

All-in-all I suggest you reading This tutorial because the chances are that you somehow use one of these methods of deployment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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