Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been using vhosts on my XP dev machine with little to no problems, but I can't seem to duplicate the environment on Ubuntu. I've already added a line to /etc/hosts like so:

127.0.0.1    localhost
127.0.0.1    test    # ADDED

Then, a new Host entry in server.xml:

<Host name="test"  appBase="webapps2" unpackWARs="true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false">
</Host>

Then to verify it works, I copied over the default webapps into webapps2. Then made sure the permissions and even the owners and groups were exactly the same. Yet when I point my browser to http://test:8080, I get:

The requested resource (/) is not available. 

It's got me stumped these past few days and I know I'm probably missing something really simple. Anyone have any ideas?

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

Finally got it working. In the tomcat documentation, I interpreted the line:

For Tomcat 6, unlike Tomcat 4.x, it is NOT recommended to place
<Context> elements directly in the server.xml file.

to mean context elements should not defined in server.xml at all. So as recommended, I used the myWebappROOT/META-INF directory and defined a context.xml in there. However this paragraph:

* Only if a context file does not exist for the application in the
$CATALINA_BASE/conf/[enginename]/[hostname]/, in an individual file at /META-
INF/context.xml inside the application files. If the web application is
packaged as a WAR then /META-INF/context.xml will be copied to
$CATALINA_BASE/conf/[enginename]/[hostname]/ and renamed to match the
application's context path. Once this file exists, it will not be replaced if
a new WAR with a newer /META-INF/context.xml is placed in the host's appBase.

...seems to indicate that the first context I define in META-INF will be placed in the above mentioned directory and not be replaced by subsequent edits. I have elected to remove the [enginename]/[hostname] conf files which for me would be Catalina/test and add a minimal context element in server.xml. This seemed to fix the problem for now, at least from a dev environment perspective. Hopefully, someone can shed some more light on the proper way to deploy additional vhosts in a production environment.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.