You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Collins, Jim" <ji...@uk.nomura.com> on 2003/03/21 17:40:10 UTC

RE: What to set docBase attribute to in an individual Context.xml fil e

Hi Jake,

Thanks for getting back so quick. So the context file in META-INF should be
context.xml and not myapp.xml?

That is maybe where I have been going wrong, I read some previous posts on
this from Craig and I thought he said you name the context file with the
name of your app and a .xml extension. 

I'll try what you say.

Thanks

Jim.

> -----Original Message-----
> From: Jacob Kjome [mailto:hoju@visi.com]
> Sent: 21 March 2003 16:35
> To: Tomcat Users List
> Subject: Re: What to set docBase attribute to in an individual
> Context.xml fil e
> 
> 
> 
> First, the name of the context configuration file put into 
> META-INF should 
> be, very specifically, "context.xml".  The docBase needs to 
> be name of your 
> .war file.  So, if you your .war file is "MyWarFile.war", 
> then it should be 
> docBase="MyWarFile.war".
> 
> Jake
> 
> At 02:49 PM 3/21/2003 +0000, you wrote:
> >Hi,
> >
> >I am deploying my application using manager/deploy. In the META-INF
> >directory I have myapp.xml file. If I am deploying the app 
> using manager
> >does anyone know what I should set the docBase attribute to? 
> I am also
> >having problems reading an Environment property from the 
> context file.
> >
> >Here is my context file:
> >
> ><Context classname="org.apache.catalina.core.StandardContext"
> >         path="/myapp" debug="0" privileged="true">
> >
> >   <Environment name="Test" type="java.lang.String"
> >                 value="Test value"/>
> ></Context>
> >
> >In my code I try to do this:
> >
> >         _ic = new InitialContext();
> >         log.debug("Test look up = " +
> >(String)_ic.lookup("java:comp/env/Test"));
> >
> >But I get an error saying  "Name Test is not bound in this Context"
> >
> >If however I have this entry in the web.xml file it works:
> >
> >         <env-entry>
> >                 <description>
> >                         Test
> >                 </description>
> >                 <env-entry-name>Test</env-entry-name>
> >                         <env-entry-value>This is a 
> test</env-entry-value>
> >                 <env-entry-type>java.lang.String</env-entry-type>
> >         </env-entry>
> >
> >If anyone could shed any light on this it would be appreciated.
> >
> >Thanks
> >
> >Jim.
> >
> >
> >PLEASE READ: The information contained in this email is confidential
> >and intended for the named recipient(s) only. If you are not 
> an intended
> >recipient of this email you must not copy, distribute or take any
> >further action in reliance on it and you should delete it 
> and notify the
> >sender immediately. Email is not a secure method of communication and
> >Nomura International plc cannot accept responsibility for 
> the accuracy
> >or completeness of this message or any attachment(s). Please 
> examine this
> >email for virus infection, for which Nomura International plc accepts
> >no responsibility. If verification of this email is sought 
> then please
> >request a hard copy. Unless otherwise stated any views or opinions
> >presented are solely those of the author and do not 
> represent those of
> >Nomura International plc. This email is intended for informational
> >purposes only and is not a solicitation or offer to buy or sell
> >securities or related financial instruments. Nomura 
> International plc is
> >regulated by the Financial Services Authority and is a member of the
> >London Stock Exchange.
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


PLEASE READ: The information contained in this email is confidential
and intended for the named recipient(s) only. If you are not an intended
recipient of this email you must not copy, distribute or take any 
further action in reliance on it and you should delete it and notify the
sender immediately. Email is not a secure method of communication and 
Nomura International plc cannot accept responsibility for the accuracy
or completeness of this message or any attachment(s). Please examine this
email for virus infection, for which Nomura International plc accepts
no responsibility. If verification of this email is sought then please
request a hard copy. Unless otherwise stated any views or opinions
presented are solely those of the author and do not represent those of
Nomura International plc. This email is intended for informational
purposes only and is not a solicitation or offer to buy or sell
securities or related financial instruments. Nomura International plc is
regulated by the Financial Services Authority and is a member of the
London Stock Exchange.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: What to set docBase attribute to in an individual Context.xml fil e

Posted by Jacob Kjome <ho...@visi.com>.
Note that "context.xml" is only applicable when you are using the "deploy" 
task for the manager app (and note that this can only be invoked via the 
Ant catalina manager tasks because browsers don't support HTTP PUT).  If 
you are putting a context configuration file in the webapps directory for 
deploying a .war file or a directory relative to (or inside) the webapps 
directory, then name the file anything you want.  I would recommend, 
however, that you name the file the same as you named the .war file or 
directory you are deploying.  This makes it easier to know, at a glance, 
which context configuration file is for which app.

Actually, as part of the deploy process, Tomcat looks for the 
META-INF/context.xml file inside your .war file and extracts that to a file 
named the same as the .war file, less the .war extension.

So, if you have...

myapp.war

Then META-INF/context.xml gets extracted (in the same directory where the 
.war file exists) to...

myapp.xml


Hope that clears things up.

Jake

At 04:51 PM 3/21/2003 +0000, you wrote:
>* Collins, Jim <ji...@uk.nomura.com> [0340 16:40]:
> > Hi Jake,
> >
> > Thanks for getting back so quick. So the context file in META-INF should be
> > context.xml and not myapp.xml?
> >
> > That is maybe where I have been going wrong, I read some previous posts on
> > this from Craig and I thought he said you name the context file with the
> > name of your app and a .xml extension.
>
>I've done that before now, when I've needed to add contexts without
>editing server.xml - BUT those files have gone into the webapps directory
>(where a warfile would normally go) - see manager.xml which I think is in
>webapps/ by default. This context.xml method sounds like a safer
>solution though...
>
>--
>He's the kind of man for the times that need the kind of man he is ...
>Rasputin :: Jack of All Trades - Master of Nuns
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

Re: What to set docBase attribute to in an individual Context.xml fil e

Posted by Rasputin <ra...@idoru.mine.nu>.
* Collins, Jim <ji...@uk.nomura.com> [0340 16:40]:
> Hi Jake,
> 
> Thanks for getting back so quick. So the context file in META-INF should be
> context.xml and not myapp.xml?
> 
> That is maybe where I have been going wrong, I read some previous posts on
> this from Craig and I thought he said you name the context file with the
> name of your app and a .xml extension. 

I've done that before now, when I've needed to add contexts without
editing server.xml - BUT those files have gone into the webapps directory
(where a warfile would normally go) - see manager.xml which I think is in
webapps/ by default. This context.xml method sounds like a safer
solution though...

-- 
He's the kind of man for the times that need the kind of man he is ...
Rasputin :: Jack of All Trades - Master of Nuns

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org