You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Johannes Hoechstaedter <j....@memocomp.de> on 2008/07/03 12:06:04 UTC

How to access configuration files and properties after packaging

Hi everybody,

in my cocoon block I have some configuration files in the 
resource/external directory, which I want to be accessible by the admin 
of the application even when I compiled the block, and put it as webapp 
into my Tomcat. Till now these files are packed correctly into the block 
jar but because of this they aren't really accessible for quick changes.

I have the same problem with my property file in META-INF/cocoon/properties.

All of this configuration files should be placed into 
webapps/webapp/WEB_INF/classes

Any solutions?

Thank you
Johannes


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


Re: How to access configuration files and properties after packaging

Posted by Johannes Hoechstaedter <j....@memocomp.de>.
Your right. I don't want to configure important properties during 
runtime. My aim is an application which is easy configurable by the 
sysadmin without the need for compilation.
For example when the system is down some properties or some some 
resources (table decriptors for example) should be changeble, by the 
admin, who has no maven installed or the knowledge abaout zip and jar 
files, which are buried deep into the system.

Robin Rigby schrieb:
> ok.  Depends what the config does.  In my case, there would be an ugly crash
> before any damage could be done.
>
> btw.  I think that should have been
>  
> \src\main\resources\META-INF\cocoon\properties\config.properties
> \src\main\resources\META-INF\cocoon\properties\dev\config.properties 
>
> Robin
>  
>
> -----Original Message-----
> From: Robin Rigby [mailto:robin@gondolier.org.uk] 
> Sent: 03 July 2008 12:23
> To: users@cocoon.apache.org
> Subject: RE: How to access configuration files and properties after
> packaging
>
> Here is one way that seems to work.  Make a separate set of configuration
> for development and the default for production.
>
> \src\main\resources\META-INF\cocoon\properties\config.properties
> \src\main\resources\META-INF\cocoon\dev\properties\config.properties 
>
> and run during development with
>
> mvn -Dorg.apache.cocoon.mode=dev jetty:run
>
> It is documented somewhere _if_ you can find it.  I suppose the same would
> work in Tomcat, ect.
>
> --------
>
> But this has not solved all my problems.  I tried it with log4j.properties.
> It works fine, provided the application is packaged in a .war file and run
> from there.  But in that case, there is no rcl.
>
> To have rcl, I run the block directly but then I don't know how to configure
> log4j.  
>
> I have the same problem with sdocbook - entity catalog resolution.  It works
> from the war file, not from the block itself.
>
> Is there an easy way to configure these?
>
> Thanks
>
>  
> Robin
>  
>
> -----Original Message-----
> From: Johannes Hoechstaedter [mailto:j.hoechstaedter@memocomp.de] 
> Sent: 03 July 2008 11:06
> To: users@cocoon.apache.org
> Subject: How to access configuration files and properties after packaging
>
> Hi everybody,
>
> in my cocoon block I have some configuration files in the 
> resource/external directory, which I want to be accessible by the admin 
> of the application even when I compiled the block, and put it as webapp 
> into my Tomcat. Till now these files are packed correctly into the block 
> jar but because of this they aren't really accessible for quick changes.
>
> I have the same problem with my property file in META-INF/cocoon/properties.
>
> All of this configuration files should be placed into 
> webapps/webapp/WEB_INF/classes
>
> Any solutions?
>
> Thank you
> Johannes
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>   

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


RE: How to access configuration files and properties after packaging

Posted by Robin Rigby <ro...@gondolier.org.uk>.
ok.  Depends what the config does.  In my case, there would be an ugly crash
before any damage could be done.

btw.  I think that should have been
 
\src\main\resources\META-INF\cocoon\properties\config.properties
\src\main\resources\META-INF\cocoon\properties\dev\config.properties 

Robin
 

-----Original Message-----
From: Robin Rigby [mailto:robin@gondolier.org.uk] 
Sent: 03 July 2008 12:23
To: users@cocoon.apache.org
Subject: RE: How to access configuration files and properties after
packaging

Here is one way that seems to work.  Make a separate set of configuration
for development and the default for production.

\src\main\resources\META-INF\cocoon\properties\config.properties
\src\main\resources\META-INF\cocoon\dev\properties\config.properties 

and run during development with

mvn -Dorg.apache.cocoon.mode=dev jetty:run

It is documented somewhere _if_ you can find it.  I suppose the same would
work in Tomcat, ect.

--------

But this has not solved all my problems.  I tried it with log4j.properties.
It works fine, provided the application is packaged in a .war file and run
from there.  But in that case, there is no rcl.

To have rcl, I run the block directly but then I don't know how to configure
log4j.  

I have the same problem with sdocbook - entity catalog resolution.  It works
from the war file, not from the block itself.

Is there an easy way to configure these?

Thanks

 
Robin
 

-----Original Message-----
From: Johannes Hoechstaedter [mailto:j.hoechstaedter@memocomp.de] 
Sent: 03 July 2008 11:06
To: users@cocoon.apache.org
Subject: How to access configuration files and properties after packaging

Hi everybody,

in my cocoon block I have some configuration files in the 
resource/external directory, which I want to be accessible by the admin 
of the application even when I compiled the block, and put it as webapp 
into my Tomcat. Till now these files are packed correctly into the block 
jar but because of this they aren't really accessible for quick changes.

I have the same problem with my property file in META-INF/cocoon/properties.

All of this configuration files should be placed into 
webapps/webapp/WEB_INF/classes

Any solutions?

Thank you
Johannes


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




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




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


Re: How to access configuration files and properties after packaging

Posted by Andy Stevens <in...@googlemail.com>.
2008/7/3 Robin Rigby <ro...@gondolier.org.uk>:
> Here is one way that seems to work.  Make a separate set of configuration
> for development and the default for production.
>
> \src\main\resources\META-INF\cocoon\properties\config.properties
> \src\main\resources\META-INF\cocoon\dev\properties\config.properties
>
> and run during development with
>
> mvn -Dorg.apache.cocoon.mode=dev jetty:run

Safer, surely, to make development the default and configure the
production server with the system property?  Otherwise a developer who
forgets the -D when testing out some code changes could completely
mess up your live data...


Andy.
-- 
http://pseudoq.sourceforge.net/  Open source java Sudoku application

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


Re: How to access configuration files and properties after packaging

Posted by Johannes Hoechstaedter <j....@memocomp.de>.
Hi,

that mechanism with the property file works. Thumbsup :) For a strange 
reason I have the porty file in my jar file and in the expected folder, 
although I have deleted it from my block.

My second question is still, how I can access some folders outside of my 
jar by the pointed out 

<map:pipeline id="non-war-resource">
    <map:match pattern="resource/nonwar/**">
        <map:read src="{path.to.non.war.resources}/{1}" />

I got a little bit confused about the protocol. Whats context://, 
resource://, ... do I need this?

Barbara Slupik schrieb:
> I use properties to define my database connection. I my development 
> environment I add my properties into block rcl.properties and I can 
> test blocks individually with jetty. rcl.properties file is not 
> included in block jar file. In my application I created 
> cocoon/properties/application.properties file in 
> src/main/webapp/WEB-INF. This file contains all properties from all 
> application blocks. When my application runs in tomcat I have 
> cocoon/properties/application.properties in my WEB-INF and I can edit 
> it without changing jar files.
>
> Barbara
>
> On 3 Jul, 2008, at 1:04 pm, Johannes Hoechstaedter wrote:
>
>> How can I access the web-inf folder?
>>
>> Robin Rigby schrieb:
>>> Try a third set of resources, that are not packaged in the war file, in
>>> addition to internal and external.  The path to them can be 
>>> configured as I
>>> described.  The sitemap does something like:
>>> <map:pipeline id="non-war-resource">
>>>     <map:match pattern="resource/nonwar/**">
>>>         <map:read src="{path.to.non.war.resources}/{1}" />
>>>     etc
>>>  Robin
>>>
>>> -----Original Message-----
>>> From: Johannes Hoechstaedter [mailto:j.hoechstaedter@memocomp.de] 
>>> Sent: 03 July 2008 12:45
>>> To: users@cocoon.apache.org
>>> Subject: Re: How to access configuration files and properties after
>>> packaging
>>>
>>>
>>> Robin Rigby schrieb:
>>>
>>>> Here is one way that seems to work.  Make a separate set of 
>>>> configuration
>>>> for development and the default for production.
>>>>
>>>> \src\main\resources\META-INF\cocoon\properties\config.properties
>>>> \src\main\resources\META-INF\cocoon\dev\properties\config.properties
>>>> and run during development with
>>>>
>>>> mvn -Dorg.apache.cocoon.mode=dev jetty:run
>>>>
>>>> It is documented somewhere _if_ you can find it.  I suppose the 
>>>> same would
>>>> work in Tomcat, ect
>>>>
>>>
>>> Thank you for your answer Robin, but your configuration files are 
>>> still packaged in in the jar file, or? Thats what I want to pretend.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>

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


Re: How to access configuration files and properties after packaging

Posted by Barbara Slupik <ba...@ntlworld.com>.
I use properties to define my database connection. I my development  
environment I add my properties into block rcl.properties and I can  
test blocks individually with jetty. rcl.properties file is not  
included in block jar file. In my application I created cocoon/ 
properties/application.properties file in src/main/webapp/WEB-INF.  
This file contains all properties from all application blocks. When  
my application runs in tomcat I have cocoon/properties/ 
application.properties in my WEB-INF and I can edit it without  
changing jar files.

Barbara

On 3 Jul, 2008, at 1:04 pm, Johannes Hoechstaedter wrote:

> How can I access the web-inf folder?
>
> Robin Rigby schrieb:
>> Try a third set of resources, that are not packaged in the war  
>> file, in
>> addition to internal and external.  The path to them can be  
>> configured as I
>> described.  The sitemap does something like:
>> <map:pipeline id="non-war-resource">
>> 	<map:match pattern="resource/nonwar/**">
>> 		<map:read src="{path.to.non.war.resources}/{1}" />
>> 	etc
>>  Robin
>>
>> -----Original Message-----
>> From: Johannes Hoechstaedter [mailto:j.hoechstaedter@memocomp.de]  
>> Sent: 03 July 2008 12:45
>> To: users@cocoon.apache.org
>> Subject: Re: How to access configuration files and properties after
>> packaging
>>
>>
>> Robin Rigby schrieb:
>>
>>> Here is one way that seems to work.  Make a separate set of  
>>> configuration
>>> for development and the default for production.
>>>
>>> \src\main\resources\META-INF\cocoon\properties\config.properties
>>> \src\main\resources\META-INF\cocoon\dev\properties\config.properties
>>> and run during development with
>>>
>>> mvn -Dorg.apache.cocoon.mode=dev jetty:run
>>>
>>> It is documented somewhere _if_ you can find it.  I suppose the  
>>> same would
>>> work in Tomcat, ect
>>>
>>
>> Thank you for your answer Robin, but your configuration files are  
>> still packaged in in the jar file, or? Thats what I want to pretend.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


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


Re: How to access configuration files and properties after packaging

Posted by Johannes Hoechstaedter <j....@memocomp.de>.
How can I access the web-inf folder?

Robin Rigby schrieb:
> Try a third set of resources, that are not packaged in the war file, in
> addition to internal and external.  The path to them can be configured as I
> described.  The sitemap does something like: 
>
> <map:pipeline id="non-war-resource">
> 	<map:match pattern="resource/nonwar/**">
> 		<map:read src="{path.to.non.war.resources}/{1}" />
> 	etc
>  
> Robin
>  
>
> -----Original Message-----
> From: Johannes Hoechstaedter [mailto:j.hoechstaedter@memocomp.de] 
> Sent: 03 July 2008 12:45
> To: users@cocoon.apache.org
> Subject: Re: How to access configuration files and properties after
> packaging
>
>
> Robin Rigby schrieb:
>   
>> Here is one way that seems to work.  Make a separate set of configuration
>> for development and the default for production.
>>
>> \src\main\resources\META-INF\cocoon\properties\config.properties
>> \src\main\resources\META-INF\cocoon\dev\properties\config.properties 
>>
>> and run during development with
>>
>> mvn -Dorg.apache.cocoon.mode=dev jetty:run
>>
>> It is documented somewhere _if_ you can find it.  I suppose the same would
>> work in Tomcat, ect
>>     
>
> Thank you for your answer Robin, but your configuration files are still 
> packaged in in the jar file, or? Thats what I want to pretend.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>   

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


RE: How to access configuration files and properties after packaging

Posted by Robin Rigby <ro...@gondolier.org.uk>.
Try a third set of resources, that are not packaged in the war file, in
addition to internal and external.  The path to them can be configured as I
described.  The sitemap does something like: 

<map:pipeline id="non-war-resource">
	<map:match pattern="resource/nonwar/**">
		<map:read src="{path.to.non.war.resources}/{1}" />
	etc
 
Robin
 

-----Original Message-----
From: Johannes Hoechstaedter [mailto:j.hoechstaedter@memocomp.de] 
Sent: 03 July 2008 12:45
To: users@cocoon.apache.org
Subject: Re: How to access configuration files and properties after
packaging


Robin Rigby schrieb:
> Here is one way that seems to work.  Make a separate set of configuration
> for development and the default for production.
>
> \src\main\resources\META-INF\cocoon\properties\config.properties
> \src\main\resources\META-INF\cocoon\dev\properties\config.properties 
>
> and run during development with
>
> mvn -Dorg.apache.cocoon.mode=dev jetty:run
>
> It is documented somewhere _if_ you can find it.  I suppose the same would
> work in Tomcat, ect

Thank you for your answer Robin, but your configuration files are still 
packaged in in the jar file, or? Thats what I want to pretend.

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




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


Re: How to access configuration files and properties after packaging

Posted by Johannes Hoechstaedter <j....@memocomp.de>.
Robin Rigby schrieb:
> Here is one way that seems to work.  Make a separate set of configuration
> for development and the default for production.
>
> \src\main\resources\META-INF\cocoon\properties\config.properties
> \src\main\resources\META-INF\cocoon\dev\properties\config.properties 
>
> and run during development with
>
> mvn -Dorg.apache.cocoon.mode=dev jetty:run
>
> It is documented somewhere _if_ you can find it.  I suppose the same would
> work in Tomcat, ect

Thank you for your answer Robin, but your configuration files are still 
packaged in in the jar file, or? Thats what I want to pretend.

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


RE: How to access configuration files and properties after packaging

Posted by Robin Rigby <ro...@gondolier.org.uk>.
Here is one way that seems to work.  Make a separate set of configuration
for development and the default for production.

\src\main\resources\META-INF\cocoon\properties\config.properties
\src\main\resources\META-INF\cocoon\dev\properties\config.properties 

and run during development with

mvn -Dorg.apache.cocoon.mode=dev jetty:run

It is documented somewhere _if_ you can find it.  I suppose the same would
work in Tomcat, ect.

--------

But this has not solved all my problems.  I tried it with log4j.properties.
It works fine, provided the application is packaged in a .war file and run
from there.  But in that case, there is no rcl.

To have rcl, I run the block directly but then I don't know how to configure
log4j.  

I have the same problem with sdocbook - entity catalog resolution.  It works
from the war file, not from the block itself.

Is there an easy way to configure these?

Thanks

 
Robin
 

-----Original Message-----
From: Johannes Hoechstaedter [mailto:j.hoechstaedter@memocomp.de] 
Sent: 03 July 2008 11:06
To: users@cocoon.apache.org
Subject: How to access configuration files and properties after packaging

Hi everybody,

in my cocoon block I have some configuration files in the 
resource/external directory, which I want to be accessible by the admin 
of the application even when I compiled the block, and put it as webapp 
into my Tomcat. Till now these files are packed correctly into the block 
jar but because of this they aren't really accessible for quick changes.

I have the same problem with my property file in META-INF/cocoon/properties.

All of this configuration files should be placed into 
webapps/webapp/WEB_INF/classes

Any solutions?

Thank you
Johannes


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




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