Re: bundle not resolved due to pax-jdbc while provisioning in karaf

2019-05-10 Thread Jean-Baptiste Onofré
See the Import-Service, that's the requirement. You have to provide a
bundle/feature with the capability.

I will provide an example to you.

Regards
JB

On 10/05/2019 09:16, Kushal Gautam wrote:
> Hi JB:
>
> here is my MANIFEST.MF file:
>
> Manifest-Version: 1.0
> Bnd-LastModified: 1557471966933
> Build-Jdk: 1.8.0_65
> Built-By: Kushal
> Bundle-Blueprint: OSGI-INF/blueprint/blueprint.xml
> Bundle-ManifestVersion: 2
> Bundle-Name: Karaf Plugin Demo
> Bundle-SymbolicName: org.apache.karaf.plugin-demo
> Bundle-Version: 1.0.0
> Created-By: Apache Maven Bundle Plugin
> Export-Package: infrastructure;uses:="org.apache.karaf.cellar.core,org
>  .osgi.service.cm
> ,services";version="1.0.0",services;version="1.0.0",u
>  tils;version="1.0.0"
> Import-Package: javax.sql,org.apache.karaf.cellar.core;version="[4.1,5
>  )",org.osgi.framework;version="[1.7,2)",org.osgi.service.blueprint;ve
>  rsion="[1.0.0,2.0.0)",org.osgi.service.cm
> ;version="[1.5,2)",services
> Import-Service: javax.sql.DataSource;multiple:=false;filter=(osgi.jndi
>  .service.name
> =dw-datasource),org.apache.karaf.cellar.core.ClusterM
>  anager;multiple:=false,org.osgi.service.cm.ConfigurationAdmin;multipl
>  e:=false
> Require-Capability: osgi.ee ;filter:="(&(osgi.ee
> =JavaSE)(version=1.6))"
> Tool: Bnd-4.2.0.201903051501
>
> Regards,
> Kushal.
>
> On Fri, May 10, 2019 at 7:28 AM Jean-Baptiste Onofré
> mailto:jeanbaptiste.ono...@gmail.com>>
> wrote:
>
> Hi,
>
> I guess your bundle contains Requirement in META-INF/MANIFEST. Did
> you check the feature providing the DataSource provides the
> Capability ?
>
> Regards
> JB
>
> On 09/05/2019 11:23, Kushal Gautam wrote:
>> yes, that's very confusing.
>>
>> As I said earlier, that I verified the existence of datasource
>> before installing the feature. Could it be because of the pooled
>> connection?
>>
>> Regards,
>> Kushal.
>>
>> On Thursday, May 9, 2019 at 11:06:50 AM UTC+2, Jean-Baptiste
>> Onofré wrote:
>>
>> Hi,
>>
>> Ok, that's weird, it means that your bundle is starting
>> before the DataSource service is available for sure.
>>
>> Regards
>> JB
>>
>> On 09/05/2019 10:56, Kushal Gautam wrote:
>>> Hi JB:
>>>
>>> just to confirm that availability="optional" in the service
>>> reference did the trick. Also, one of the crazy issues was
>>> the caching, which loaded the same old jar again and again
>>> (even though I had refreshed and replaced the jar). I did
>>> try with feature:repo-refresh and tried reboot as well. But,
>>> the issue with caching persisted. I had to try in a whole
>>> new container.
>>>
>>> Thank you for your help. Finally, I have a workaround to
>>> this issue.
>>>
>>> Regards,
>>> Kushal.
>>>
>>> On Thu, May 9, 2019 at 8:07 AM Jean-Baptiste Onofré
>>>  wrote:
>>>
>>> By the way, did you check you don't have a race
>>> condition like you start the bundle (installing the
>>> feature) whereas the datasource service is not yet there ?
>>>
>>> As workaround you can define the service ref as
>>> optional, it will reload once the service is there.
>>>
>>> Regards
>>> JB
>>>
>>> On 08/05/2019 23:00, Kushal Gautam wrote:
 Hi:

 I have a bundle that depends on two different data
 sources; and broker as well. 

 The bundle starts properly if I copy the osgi bundle
 into deploy folder or install it using bundle:install
 . Installing the bundle this way works
 perfectly fine without any glitch.

 Instead, I tried to install it as a feature as:

 |
 >>> MBEAN"version="1.0.0">
         file:D:/temp/stats-mbean-1.0.0.jar
 
 |


 I have created the datasources from
 "etc/org.ops4j.datasource-*.cfg" config files.

 I have included the feature, and when I try to install
 the feature, I get the following error.

 |
 [caused by:Unableto resolve stats-mbean/1.0.0:missing
 requirement
 
 [stats-mbean/1.0.0]osgi.service;effective:=active;filter:="(&(objectClass=javax.sql.DataSource)(osgi.jndi.service.name
 =dw-datasource))"]]


 |


 I have referenced the datasource in my bundle's
 blueprint as:

 |
 
 >>> 

Re: bundle not resolved due to pax-jdbc while provisioning in karaf

2019-05-10 Thread Kushal Gautam
Hi:

Thank you for the tip.

well, setting serviceRequirements=disable actually worked. Although I had
to restart the instance after updating the configuration.

Is this a recommended and safe approach for a production system?

Regards,
Kushal.

On Thu, May 9, 2019 at 10:45 PM Christian Schneider 
wrote:

> I dont think this is a race condition.
>
> Is it possible that your bundle has a requirement for the service and that
> pax-jdbc does not provide a suitable capability.
> (As pax-jdbc creates the DataSources from config there is no way how it
> could provide the capability).
>
> The reason why it might work with optional is that then there is no
> mandatory requirement.
>
> Does it help when you set
> serviceRequirements=default
> in the file org.apache.karaf.features.cfg ?
>
> Christian
>
> Am Mi., 8. Mai 2019 um 23:00 Uhr schrieb Kushal Gautam <
> kushal.gau...@gmail.com>:
>
>> Hi:
>>
>> I have a bundle that depends on two different data sources; and broker as
>> well.
>>
>> The bundle starts properly if I copy the osgi bundle into deploy folder
>> or install it using bundle:install . Installing the bundle this
>> way works perfectly fine without any glitch.
>>
>> Instead, I tried to install it as a feature as:
>>
>> 
>> file:D:/temp/stats-mbean-1.0.0.jar
>> 
>>
>>
>> I have created the datasources from "etc/org.ops4j.datasource-*.cfg"
>> config files.
>>
>> I have included the feature, and when I try to install the feature, I get
>> the following error.
>>
>> [caused by: Unable to resolve stats-mbean/1.0.0: missing requirement [
>> stats-mbean/1.0.0] osgi.service; effective:=active; filter:=
>> "(&(objectClass=javax.sql.DataSource)(osgi.jndi.service.name
>> =dw-datasource))"]]
>>
>>
>>
>>
>> I have referenced the datasource in my bundle's blueprint as:
>>
>> 
>>
>>
>>
>> I have tried several stuffs, but I am unable to resolve this issue.
>> Strange thing is, I am able to start the same bundle if I install it
>> manually (copy to deploy folder or bundle:install)..
>>
>> I am not entirely sure if this is an issue of pax-jdbc. If so, do I need
>> to handle such cases specifically in the bundle pom or feature
>> configuration?
>>
>> Any insights on this would be very helpful.
>>
>> Regards,
>> Kushal.
>>
>> --
>> --
>> --
>> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "OPS4J" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ops4j+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ops4j/9af972cd-1d8d-42ec-9506-889d417e6c5c%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Computer Scientist
> http://www.adobe.com
>
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ops4j+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ops4j/CAH6_LNnsG4DM7Ux5gJE%3DA8cSu0XN%3DQS6wCSyK-fUi77hQi4%2BnQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/CAGv3bDfMpPyGXaiBt%2BzFOjCeqfJH1MJWq%3D-4Lu5w3cj0_%2BsBsw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: bundle not resolved due to pax-jdbc while provisioning in karaf

2019-05-10 Thread Christian Schneider
Oh ..sorry .. I meant
serviceRequirements=disable

Christian

Am Do., 9. Mai 2019 um 22:45 Uhr schrieb Christian Schneider <
ch...@die-schneider.net>:

> I dont think this is a race condition.
>
> Is it possible that your bundle has a requirement for the service and that
> pax-jdbc does not provide a suitable capability.
> (As pax-jdbc creates the DataSources from config there is no way how it
> could provide the capability).
>
> The reason why it might work with optional is that then there is no
> mandatory requirement.
>
> Does it help when you set
> serviceRequirements=default
> in the file org.apache.karaf.features.cfg ?
>
> Christian
>
> Am Mi., 8. Mai 2019 um 23:00 Uhr schrieb Kushal Gautam <
> kushal.gau...@gmail.com>:
>
>> Hi:
>>
>> I have a bundle that depends on two different data sources; and broker as
>> well.
>>
>> The bundle starts properly if I copy the osgi bundle into deploy folder
>> or install it using bundle:install . Installing the bundle this
>> way works perfectly fine without any glitch.
>>
>> Instead, I tried to install it as a feature as:
>>
>> 
>> file:D:/temp/stats-mbean-1.0.0.jar
>> 
>>
>>
>> I have created the datasources from "etc/org.ops4j.datasource-*.cfg"
>> config files.
>>
>> I have included the feature, and when I try to install the feature, I get
>> the following error.
>>
>> [caused by: Unable to resolve stats-mbean/1.0.0: missing requirement [
>> stats-mbean/1.0.0] osgi.service; effective:=active; filter:=
>> "(&(objectClass=javax.sql.DataSource)(osgi.jndi.service.name
>> =dw-datasource))"]]
>>
>>
>>
>>
>> I have referenced the datasource in my bundle's blueprint as:
>>
>> 
>>
>>
>>
>> I have tried several stuffs, but I am unable to resolve this issue.
>> Strange thing is, I am able to start the same bundle if I install it
>> manually (copy to deploy folder or bundle:install)..
>>
>> I am not entirely sure if this is an issue of pax-jdbc. If so, do I need
>> to handle such cases specifically in the bundle pom or feature
>> configuration?
>>
>> Any insights on this would be very helpful.
>>
>> Regards,
>> Kushal.
>>
>> --
>> --
>> --
>> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "OPS4J" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ops4j+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ops4j/9af972cd-1d8d-42ec-9506-889d417e6c5c%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Computer Scientist
> http://www.adobe.com
>
>

-- 
-- 
Christian Schneider
http://www.liquid-reality.de

Computer Scientist
http://www.adobe.com

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/CAH6_LNmO6of4cJ87GcbeccJGWhf7wUCSnwCjxvo2AQ6xjN%3DHLA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.