Thanks again. That works great, I'm accessing my webapp fine as the default webapp with the following

<Engine name="Catalina" defaultHost="localhost" debug="9">
<Host name="localhost" debug="9" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="pets-proper" debug="9">
<Environment name="servername" type="java.lang.String" value="dev.andrew" override="false"/>
</Context>
</Host>
</Engine>


However, my application can't find the 'servername' environment property again!

The combinations I've tried (each one three times to be sure) and their behaviour

path="", docBase="xxx", WAR named xxx.war --- WAR is unpacked, webapp starts but property not found
path="/", docBase="xxx", WAR named xxx.war --- WAR is unpacked, webapp starts but property not found
path="", docBase="ROOT", WAR named ROOT.war --- WAR is not unpacked, webapp does not start
path="/", docBase="ROOT", WAR named ROOT.war --- WAR is unpacked, webapp starts and property found!


I'm now really confused. The last option was where I came in! This didn't work previously and now does. I really wish that I understood tomcats behaviour. The only other change is that I've cleaned up my server.xml file but only to remove comments and commented out sections.

Andoni, thank you for your replies. Does this make any sense at all to you? If I have the time I'll take a look at the tomcat source but deadlines are looming at the moment... For the moment I have my fingers crossed (not my favourite policy) that all will keep working.

Regards
Andrew


Andoni wrote:

Yes, you can have any xxx.war that you access from
http://localhost/login.jsp so long as it's path="" and it is the only
context in that <Host> which has path="". This is what makes it the default
app.

Andoni.
----- Original Message ----- From: "Andrew Watters" <[EMAIL PROTECTED]>
Newsgroups: gmane.comp.jakarta.tomcat.user
Sent: Friday, November 12, 2004 5:00 PM
Subject: Re: Context element problems in conf/server.xml





Hi Andoni

Thanks again for your reply.

I hope I'm understanding what you say correctly, apologies if not. If I
rename my WAR to say, app.war, then to access a page the URL would
become http://localhost/app/login.jsp. The reason why I changed the
appBase to ROOT and renamed my WAR ROOT.war was so that the URL would be
http://localhost/login.jsp. This is a customer directive.

Is the problem that I'm going about this the wrong way in the first
place? Can I have an app.war and access it like


http://localhost/login.jsp?


Best regards
Andrew




Andoni wrote:



Ok, You can ignore the <logger>'s and <valve>'s when you are worrying


about


configuration. So what you are left with is:

<Engine name="Catalina" defaultHost="localhost" debug="9">
<Host name="localhost" debug="9" appBase="webapps" unpackWARs="true"
autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Context path="/" docBase="ROOT" debug="9">
</Context>
</Host>
</Engine>


What you have to be aware of is that "ROOT" is more than just another


name


for a webapp. ROOT is a special name for the default webapp in a host.
Therefore what you should do is to remove all references to root. Comment
out this line of the server.xml, call your .war file something else and


set


the path="".

Regards,
Andoni.

----- Original Message ----- From: "Andrew Watters" <[EMAIL PROTECTED]>
Newsgroups: gmane.comp.jakarta.tomcat.user
Sent: Friday, November 12, 2004 11:30 AM
Subject: Re: Context element problems in conf/server.xml







Thanks for your reply. Please find below the tags as requested. Thank
you for taking the time.

<Engine name="Catalina" defaultHost="localhost" debug="9">
<Valve className="org.apache.catalina.valves.RequestDumperValve"/>
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_log." suffix=".txt" timestamp="true"/>
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
debug="9" resourceName="UserDatabase"/>
<Host name="localhost" debug="9" appBase="webapps" unpackWARs="true"
autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Context path="/" docBase="ROOT" debug="9">
<Environment name="servername" type="java.lang.String"
value="dev.andrew" override="false"/>
</Context>
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"


timestamp="true"/>


</Host>
</Engine>



Andoni wrote:





Hello,

You certainly don't need the "/" in the path attribute. This is not


going




to




work as it cannot match just one slash.

Would you please post the <Engine> <Host> and <Context> tags. They


should


all be seen as a group to know exactly what's being called.

Andoni.

----- Original Message ----- From: "Andrew Watters" <[EMAIL PROTECTED]>
Newsgroups: gmane.comp.jakarta.tomcat.user
Sent: Thursday, November 11, 2004 4:19 PM
Subject: Context element problems in conf/server.xml









Hi

I posted a problem a couple of days ago which I've made some progress






with.






Originally my webapp ROOT.war would not unpack. I've figured out the
problem was with the Context element as shown below

<Context path="" docBase="ROOT" debug="9">
<Environment name="servername" type="java.lang.String"
value="dev.andrew"/>
</Context>

If I unpacked ROOT.war manually then my application worked fine.

By adding a forward slash to the path attribute as shown below

<Context path="/" docBase="ROOT" debug="9">
<Environment name="servername" type="java.lang.String"
value="dev.andrew"/>
</Context>

tomcat now unpacks the WAR fine. However, my application no longer
starts because it cannot find the 'servername'! Yikes!

Does anybody have any suggestions please?

Thanks again
Andrew






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]










---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]










---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







Reply via email to