You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Thomas Kloeber <kl...@ics.de> on 2010/06/09 13:46:17 UTC

How to configure a web app

Dear List,

I'm a newbie to Apache and Tomcat, so pls forgive my ignorance.
I have the following problem/question:

I have a web application which needs to be configured with site-specific 
information when/after it is deployed.
What is the best/proper way of doing this?

Right now I use an install programm (install4j) which collects the info 
from the user, puts it in the proper places (web.xml, context.xml) and 
then does the deployment "manually". But this has 2 major drawbacks:

   1. if auto-deployment is enabled in server.xml the server interferes
      with my "manual" deployment
   2. if auto-deployment is disabled I have to restart Tomcat for the
      web app to become known/available.

Any ideas, suggestions are welcome.

Thomas

PS: I'm using Apache Tomcat 6.0.26 and Java 1.6.0_20-b02 (on Windows 2003)

-- 
Intelligent Communication Software Vertriebs GmbH
Firmensitz: Kistlerhof Str. 111, 81379 München
Registergericht: Amtsgericht München, HRB 88283
Geschäftsführer: Albert Fuss


Re: How to configure a web app

Posted by Thomas Kloeber <kl...@ics.de>.
Chris,

Christopher Schultz wrote on 09.06.2010 20:31:
> It's not terribly unusual to roll a client-specific WAR file for some
> reason. In what way does Tomcat "interfere" with your ability to build a
> client-specific WAR? Tomcat should not be involved in the WAR-creation
> process.
>    
ok, it looks like I expressed myself a bit vague.
Tomcat does not intefere with the WAR-creation, that is done on my 
development/production system. The user then downloads it from some 
system onto his/her web server to install it.
But what I don't want to do, is to create N different war files for each 
(potential) customer and having to administer all of these.
> To deploy the WAR, simply copy it into the right place with autoDeploy="true", or manually deploy it using the manager application
> if autoDeploy="false".
>    
the problem I mentioned with Tomcat intereferring is only related to the 
deployment.
When the customer puts my WAR-file onto his/her machine, Tomcat's 
auto-deployment automatically unpacks it and puts it in the appr. 
places. But then I have no chance of getting the site-specific 
parameters into the appr files.
> What does install4j do that won't let you perform the above steps?
>    
install4j allows me to put up masks where the customer can enter the 
specific information and then I can replace some place-holders in my 
files with this information before the files are moved to the appr. 
places. But if Tomcat cuts in, while the user runs my installation 
program, the "unconfigured" files are deployed.

How can I "manually deploy [my app] using the manager application"?

My idea would be to include some config programm/script into my WAR-file 
which Tomcat recognizes and starts automatically, after deploying my 
stuff. Then I would be able to ask the user for the site-specific 
information and set up my app's files with that information.

-- 
Intelligent Communication Software Vertriebs GmbH
Firmensitz: Kistlerhof Str. 111, 81379 München
Registergericht: Amtsgericht München, HRB 88283
Geschäftsführer: Albert Fuss



Re: How to configure a web app

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thomas,

On 6/9/2010 9:36 AM, Thomas Kloeber wrote:
> André Warnier wrote on 09.06.2010 15:20:
>> Inthink you should have a look at the Manager application (delivered
>> along with Tomcat when downloading from the main Tomcat site).
>> The Manager allows you to deploy, undelploy, start and stop one
>> application, without stopping/restarting Tomcat as a whole.
>> Since it is open-source, you can have a look at how it does that, and
>> do the same.  Or just look at how the form works, and call the Manager
>> the same way.
> that's exactly what I did already, but I couldn't find/understand
> what/where/how it does it.
> 
> Is this such an unusal thing that one has to configure webapp files with
> site specific information?
> How do people do it?
> Does Apache/Tomcat support it in any way?

Let's go back to the beginning.

It's not terribly unusual to roll a client-specific WAR file for some
reason. In what way does Tomcat "interfere" with your ability to build a
client-specific WAR? Tomcat should not be involved in the WAR-creation
process.

To deploy the WAR, simply copy it into the right place with
autoDeploy="true", or manually deploy it using the manager application
if autoDeploy="false".

What does install4j do that won't let you perform the above steps?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwP3goACgkQ9CaO5/Lv0PBdoACgwmVBVCalnvbNaGlX35YW+UUZ
ca0AniOLYgeId3e2a2ClmIqGzB8sdPx0
=CPK3
-----END PGP SIGNATURE-----

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


Re: How to configure a web app

Posted by Thomas Kloeber <kl...@ics.de>.
David kerber wrote on 09.06.2010 16:32:
> On 6/9/2010 10:19 AM, Thomas Kloeber wrote:
>>     * the IP address of the backing database is one of the parameters
>>       that needs to be configured (in context.xml), so I can't get any
>>       data from the db unless it is configured...
>>     * the other confgurables (SPNEGO and kerberos stuff) are in web.xml
>>       and as long as they are not set up correct, my app won't start!
>>     * sounds like a catch 22 to me ...
>
> Does that stuff HAVE to be in context.xml and web.xml, or could you 
> put them in an external file, and just have your tomcat config files 
> point to that external file?  Or even do as I do, and put it in the 
> service startup:  -DextConfigFile=/path/to/configfile.properties
dunno :)
The SPNEGO and kerberos stuff are part of a filter that is defined in 
web.xml and the IP address in context.xml is something some servlet gets 
via context lookup. For the latter I was told that this is the way to do 
it. For the other stuff it is a copy'n paste thing and  I'm just glad it 
works as it does...

-- 
Intelligent Communication Software Vertriebs GmbH
Firmensitz: Kistlerhof Str. 111, 81379 München
Registergericht: Amtsgericht München, HRB 88283
Geschäftsführer: Albert Fuss



Re: How to configure a web app

Posted by David kerber <dc...@verizon.net>.
On 6/9/2010 10:19 AM, Thomas Kloeber wrote:

...

>
>     * the IP address of the backing database is one of the parameters
>       that needs to be configured (in context.xml), so I can't get any
>       data from the db unless it is configured...
>     * the other confgurables (SPNEGO and kerberos stuff) are in web.xml
>       and as long as they are not set up correct, my app won't start!
>     * sounds like a catch 22 to me ...

Does that stuff HAVE to be in context.xml and web.xml, or could you put 
them in an external file, and just have your tomcat config files point 
to that external file?  Or even do as I do, and put it in the service 
startup:  -DextConfigFile=/path/to/configfile.properties

D

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


RE: How to configure a web app

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Thomas Kloeber [mailto:kloeber@ics.de]
> Subject: Re: How to configure a web app
> 
> how do you "make changes in context.xml inside archive"?

Unpack it with the jar utility, update, repack.  Alternatively, you can supply the <Context> element in a separate file, and have the admin put that in conf/Catalina/[host]/[appName].xml after modifying the site-specific attributes.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


Re: How to configure a web app

Posted by Thomas Kloeber <kl...@ics.de>.
Ognjen Blagojevic wrote on 09.06.2010 16:46:
> I pack different war files for several clients. They only differ in 
> context.xml and log4j.properties files. My packaging tool (Maven) take 
> care of this.
that is something I actually want to avoid, it seems a terrible overhead 
(depending on the number of customers of course).
> If I don't know some of the parameters (i.e. DB password), I leave 
> that field empty and instruct Tomcat administor to make changes in 
> context.xml inside archive before deployment.
how do you "make changes in context.xml inside archive"?

-- 
Intelligent Communication Software Vertriebs GmbH
Firmensitz: Kistlerhof Str. 111, 81379 München
Registergericht: Amtsgericht München, HRB 88283
Geschäftsführer: Albert Fuss



Re: How to configure a web app

Posted by Ognjen Blagojevic <og...@gmail.com>.
On 9.6.2010 16:19, Thomas Kloeber wrote:
>     * the IP address of the backing database is one of the parameters
>       that needs to be configured (in context.xml), so I can't get any
>       data from the db unless it is configured...
>     * the other confgurables (SPNEGO and kerberos stuff) are in web.xml
>       and as long as they are not set up correct, my app won't start!
>     * sounds like a catch 22 to me ...

I pack different war files for several clients. They only differ in 
context.xml and log4j.properties files. My packaging tool (Maven) take 
care of this.

Context.xml file contains customer-specific settings (database 
parameters, and application parameters) - check Resource, Realm and 
Parameter tags. Parameter tag eliminates the need to make changes in 
web.xml.

If I don't know some of the parameters (i.e. DB password), I leave that 
field empty and instruct Tomcat administor to make changes in 
context.xml inside archive before deployment.

I keep fine-grain settins in the database.

-Ognjen

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


Re: How to configure a web app

Posted by Pid <pi...@pidster.com>.
On 10/06/2010 16:43, André Warnier wrote:
> 
> If at the same time you have a customer who insists on receiving war
> files for application updates, you're cooked, because you have to build
> a customer-specific war file every time.

This might be /tedious/, but it's not /hard/.  If it was something that
occurs frequently enough to be a problem, then I'd incorporate it into
my build system and generate multiple .war files, each in the their own
directory with whatever else you might need to send out with a release.

It's not so difficult to do that with Ant (or Maven I'd imagine).


p

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



Re: How to configure a web app

Posted by Michael Ludwig <mi...@gmx.de>.
André Warnier schrieb am 10.06.2010 um 21:52 (+0200):

> Assuming that some rogue application or filter *requires*
> site-specific parameters in web.xml, normally like so :
> 
> ...
>    <init-param>
>         <param-name>parameter1</param-name>
>         <param-value>value1</param-value>
>     </init-param>
>    <init-param>
>         <param-name>parameter2</param-name>
>         <param-value>value2</param-value>
>     </init-param>
> 
>  etc..
> 
> Does there exist *any* way to put the actual values "value1",
> "value2", etc.. in some place *outside* the web.xml file, and
> *outside* the war that would be created for this application,
> and still allow the application, on startup, to read the values
> of these parameters "from web.xml" ?

XML entity references? You can define an external general parsed entity
(EGPE) and then reference it. Doesn't have to be well-formed; it is
enough for it to be well-balanced, just like the two <init-param>
nodes you've shown above.

<!ENTITY cust-init-params
  SYSTEM "/home/cust123/web.xml.d/params.xml" >

And then reference it using "&cust-init-params;".

It requires the parser used by Tomcat to expand entities. Don't know if
it is appropriately configured by default.
-- 
Michael Ludwig

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


Re: How to configure a web app

Posted by André Warnier <aw...@ice-sa.com>.
Mark Thomas wrote:
> On 10/06/2010 20:52, André Warnier wrote:
>> Does there exist *any* way to put the actual values "value1", "value2",
>> etc.. in some place *outside* the web.xml file, and *outside* the war
>> that would be created for this application, and still allow the
>> application, on startup, to read the values of these parameters "from
>> web.xml" ?
> 
> Yes.
> 
>> And if yes, is this Tomcat-specific, or servlet-engine-generic ?
> 
> Tomcat specific.
> 
> Any xml configuration file processed by the digester (server.xml, global
> and application context.xml, global and application web,xml) can use ant
> style property replacement.
> 
> Use ${myproperty} in the xml file and in
> $CATALINA_BASE/conf/catalina.properties use:
> myproperty=realvalue
> 
> There are some restrictions on exactly how you can use this. It
> certainly works for attribute values, it may work for
> <value>${...}</value> as well - I haven't tested it or checked the code
> to see exactrly how it works.
> 
Thanks, Mark.
I will test that.
If this works, then I think that it would be an answer in line with what 
the original OP was looking for, and me too.



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


Re: How to configure a web app

Posted by Mark Thomas <ma...@apache.org>.
On 10/06/2010 20:52, André Warnier wrote:
> Does there exist *any* way to put the actual values "value1", "value2",
> etc.. in some place *outside* the web.xml file, and *outside* the war
> that would be created for this application, and still allow the
> application, on startup, to read the values of these parameters "from
> web.xml" ?

Yes.

> And if yes, is this Tomcat-specific, or servlet-engine-generic ?

Tomcat specific.

Any xml configuration file processed by the digester (server.xml, global
and application context.xml, global and application web,xml) can use ant
style property replacement.

Use ${myproperty} in the xml file and in
$CATALINA_BASE/conf/catalina.properties use:
myproperty=realvalue

There are some restrictions on exactly how you can use this. It
certainly works for attribute values, it may work for
<value>${...}</value> as well - I haven't tested it or checked the code
to see exactrly how it works.

Mark



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


Re: How to configure a web app

Posted by André Warnier <aw...@ice-sa.com>.
David kerber wrote:
> On 6/10/2010 3:52 PM, André Warnier wrote:
> 
> ...
> 
>>
>> Does there exist *any* way to put the actual values "value1", "value2",
>> etc.. in some place *outside* the web.xml file, and *outside* the war
>> that would be created for this application, and still allow the
>> application, on startup, to read the values of these parameters "from
>> web.xml" ?
> 
> How early is "on startup" for your purposes?  Will it be early enough if 
> you read them in from a servletContextListener?  That's where I pull in 
> my external properties files, and is executed pretty early in the tomcat 
> startup sequence.  Certainly before anybody can try to log into it.
> 
David,
the point here is : this is unknown, because these parameters are being 
read (in some cases) by applications or filters which we did not write 
ourselves and do not have the source of.
That is also why they *must* be "in web.xml" as opposed to somewhere 
else more practical : because the application/filter manual says that 
this is where they should be, and we cannot change that.

So we are looking for something transparent to an application/filter, 
without changing the code of that application/filter.


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


Re: How to configure a web app

Posted by David kerber <dc...@verizon.net>.
On 6/10/2010 3:52 PM, André Warnier wrote:

...

>
> Does there exist *any* way to put the actual values "value1", "value2",
> etc.. in some place *outside* the web.xml file, and *outside* the war
> that would be created for this application, and still allow the
> application, on startup, to read the values of these parameters "from
> web.xml" ?

How early is "on startup" for your purposes?  Will it be early enough if 
you read them in from a servletContextListener?  That's where I pull in 
my external properties files, and is executed pretty early in the tomcat 
startup sequence.  Certainly before anybody can try to log into it.

D

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


Re: How to configure a web app

Posted by André Warnier <aw...@ice-sa.com>.
Konstantin Kolinko wrote:
> 2010/6/10 André Warnier <aw...@ice-sa.com>:
>> Let me speak for the OP, and for others like me who do not necessarily write
>> the applications and filters which they are installing on customer systems.
>> Sometimes, you have to deal with such third-party modules, which have to be
>> used e.g. as a servlet filter in conjunction with your own application.  And
>> sometimes, these third-party modules are like they are and you cannot change
>> their code.  And sometimes, they require some site-specific parameters,
>> which they expect to be in their respective <filter> section inside the
>> application's web.xml file.
>> A typical example in my case is authentication servlet filters, which
>> require for example a domain name or a domain controller address which is
>> specific to each given customer.
>> If at the same time you have a customer who insists on receiving war files
>> for application updates, you're cooked, because you have to build a
>> customer-specific war file every time.
>>
>> One suggestion I have in the case of Tomcat - and unfortunately only in the
>> case of Tomcat - would be an extension mechanism to the web.xml file, which
>> would allow some form of "include" in the web.xml.
>> (And maybe this would not be an extension, nor a Tomcat-specific thing, if
>> XML per se already allowed such things).
>> Then one could insert in web.xml something like this :
>> ...
> 
> Servlet 3.0 defines support for "web fragments". Already implemented
> in Tomcat 7.
> 
> That allows to pack servlets + web.xml fragment + static resources or
> JSPs in a jar file to be placed in WEB-INF/lib,
>  and web.xml and resources in your war file will take precedence over
> ones in those jars, allowing you to customize it for your needs.
> 
Konstantin,
if I understand this correctly, then it still means that the fragments 
in question are inside the webapp file hierarchy, thus if you create a 
war file, these fragments are inside also.
Which leaves the same problem as I explain above, no ?

And to *pid : yes, I know it is not difficult, but it is tedious.  And 
the point is avoiding the tedious bit.  And it makes all the difference 
between posting one war file on a website, where all customers can 
download it, or creating and posting umpteen individual war files, one 
per customer, in individual download directories.

Let me phrase the question another way then.
Assuming that some rogue application or filter *requires* site-specific 
parameters in web.xml, normally like so :

...
    <init-param>
         <param-name>parameter1</param-name>
         <param-value>value1</param-value>
     </init-param>
    <init-param>
         <param-name>parameter2</param-name>
         <param-value>value2</param-value>
     </init-param>

  etc..

Does there exist *any* way to put the actual values "value1", "value2", 
etc.. in some place *outside* the web.xml file, and *outside* the war 
that would be created for this application, and still allow the 
application, on startup, to read the values of these parameters "from 
web.xml" ?
Like for example :

    <init-param>
         <param-name>parameter1</param-name>
         <param-value>${value1}</param-value>
     </init-param>
    <init-param>
         <param-name>parameter2</param-name>
         <param-value>${value2}</param-value>
     </init-param>

where "value1", "value2" would be the names of some kind of variables, 
defined elsewhere ?

And if yes, is this Tomcat-specific, or servlet-engine-generic ?
And if no, is this because the Servlet Spec explicitly forbids this, or 
is it because nobody thought about this before ?



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


Re: How to configure a web app

Posted by Konstantin Kolinko <kn...@gmail.com>.
2010/6/10 André Warnier <aw...@ice-sa.com>:
>
> Let me speak for the OP, and for others like me who do not necessarily write
> the applications and filters which they are installing on customer systems.
> Sometimes, you have to deal with such third-party modules, which have to be
> used e.g. as a servlet filter in conjunction with your own application.  And
> sometimes, these third-party modules are like they are and you cannot change
> their code.  And sometimes, they require some site-specific parameters,
> which they expect to be in their respective <filter> section inside the
> application's web.xml file.
> A typical example in my case is authentication servlet filters, which
> require for example a domain name or a domain controller address which is
> specific to each given customer.
> If at the same time you have a customer who insists on receiving war files
> for application updates, you're cooked, because you have to build a
> customer-specific war file every time.
>
> One suggestion I have in the case of Tomcat - and unfortunately only in the
> case of Tomcat - would be an extension mechanism to the web.xml file, which
> would allow some form of "include" in the web.xml.
> (And maybe this would not be an extension, nor a Tomcat-specific thing, if
> XML per se already allowed such things).
> Then one could insert in web.xml something like this :
> ...

Servlet 3.0 defines support for "web fragments". Already implemented
in Tomcat 7.

That allows to pack servlets + web.xml fragment + static resources or
JSPs in a jar file to be placed in WEB-INF/lib,
 and web.xml and resources in your war file will take precedence over
ones in those jars, allowing you to customize it for your needs.

Best regards,
Konstantin Kolinko

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


Re: How to configure a web app

Posted by André Warnier <aw...@ice-sa.com>.
Mark H. Wood wrote:
> On Wed, Jun 09, 2010 at 05:20:22PM +0200, Thomas Kloeber wrote:
>> Mark H. Wood wrote on 09.06.2010 17:03:
>>> On Wed, Jun 09, 2010 at 04:19:17PM +0200, Thomas Kloeber wrote:
>>>    
>>>> the problems I have are:
>>>>
>>>>      * the IP address of the backing database is one of the parameters
>>>>        that needs to be configured (in context.xml), so I can't get any
>>>>        data from the db unless it is configured...
>>>>      * the other confgurables (SPNEGO and kerberos stuff)  are in web.xml
>>>>        and as long as they are not set up correct, my app won't start!
>>>>      * sounds like a catch 22 to me ...
>>>>      
>>> Context parameter pointing to a properties file somewhere?  Then you
>>> can put the settings wherever you want them, and move them anytime
>>> with minimal fuss.  Install the app. outside of any appBase and use an
>>> external Context file ($CATALINA_BASE/conf/Catalina/<hostname>/<contextname>.xml)
>>>   to point to it and provide the parameter's value:
>>>
>>>    <Context docBase='/some/where/myapp'>
>>>      <Parameter name='configuration'
>>>                 value='/some/where/else/myapp.properties'
>>>                 description='where the configurables are'/>
>>>    </Context>
>>>
>>> You could just define the configurables as separate Parameters, but I
>>> would keep them separated from configuration of the servlet container
>>> (which the above is) if possible.  Tastes vary.
>>>    
>> sounds like a good idea, but what about the web.xml stuff? Can I use 
>> some redirection there as well?
> 
> I guess I don't understand why web.xml must be customized at all.
> In Tomcat, <Resource>s can be configured in a <Context>; <Environment>
> entries can be made in a <Context>; initialization parameters can
> be set in a <Context>.  Is there something else?  And Tomcat allows
> you to place the <Context> declaration outside of the app. as noted above.
> 
>> Caldarale, Charles R wrote on 09.06.2010 17:04:
>>>> how do you "make changes in context.xml inside archive"?
>>>>      
>>> Unpack it with the jar utility, update, repack.  Alternatively, you can supply the<Context>  element in a separate file, and have the admin put that in conf/Catalina/[host]/[appName].xml after modifying the site-specific attributes.
>> I was afraid you say something like that, but to me that is why to 
>> complicated/error prone...
> 
> I agree.  This always feels to me like telling someone that he can
> configure his word processor by using a binary editor on the
> executable.  Customers should never have to put their fingers inside
> the app; it should get customer-specific information from some place
> whose location is told to it at startup.
> 

Let me speak for the OP, and for others like me who do not necessarily 
write the applications and filters which they are installing on customer 
systems.
Sometimes, you have to deal with such third-party modules, which have to 
be used e.g. as a servlet filter in conjunction with your own 
application.  And sometimes, these third-party modules are like they are 
and you cannot change their code.  And sometimes, they require some 
site-specific parameters, which they expect to be in their respective 
<filter> section inside the application's web.xml file.
A typical example in my case is authentication servlet filters, which 
require for example a domain name or a domain controller address which 
is specific to each given customer.
If at the same time you have a customer who insists on receiving war 
files for application updates, you're cooked, because you have to build 
a customer-specific war file every time.

One suggestion I have in the case of Tomcat - and unfortunately only in 
the case of Tomcat - would be an extension mechanism to the web.xml 
file, which would allow some form of "include" in the web.xml.
(And maybe this would not be an extension, nor a Tomcat-specific thing, 
if XML per se already allowed such things).
Then one could insert in web.xml something like this :
...
<filter>
     <filter-name>NtlmHttpFilter</filter-name>
     <filter-class>jcifs.http.NtlmHttpFilter</filter-class>

   <!-- %%include-fragment: /some/path/local/to/customer/localparams.xml 
%% -->

...
</filter>
...

and in localparams.xml one would have e.g. :

<fragment>
     <init-param>
         <param-name>jcifs.smb.client.domain</param-name>
         <param-value>EU</param-value>
     </init-param>
</fragment>

(The above example being from some obsolete and no longer recommendable 
piece of software).

Is something like that possible ?

Because then, you could set up the localparams.xml file once for a given 
customer (and it would even be easy for them to edit it if needed), and 
supply them in the future with updated war files which would always be 
indentical for all customers, and this without having to modify the 
third-party filter code (which is not necessarily open-source).


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


Re: How to configure a web app

Posted by "Mark H. Wood" <mw...@IUPUI.Edu>.
On Wed, Jun 09, 2010 at 05:20:22PM +0200, Thomas Kloeber wrote:
> Mark H. Wood wrote on 09.06.2010 17:03:
> > On Wed, Jun 09, 2010 at 04:19:17PM +0200, Thomas Kloeber wrote:
> >    
> >> the problems I have are:
> >>
> >>      * the IP address of the backing database is one of the parameters
> >>        that needs to be configured (in context.xml), so I can't get any
> >>        data from the db unless it is configured...
> >>      * the other confgurables (SPNEGO and kerberos stuff)  are in web.xml
> >>        and as long as they are not set up correct, my app won't start!
> >>      * sounds like a catch 22 to me ...
> >>      
> > Context parameter pointing to a properties file somewhere?  Then you
> > can put the settings wherever you want them, and move them anytime
> > with minimal fuss.  Install the app. outside of any appBase and use an
> > external Context file ($CATALINA_BASE/conf/Catalina/<hostname>/<contextname>.xml)
> >   to point to it and provide the parameter's value:
> >
> >    <Context docBase='/some/where/myapp'>
> >      <Parameter name='configuration'
> >                 value='/some/where/else/myapp.properties'
> >                 description='where the configurables are'/>
> >    </Context>
> >
> > You could just define the configurables as separate Parameters, but I
> > would keep them separated from configuration of the servlet container
> > (which the above is) if possible.  Tastes vary.
> >    
> sounds like a good idea, but what about the web.xml stuff? Can I use 
> some redirection there as well?

I guess I don't understand why web.xml must be customized at all.
In Tomcat, <Resource>s can be configured in a <Context>; <Environment>
entries can be made in a <Context>; initialization parameters can
be set in a <Context>.  Is there something else?  And Tomcat allows
you to place the <Context> declaration outside of the app. as noted above.

> Caldarale, Charles R wrote on 09.06.2010 17:04:
> >> how do you "make changes in context.xml inside archive"?
> >>      
> > Unpack it with the jar utility, update, repack.  Alternatively, you can supply the<Context>  element in a separate file, and have the admin put that in conf/Catalina/[host]/[appName].xml after modifying the site-specific attributes.
> I was afraid you say something like that, but to me that is why to 
> complicated/error prone...

I agree.  This always feels to me like telling someone that he can
configure his word processor by using a binary editor on the
executable.  Customers should never have to put their fingers inside
the app; it should get customer-specific information from some place
whose location is told to it at startup.

-- 
Mark H. Wood, Lead System Programmer   mwood@IUPUI.Edu
Balance your desire for bells and whistles with the reality that only a 
little more than 2 percent of world population has broadband.
	-- Ledford and Tyler, _Google Analytics 2.0_

Re: How to configure a web app

Posted by Thomas Kloeber <kl...@ics.de>.
Mark H. Wood wrote on 09.06.2010 17:03:
> On Wed, Jun 09, 2010 at 04:19:17PM +0200, Thomas Kloeber wrote:
>    
>> the problems I have are:
>>
>>      * the IP address of the backing database is one of the parameters
>>        that needs to be configured (in context.xml), so I can't get any
>>        data from the db unless it is configured...
>>      * the other confgurables (SPNEGO and kerberos stuff)  are in web.xml
>>        and as long as they are not set up correct, my app won't start!
>>      * sounds like a catch 22 to me ...
>>      
> Context parameter pointing to a properties file somewhere?  Then you
> can put the settings wherever you want them, and move them anytime
> with minimal fuss.  Install the app. outside of any appBase and use an
> external Context file ($CATALINA_BASE/conf/Catalina/<hostname>/<contextname>.xml)
>   to point to it and provide the parameter's value:
>
>    <Context docBase='/some/where/myapp'>
>      <Parameter name='configuration'
>                 value='/some/where/else/myapp.properties'
>                 description='where the configurables are'/>
>    </Context>
>
> You could just define the configurables as separate Parameters, but I
> would keep them separated from configuration of the servlet container
> (which the above is) if possible.  Tastes vary.
>    
sounds like a good idea, but what about the web.xml stuff? Can I use 
some redirection there as well?

Caldarale, Charles R wrote on 09.06.2010 17:04:
>> how do you "make changes in context.xml inside archive"?
>>      
> Unpack it with the jar utility, update, repack.  Alternatively, you can supply the<Context>  element in a separate file, and have the admin put that in conf/Catalina/[host]/[appName].xml after modifying the site-specific attributes.
I was afraid you say something like that, but to me that is why to 
complicated/error prone...

David kerber wrote on 09.06.2010 15:45:
> Beyond 1-time initial configuration, I would say it is unusual. 
that really surprises me. And even for 1-time initial config, how would 
you deal with that? What about updates?

Do you really trust some unknown Tomcat admin to do what s/he needs to 
do correctly?
Why putting such a burden on her/him?

-- 
Intelligent Communication Software Vertriebs GmbH
Firmensitz: Kistlerhof Str. 111, 81379 München
Registergericht: Amtsgericht München, HRB 88283
Geschäftsführer: Albert Fuss



Re: How to configure a web app

Posted by "Mark H. Wood" <mw...@IUPUI.Edu>.
On Wed, Jun 09, 2010 at 04:19:17PM +0200, Thomas Kloeber wrote:
> the problems I have are:
> 
>     * the IP address of the backing database is one of the parameters
>       that needs to be configured (in context.xml), so I can't get any
>       data from the db unless it is configured...
>     * the other confgurables (SPNEGO and kerberos stuff)  are in web.xml
>       and as long as they are not set up correct, my app won't start!
>     * sounds like a catch 22 to me ...

Context parameter pointing to a properties file somewhere?  Then you
can put the settings wherever you want them, and move them anytime
with minimal fuss.  Install the app. outside of any appBase and use an
external Context file ($CATALINA_BASE/conf/Catalina/<hostname>/<contextname>.xml)
 to point to it and provide the parameter's value:

  <Context docBase='/some/where/myapp'>
    <Parameter name='configuration'
               value='/some/where/else/myapp.properties'
               description='where the configurables are'/>
  </Context>

You could just define the configurables as separate Parameters, but I
would keep them separated from configuration of the servlet container
(which the above is) if possible.  Tastes vary.

-- 
Mark H. Wood, Lead System Programmer   mwood@IUPUI.Edu
Balance your desire for bells and whistles with the reality that only a 
little more than 2 percent of world population has broadband.
	-- Ledford and Tyler, _Google Analytics 2.0_

Re: How to configure a web app

Posted by André Warnier <aw...@ice-sa.com>.
Thomas Kloeber wrote:
> David kerber wrote on 09.06.2010 15:45:
>> On 6/9/2010 9:36 AM, Thomas Kloeber wrote:
>>> Is this such an unusal thing that one has to configure webapp files with
>>> site specific information?
>> Beyond 1-time initial configuration, I would say it is unusual.
> it is a 1-time configuration, not something that needs to be done over 
> and over again.
>>> How do people do it?
>> In my case, the site-specific settings are either in the backing 
>> database or in a separate properties file, and all can be configured 
>> from within the application itself (using a separate administrative 
>> login, of course).  As part of the method that saves the settings to 
>> permanent storage, I also apply them to the application's current 
>> settings so they take effect immediately.
> the problems I have are:
> 
>    * the IP address of the backing database is one of the parameters
>      that needs to be configured (in context.xml), so I can't get any
>      data from the db unless it is configured...
>    * the other confgurables (SPNEGO and kerberos stuff)  are in web.xml
>      and as long as they are not set up correct, my app won't start!
>    * sounds like a catch 22 to me ...
> 
Yes, it is.
I have the same problem with some third-party servlet filters which need 
site-specific parameters in web.xml, and customer sysadmins who insist 
on receiving application updates as war files.
In such cases, I have to manually edit the web.xml to insert their 
site-specific data, and then repack the war file before sending it to them.
It is basically a problem of these additional modules, not of Tomcat per 
se.  The modules should have a separate file with these site-specific 
things, so that you could deliver the separate file once, and the war 
would not be site-specific.



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


Re: How to configure a web app

Posted by Thomas Kloeber <kl...@ics.de>.
David kerber wrote on 09.06.2010 15:45:
> On 6/9/2010 9:36 AM, Thomas Kloeber wrote:
>> Is this such an unusal thing that one has to configure webapp files with
>> site specific information?
> Beyond 1-time initial configuration, I would say it is unusual.
it is a 1-time configuration, not something that needs to be done over 
and over again.
>> How do people do it?
> In my case, the site-specific settings are either in the backing 
> database or in a separate properties file, and all can be configured 
> from within the application itself (using a separate administrative 
> login, of course).  As part of the method that saves the settings to 
> permanent storage, I also apply them to the application's current 
> settings so they take effect immediately.
the problems I have are:

    * the IP address of the backing database is one of the parameters
      that needs to be configured (in context.xml), so I can't get any
      data from the db unless it is configured...
    * the other confgurables (SPNEGO and kerberos stuff)  are in web.xml
      and as long as they are not set up correct, my app won't start!
    * sounds like a catch 22 to me ...

-- 
Intelligent Communication Software Vertriebs GmbH
Firmensitz: Kistlerhof Str. 111, 81379 München
Registergericht: Amtsgericht München, HRB 88283
Geschäftsführer: Albert Fuss


Re: How to configure a web app

Posted by David kerber <dc...@verizon.net>.
On 6/9/2010 9:36 AM, Thomas Kloeber wrote:
> André Warnier wrote on 09.06.2010 15:20:
>> Inthink you should have a look at the Manager application (delivered
>> along with Tomcat when downloading from the main Tomcat site).
>> The Manager allows you to deploy, undelploy, start and stop one
>> application, without stopping/restarting Tomcat as a whole.
>> Since it is open-source, you can have a look at how it does that, and
>> do the same. Or just look at how the form works, and call the Manager
>> the same way.
> that's exactly what I did already, but I couldn't find/understand
> what/where/how it does it.
>
> Is this such an unusal thing that one has to configure webapp files with
> site specific information?

Beyond 1-time initial configuration, I would say it is unusual.


> How do people do it?

In my case, the site-specific settings are either in the backing 
database or in a separate properties file, and all can be configured 
from within the application itself (using a separate administrative 
login, of course).  As part of the method that saves the settings to 
permanent storage, I also apply them to the application's current 
settings so they take effect immediately.

D

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


Re: How to configure a web app

Posted by Thomas Kloeber <kl...@ics.de>.
André Warnier wrote on 09.06.2010 15:20:
> Inthink you should have a look at the Manager application (delivered 
> along with Tomcat when downloading from the main Tomcat site).
> The Manager allows you to deploy, undelploy, start and stop one 
> application, without stopping/restarting Tomcat as a whole.
> Since it is open-source, you can have a look at how it does that, and 
> do the same.  Or just look at how the form works, and call the Manager 
> the same way.
that's exactly what I did already, but I couldn't find/understand 
what/where/how it does it.

Is this such an unusal thing that one has to configure webapp files with 
site specific information?
How do people do it?
Does Apache/Tomcat support it in any way?

-- 
Intelligent Communication Software Vertriebs GmbH
Firmensitz: Kistlerhof Str. 111, 81379 München
Registergericht: Amtsgericht München, HRB 88283
Geschäftsführer: Albert Fuss



Re: How to configure a web app

Posted by André Warnier <aw...@ice-sa.com>.
Thomas Kloeber wrote:
> Leon Rosenberg wrote on 09.06.2010 14:53:
>> http://www.configureme.org
>> it supports hot updates of the configs, if you update the configs
>> after the application has been started the configured parts will be
>> reconfigured.
>>    
> thanx for the idea. But I'm not looking for a configuration of my app 
> but for configuration of web.xml, context.xml, and such like.
> 
Inthink you should have a look at the Manager application (delivered 
along with Tomcat when downloading from the main Tomcat site).
The Manager allows you to deploy, undelploy, start and stop one 
application, without stopping/restarting Tomcat as a whole.
Since it is open-source, you can have a look at how it does that, and do 
the same.  Or just look at how the form works, and call the Manager the 
same way.

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


Re: How to configure a web app

Posted by Thomas Kloeber <kl...@ics.de>.
Leon Rosenberg wrote on 09.06.2010 14:53:
> http://www.configureme.org
> it supports hot updates of the configs, if you update the configs
> after the application has been started the configured parts will be
> reconfigured.
>    
thanx for the idea. But I'm not looking for a configuration of my app 
but for configuration of web.xml, context.xml, and such like.

-- 
Intelligent Communication Software Vertriebs GmbH
Firmensitz: Kistlerhof Str. 111, 81379 München
Registergericht: Amtsgericht München, HRB 88283
Geschäftsführer: Albert Fuss



Re: How to configure a web app

Posted by Leon Rosenberg <ro...@gmail.com>.
http://www.configureme.org
it supports hot updates of the configs, if you update the configs
after the application has been started the configured parts will be
reconfigured.

regards
Leon

On Wed, Jun 9, 2010 at 2:46 PM, Thomas Kloeber <kl...@ics.de> wrote:
> Dear List,
>
> I'm a newbie to Apache and Tomcat, so pls forgive my ignorance.
> I have the following problem/question:
>
> I have a web application which needs to be configured with site-specific
> information when/after it is deployed.
> What is the best/proper way of doing this?
>
> Right now I use an install programm (install4j) which collects the info from
> the user, puts it in the proper places (web.xml, context.xml) and then does
> the deployment "manually". But this has 2 major drawbacks:
>
> if auto-deployment is enabled in server.xml the server interferes with my
> "manual" deployment
> if auto-deployment is disabled I have to restart Tomcat for the web app to
> become known/available.
>
> Any ideas, suggestions are welcome.
>
> Thomas
>
> PS: I'm using Apache Tomcat 6.0.26 and Java 1.6.0_20-b02 (on Windows 2003)
>
> --
> Intelligent Communication Software Vertriebs GmbH
> Firmensitz: Kistlerhof Str. 111, 81379 München
> Registergericht: Amtsgericht München, HRB 88283
> Geschäftsführer: Albert Fuss
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

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


Re: How to configure a web app

Posted by Thomas Kloeber <kl...@ics.de>.
Pid wrote on 09.06.2010 14:00:
> Depends what the information you need to store is.  Maybe you can elucidate?
I need to set user and password for SPNEGO filter and the location of 
krb5.conf/login.conf in web.xml, and I need to set an IP address of a 
backend-server for one of my servlets in context.xml.

-- 
Intelligent Communication Software Vertriebs GmbH
Firmensitz: Kistlerhof Str. 111, 81379 München
Registergericht: Amtsgericht München, HRB 88283
Geschäftsführer: Albert Fuss



Re: How to configure a web app

Posted by Pid <pi...@pidster.com>.
On 09/06/2010 12:46, Thomas Kloeber wrote:
> Dear List,
> 
> I'm a newbie to Apache and Tomcat, so pls forgive my ignorance.
> I have the following problem/question:
> 
> I have a web application which needs to be configured with site-specific
> information when/after it is deployed.
> What is the best/proper way of doing this?
> 
> Right now I use an install programm (install4j) which collects the info
> from the user, puts it in the proper places (web.xml, context.xml) and
> then does the deployment "manually". But this has 2 major drawbacks:
> 
>    1. if auto-deployment is enabled in server.xml the server interferes
>       with my "manual" deployment
>    2. if auto-deployment is disabled I have to restart Tomcat for the
>       web app to become known/available.
> 
> Any ideas, suggestions are welcome.

Depends what the information you need to store is.  Maybe you can elucidate?


p

> Thomas
> 
> PS: I'm using Apache Tomcat 6.0.26 and Java 1.6.0_20-b02 (on Windows 2003)
> 
> -- 
> Intelligent Communication Software Vertriebs GmbH
> Firmensitz: Kistlerhof Str. 111, 81379 München
> Registergericht: Amtsgericht München, HRB 88283
> Geschäftsführer: Albert Fuss
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org