Koray Tugay
Koray Tugay

Reputation: 23780

Multiple web-apps in Tomcat by hostname sub-directory issue

I have created a folder called webappsx under Tomcat folder and added a file called sample.war in it.

I have this entry in server.xml:

<Host name="otherhost"  appBase="webappsx" unpackWARs="true" autoDeploy="true" />

And I have also edited my hosts file so that I could test in my local.

When I go to

http://otherhost:8081/sample/

I see the application running fine. Up to here it is all good. But I want to be able to see the application when I visit

http://otherhost:8081

So what I am trying is:

<Host name="otherhost"  appBase="webappsx/sample" unpackWARs="true" autoDeploy="true" />

But this does not seem to work. A "Not Found" is returned from the server. Why?

Upvotes: 0

Views: 176

Answers (1)

Stefan
Stefan

Reputation: 12453

You need to deploy the application in the ROOT directory. Call the file ROOT.war before deployment and use:

<Host name="otherhost"  appBase="webappsx" unpackWARs="true" autoDeploy="true" />

Upvotes: 1

Related Questions