You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Raman <ra...@yahoo.com> on 2013/05/23 09:29:10 UTC

kar deployer

Hi,
     I have a KAR file with following
feature XML file.  I want to update existing org.ops4j.pax.logging.cfg for
my appender. While installing KAR file I don’t see org.ops4j.pax.logging.cfg is
updating. I am using Apahe Karaf 2.3.0. Anything wrong I am doing?
 
<?xml version="1.0"
encoding="UTF-8"?>
                               
<features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0"
name="Node-KAR">
                                               
<feature name="node-core">
                                                               
<bundle
start-level="30">file:system/com/ca/node/commons-io.jar</bundle>
                                                               
<bundle
start-level="30">file:system/com/ca/node/org.apache.servicemix.bundles.bcprov-jdk16.jar</bundle>                                        
                                                
                                                               
<bundle
start-level="30">file:system/com/ca/node/h2.jar</bundle>
                                                               
<bundle
start-level="40">file:system/com/ca/node/org.apache.tuscany.sdo.jar</bundle>                                                                                
                                                               
<bundle
start-level="40">file:system/com/ca/node/commons-codec-1.6.jar</bundle>
                                                               
<configfile finalname="/etc/registryconfig.properties"
override="true" >
                                                              
   file:system/etc/registryconfig.properties
              
                                      </configfile>
                                                               
<config name="org.ops4j.pax.logging">
                                                                               
log4j.logger.com.ca.registry=DEBUG,
registry                                                                     
                                                                               
log4j.appender.registry=org.apache.log4j.RollingFileAppender
                                                                               
log4j.appender.registry.layout=org.apache.log4j.PatternLayout
                                                                               
log4j.appender.registry.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS}
%p  [%t] %c{2} -%X{bundle.id}-%X{bundle.name}-%X{bundle.version} - %m. %n
                                                                               
log4j.appender.registry.file=${karaf.data}/log/registry.log
                                                                               
log4j.appender.registry.append=true
                                                                               
log4j.appender.registry.maxFileSize=10MB
                                                                               
log4j.appender.registry.maxBackupIndex=20
                                                               
</config>
                                               
</feature>
                               
</features>
                                
 
 
                                
 
Regards
Raman

Re: kar deployer

Posted by Raman <ra...@yahoo.com>.
Thank you for the confirmation.

I'll go with work around till is supported.

Regards
Raman


________________________________
 From: Achim Nierbeck <bc...@googlemail.com>
To: Raman <ra...@yahoo.com> 
Sent: Thursday, 23 May 2013 3:24 PM
Subject: Re: kar deployer
 


Hi, 

there is already an issue[1] for a similar use-case though yours is still easier to do :)

regards, Achim 

[1] - https://issues.apache.org/jira/browse/KARAF-1046



2013/5/23 Raman <ra...@yahoo.com>

while debugging I found that FeaturesServiceImpl.doInstallFeature() handles only creating new configuration. It is not handling updating existing configuration.       
>
> for (String config : feature.getConfigurations().keySet()) {
>            Dictionary<String, String> props = new Hashtable<String, String>(feature.getConfigurations().get(config));
>            String[] pid = parsePid(config);
>            Configuration cfg = findExistingConfiguration(configAdmin, pid[0], pid[1]);
>            if (cfg == null)
 {
>                cfg = createConfiguration(configAdmin, pid[0], pid[1]);
>                String key = createConfigurationKey(pid[0], pid[1]);
>                props.put(CONFIG_KEY, key);
>                if (cfg.getBundleLocation() != null) {
>                    cfg.setBundleLocation(null);
>                }
>               
 cfg.update(props);
>            }
>        }
>
>
>RegardsRaman
>
>
>
>
>________________________________
> From: Achim Nierbeck <bc...@googlemail.com>
>To: Raman <ra...@yahoo.com> 
>Sent: Thursday, 23 May 2013 1:21 PM
>Subject: Re: kar deployer
> 
>
>
>Sorry viewing your email, is kind of hard seems like fontsize 24 with google mail :D
>That's why I missinterpreted the configfile tag to be the one used for the pax logging. 
>
>
>Hmm, so you're actually adding new property entries to it and still it isn't updated. 
>might be a missing feature then, you should check if there is already a open feature request for this 
>or if it's missing. 
>Merging configurations isn't straight forward, but adding a new entry should be doable. 
>Don't know if this existed with 2.2.x since you seem to have an issue with 2.3.x
>
>
>regards, Achim 
>
>
>
>2013/5/23 Raman <ra...@yahoo.com>
>
>Thank you Achim for response.
>>
>>
>>If you see below XML snippet, I am actually using config element to update 
>>pax-logging. I don't see file getting updated with my entries. Anything wrong there? like name?
>>
>>
>>RegardsRaman
>>
>>
>>
>>
>>________________________________
>> From: Achim Nierbeck <bc...@googlemail.com>
>>To: "user@karaf.apache.org" <us...@karaf.apache.org>; Raman <ra...@yahoo.com> 
>>Sent: Thursday, 23 May 2013 1:04 PM
>>Subject: Re: kar deployer
>> 
>>
>>
>>An existing File isn't overwritten. Cause the feature only provides a file for first installation. 
>>The pax-logging config is a file which already exists. 
>>But you are able to add extra configuration to the file by adding the config element to your features.xml, as long as it doesn't overwrite existing property entries. 
>>
>>
>>Regards, Achim 
>>
>>
>>
>>2013/5/23 Raman <ra...@yahoo.com>
>>
>>Hi,
>>>     I have a KAR file with following
feature XML file.  I want to update existing org.ops4j.pax.logging.cfg for
my appender. While installing KAR file I don’t see org.ops4j.pax.logging.cfg is
updating. I am using Apahe Karaf 2.3.0. Anything wrong I am doing?
>>> 
>>><?xml version="1.0"
encoding="UTF-8"?>
>>>                               
<features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0"
name="Node-KAR">
>>>                                               
<feature name="node-core">
>>>                                                               
<bundle
start-level="30">file:system/com/ca/node/commons-io.jar</bundle>
>>>                                                               
<bundle
start-level="30">file:system/com/ca/node/org.apache.servicemix.bundles.bcprov-jdk16.jar</bundle>                                        
                                                
>>>                                                               
<bundle
start-level="30">file:system/com/ca/node/h2.jar</bundle>
>>>                                                               
<bundle
start-level="40">file:system/com/ca/node/org.apache.tuscany.sdo.jar</bundle>                                                                                
>>>                                                               
<bundle
start-level="40">file:system/com/ca/node/commons-codec-1.6.jar</bundle>
>>>                                                               
<configfile finalname="/etc/registryconfig.properties"
override="true" >
>>>                                                              
   file:system/etc/registryconfig.properties
>>>              
                                      </configfile>
>>>                                                               
<config name="org.ops4j.pax.logging">
>>>                                                                               
log4j.logger.com.ca.registry=DEBUG,
registry                                                                     
>>>                                                                               
log4j.appender.registry=org.apache.log4j.RollingFileAppender
>>>                                                                               
log4j.appender.registry.layout=org.apache.log4j.PatternLayout
>>>                                                                               
log4j.appender.registry.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS}
%p  [%t] %c{2} -%X{bundle.id}-%X{bundle.name}-%X{bundle.version} - %m. %n
>>>                                                                               
log4j.appender.registry.file=${karaf.data}/log/registry.log
>>>                                                                               
log4j.appender.registry.append=true
>>>                                                                               
log4j.appender.registry.maxFileSize=10MB
>>>                                                                               
log4j.appender.registry.maxBackupIndex=20
>>>                                                               
</config>
>>>                                               
</feature>
>>>                               
</features>
>>>                                
>>> 
>>> 
>>>                                
>>> 
>>>RegardsRaman
>>
>>
>>
>>-- 
>>
>>Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & Project Lead
>>OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home> Commiter & Project Lead
>>blog <http://notizblog.nierbeck.de/> 
>>
>>
>
>
>
>-- 
>
>Apache Karaf <http://karaf.apache.org/> Committer & PMC
>OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & Project Lead
>OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home> Commiter & Project Lead
>blog <http://notizblog.nierbeck.de/> 
>
>


-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home> Commiter & Project Lead
blog <http://notizblog.nierbeck.de/> 

Re: kar deployer

Posted by Raman <ra...@yahoo.com>.
Thank you Achim for response.

If you see below XML snippet, I am actually using config element to update 
pax-logging. I don't see file getting updated with my entries. Anything wrong there? like name?

Regards
Raman



________________________________
 From: Achim Nierbeck <bc...@googlemail.com>
To: "user@karaf.apache.org" <us...@karaf.apache.org>; Raman <ra...@yahoo.com> 
Sent: Thursday, 23 May 2013 1:04 PM
Subject: Re: kar deployer
 


An existing File isn't overwritten. Cause the feature only provides a file for first installation. 
The pax-logging config is a file which already exists. 
But you are able to add extra configuration to the file by adding the config element to your features.xml, as long as it doesn't overwrite existing property entries. 

Regards, Achim 



2013/5/23 Raman <ra...@yahoo.com>

Hi,
>     I have a KAR file with following
feature XML file.  I want to update existing org.ops4j.pax.logging.cfg for
my appender. While installing KAR file I don’t see org.ops4j.pax.logging.cfg is
updating. I am using Apahe Karaf 2.3.0. Anything wrong I am doing?
> 
><?xml version="1.0"
encoding="UTF-8"?>
>                               
<features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0"
name="Node-KAR">
>                                               
<feature name="node-core">
>                                                               
<bundle
start-level="30">file:system/com/ca/node/commons-io.jar</bundle>
>                                                               
<bundle
start-level="30">file:system/com/ca/node/org.apache.servicemix.bundles.bcprov-jdk16.jar</bundle>                                        
                                                
>                                                               
<bundle
start-level="30">file:system/com/ca/node/h2.jar</bundle>
>                                                               
<bundle
start-level="40">file:system/com/ca/node/org.apache.tuscany.sdo.jar</bundle>                                                                                
>                                                               
<bundle
start-level="40">file:system/com/ca/node/commons-codec-1.6.jar</bundle>
>                                                               
<configfile finalname="/etc/registryconfig.properties"
override="true" >
>                                                              
   file:system/etc/registryconfig.properties
>              
                                      </configfile>
>                                                               
<config name="org.ops4j.pax.logging">
>                                                                               
log4j.logger.com.ca.registry=DEBUG,
registry                                                                     
>                                                                               
log4j.appender.registry=org.apache.log4j.RollingFileAppender
>                                                                               
log4j.appender.registry.layout=org.apache.log4j.PatternLayout
>                                                                               
log4j.appender.registry.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS}
%p  [%t] %c{2} -%X{bundle.id}-%X{bundle.name}-%X{bundle.version} - %m. %n
>                                                                               
log4j.appender.registry.file=${karaf.data}/log/registry.log
>                                                                               
log4j.appender.registry.append=true
>                                                                               
log4j.appender.registry.maxFileSize=10MB
>                                                                               
log4j.appender.registry.maxBackupIndex=20
>                                                               
</config>
>                                               
</feature>
>                               
</features>
>                                
> 
> 
>                                
> 
>RegardsRaman


-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home> Commiter & Project Lead
blog <http://notizblog.nierbeck.de/> 

Re: kar deployer

Posted by Achim Nierbeck <bc...@googlemail.com>.
An existing File isn't overwritten. Cause the feature only provides a file
for first installation.
The pax-logging config is a file which already exists.
But you are able to add extra configuration to the file by adding the
config element to your features.xml, as long as it doesn't overwrite
existing property entries.

Regards, Achim


2013/5/23 Raman <ra...@yahoo.com>

> Hi,
>      I have a KAR file with following feature XML file.  I want to update
> existing org.ops4j.pax.logging.cfg for my appender. While installing KAR
> file I don’t see org.ops4j.pax.logging.cfg is updating. I am using Apahe
> Karaf 2.3.0. Anything wrong I am doing?
>
> <?xml version="1.0" encoding="UTF-8"?>
>                                 <features xmlns="
> http://karaf.apache.org/xmlns/features/v1.0.0" name="Node-KAR">
>                                                 <feature name="node-core">
>                                                                 <bundle
> start-level="30">file:system/com/ca/node/commons-io.jar</bundle>
>                                                                 <bundle
> start-level="30">file:system/com/ca/node/org.apache.servicemix.bundles.bcprov-jdk16.jar</bundle>
>
>                                                                 <bundle
> start-level="30">file:system/com/ca/node/h2.jar</bundle>
>                                                                 <bundle
> start-level="40">file:system/com/ca/node/org.apache.tuscany.sdo.jar</bundle>
>
>                                                                 <bundle
> start-level="40">file:system/com/ca/node/commons-codec-1.6.jar</bundle>
>
> <configfile finalname="/etc/registryconfig.properties" override="true" >
>
>    file:system/etc/registryconfig.properties
>                                                      </configfile>
>                                                                 <config
> name="org.ops4j.pax.logging">
>
> log4j.logger.com.ca.registry=DEBUG,
> registry
>
>
> log4j.appender.registry=org.apache.log4j.RollingFileAppender
>
> log4j.appender.registry.layout=org.apache.log4j.PatternLayout
>
> log4j.appender.registry.layout.ConversionPattern=%d{yyyy-MM-dd
> HH:mm:ss,SSS} %p  [%t] %c{2} -%X{bundle.id}-%X{bundle.name}-%X{bundle.version}
> - %m. %n
>
> log4j.appender.registry.file=${karaf.data}/log/registry.log
>
> log4j.appender.registry.append=true
>
> log4j.appender.registry.maxFileSize=10MB
>
> log4j.appender.registry.maxBackupIndex=20
>                                                                 </config>
>                                                 </feature>
>                                 </features>
>
>
>
>
>
> Regards
> Raman
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>