You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Arun Manivannan <ar...@arunma.com> on 2014/03/26 13:07:52 UTC
Waiting for dependent bundle
This is a little embarrassing considering I have been meddling around with Karaf for a while now.
I have a service implementation bundle and a CXF-REST bundle. If I throw in the REST bundle before the ServiceImpl bundle into my deploy folder, it waits for the service bundle for a few seconds and then goes into a Failed state. Obviously, all goes well if I do it in sequence - ServiceImpl first and REST next. I wanted my REST service to wait forever until the ServiceImpl is deployed (just like the rest of the OSGi bundles)
My guess is that there is some place where I should be increasing the timeout to wait forever. This guess is based on the fact that for a PaxExam test, I should do so.
@Inject
@Filter(timeout = 300000)
BootFinished bootFinished;
(source : KarafTestSupport.java)
Am I looking at the wrong place or should I be looking at other places for hints like Activator or Import/Export packages?
My REST maven-bundle-plugin looks like this :
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Activator>xxxx.xxx
.rest.Activator</Bundle-Activator>
<Import-Package>*</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
I understand that deploying as a .kar file along with the the rest of the libraries (I deploy the dependencies as a .kar) would solve it but I do not want to do that for the REST and Impl bundles because of faster deployments (and bandwidth sizes - I am on EC2).
Cheers,
Arun Manivannan
Re: Waiting for dependent bundle
Posted by Arun Manivannan <ar...@arunma.com>.
That’s the one. Thanks a ton !!
Earlier I didn’t have any timeout mentioned in the bean references.
<reference id=“xxxServiceBean"
interface="com.nutraspace.coreservices.search.service.impl.base.NewsSearchService">
</reference>
Now that I have set it to 10 minutes, it works great. Tested and verified.
<reference timeout="600000" id=“xxxServiceBean"
interface="com.nutraspace.coreservices.search.service.impl.base.NewsSearchService">
</reference>
Thanks again,
Arun Manivannan
On March 27, 2014 at 4:08:40 PM, Freeman Fang (freeman.fang@gmail.com) wrote:
Hi,
From the blueprint fragment I can't see how you refer the OSGi service from another bundle.
IIRC, you can specify timeout="…" when you refer an OSGi service, something like
<reference timeout="">
</reference>
-------------
Freeman(Yue) Fang
Red Hat, Inc.
FuseSource is now part of Red Hat
On 2014-3-27, at 下午3:58, Arun Manivannan wrote:
Thanks for the note Freeman. Here is the relevant tags from the REST blueprint xml
<jaxrs:server address="/coreservices" id="rsServer">
<jaxrs:inInterceptors>
<ref component-id="logInbound"/>
</jaxrs:inInterceptors>
<jaxrs:serviceBeans>
<ref component-id="searchRestServiceImpl" />
</jaxrs:serviceBeans>
<jaxrs:outInterceptors>
<ref component-id="logOutbound"/>
</jaxrs:outInterceptors>
</jaxrs:server>
<bean id="searchRestServiceImpl" class=“xxx.search.rest.SearchRestServiceImplS”>
<!—Service beans —>
<property name="xxxService" ref=“xxxServiceBean"/>
…
...
<property name=“yyyService" ref=“yyyTranslatorServiceBean”/>
</bean>
I don’t think the following is relevant but I am using Camel for multicasting to the service beans.
<camelContext id="camel" xmlns="http://camel.apache.org/schema/blueprint" >
<packageScan>
<package>xxx.search.camel.aggregator</package>
<excludes>**.*Test*</excludes>
<includes>**.*</includes>
</packageScan>
</camelContext>
In fact, the skeleton of the project looks more like https://github.com/arunma/karafcxfcamel (Except for the .kar)
Cheers,
Arun Manivannan
On March 27, 2014 at 3:45:50 PM, Freeman Fang (freeman.fang@gmail.com) wrote:
Hi,
Could you please elaborate how you define the dependency between REST Service and ServiceImpl bundles?
Using OSGi service? Using blueprint to refer the OSGi service?
-------------
Freeman(Yue) Fang
Red Hat, Inc.
FuseSource is now part of Red Hat
On 2014-3-26, at 下午8:07, Arun Manivannan wrote:
This is a little embarrassing considering I have been meddling around with Karaf for a while now.
I have a service implementation bundle and a CXF-REST bundle. If I throw in the REST bundle before the ServiceImpl bundle into my deploy folder, it waits for the service bundle for a few seconds and then goes into a Failed state. Obviously, all goes well if I do it in sequence - ServiceImpl first and REST next. I wanted my REST service to wait forever until the ServiceImpl is deployed (just like the rest of the OSGi bundles)
My guess is that there is some place where I should be increasing the timeout to wait forever. This guess is based on the fact that for a PaxExam test, I should do so.
@Inject @Filter(timeout = 300000) BootFinished bootFinished;
(source : KarafTestSupport.java)
Am I looking at the wrong place or should I be looking at other places for hints like Activator or Import/Export packages?
My REST maven-bundle-plugin looks like this :
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Activator>xxxx.xxx
.rest.Activator</Bundle-Activator>
<Import-Package>*</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
I understand that deploying as a .kar file along with the the rest of the libraries (I deploy the dependencies as a .kar) would solve it but I do not want to do that for the REST and Impl bundles because of faster deployments (and bandwidth sizes - I am on EC2).
Cheers,
Arun Manivannan
Re: Waiting for dependent bundle
Posted by Freeman Fang <fr...@gmail.com>.
Hi,
From the blueprint fragment I can't see how you refer the OSGi service from another bundle.
IIRC, you can specify timeout="…" when you refer an OSGi service, something like
<reference timeout="">
</reference>
-------------
Freeman(Yue) Fang
Red Hat, Inc.
FuseSource is now part of Red Hat
On 2014-3-27, at 下午3:58, Arun Manivannan wrote:
> Thanks for the note Freeman. Here is the relevant tags from the REST blueprint xml
>
>
> <jaxrs:server address="/coreservices" id="rsServer">
> <jaxrs:inInterceptors>
> <ref component-id="logInbound"/>
> </jaxrs:inInterceptors>
>
> <jaxrs:serviceBeans>
> <ref component-id="searchRestServiceImpl" />
> </jaxrs:serviceBeans>
>
> <jaxrs:outInterceptors>
> <ref component-id="logOutbound"/>
> </jaxrs:outInterceptors>
> </jaxrs:server>
>
>
>
> <bean id="searchRestServiceImpl" class=“xxx.search.rest.SearchRestServiceImplS”>
> <!—Service beans —>
> <property name="xxxService" ref=“xxxServiceBean"/>
> …
> ...
> <property name=“yyyService" ref=“yyyTranslatorServiceBean”/>
>
>
> </bean>
>
>
> I don’t think the following is relevant but I am using Camel for multicasting to the service beans.
>
> <camelContext id="camel" xmlns="http://camel.apache.org/schema/blueprint" >
> <packageScan>
> <package>xxx.search.camel.aggregator</package>
> <excludes>**.*Test*</excludes>
> <includes>**.*</includes>
> </packageScan>
> </camelContext>
>
> In fact, the skeleton of the project looks more like https://github.com/arunma/karafcxfcamel (Except for the .kar)
>
>
>
> Cheers,
> Arun Manivannan
>
>
> On March 27, 2014 at 3:45:50 PM, Freeman Fang (freeman.fang@gmail.com) wrote:
>
>> Hi,
>>
>> Could you please elaborate how you define the dependency between REST Service and ServiceImpl bundles?
>> Using OSGi service? Using blueprint to refer the OSGi service?
>> -------------
>> Freeman(Yue) Fang
>>
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>>
>>
>>
>> On 2014-3-26, at 下午8:07, Arun Manivannan wrote:
>>
>>> This is a little embarrassing considering I have been meddling around with Karaf for a while now.
>>>
>>> I have a service implementation bundle and a CXF-REST bundle. If I throw in the REST bundle before the ServiceImpl bundle into my deploy folder, it waits for the service bundle for a few seconds and then goes into a Failed state. Obviously, all goes well if I do it in sequence - ServiceImpl first and REST next. I wanted my REST service to wait forever until the ServiceImpl is deployed (just like the rest of the OSGi bundles)
>>>
>>> My guess is that there is some place where I should be increasing the timeout to wait forever. This guess is based on the fact that for a PaxExam test, I should do so.
>>>
>>> @Inject @Filter(timeout = 300000) BootFinished bootFinished;
>>> (source : KarafTestSupport.java)
>>>
>>> Am I looking at the wrong place or should I be looking at other places for hints like Activator or Import/Export packages?
>>>
>>> My REST maven-bundle-plugin looks like this :
>>>
>>>
>>>
>>>
>>>
>>> <build>
>>>
>>> <plugins>
>>>
>>> <plugin>
>>>
>>> <groupId>org.apache.felix</groupId>
>>>
>>> <artifactId>maven-bundle-plugin</artifactId>
>>>
>>> <extensions>true</extensions>
>>>
>>> <configuration>
>>>
>>> <instructions>
>>>
>>> <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
>>>
>>> <Bundle-Version>${project.version}</Bundle-Version>
>>>
>>> <Bundle-Activator>xxxx.xxx
>>> .rest.Activator</Bundle-Activator>
>>>
>>> <Import-Package>*</Import-Package>
>>>
>>> </instructions>
>>>
>>> </configuration>
>>>
>>> </plugin>
>>>
>>> </plugins>
>>>
>>> </build>
>>>
>>>
>>>
>>> I understand that deploying as a .kar file along with the the rest of the libraries (I deploy the dependencies as a .kar) would solve it but I do not want to do that for the REST and Impl bundles because of faster deployments (and bandwidth sizes - I am on EC2).
>>>
>>>
>>> Cheers,
>>> Arun Manivannan
>>>
>>
>
Re: Waiting for dependent bundle
Posted by Arun Manivannan <ar...@arunma.com>.
Thanks for the note Freeman. Here is the relevant tags from the REST blueprint xml
<jaxrs:server address="/coreservices" id="rsServer">
<jaxrs:inInterceptors>
<ref component-id="logInbound"/>
</jaxrs:inInterceptors>
<jaxrs:serviceBeans>
<ref component-id="searchRestServiceImpl" />
</jaxrs:serviceBeans>
<jaxrs:outInterceptors>
<ref component-id="logOutbound"/>
</jaxrs:outInterceptors>
</jaxrs:server>
<bean id="searchRestServiceImpl" class=“xxx.search.rest.SearchRestServiceImplS”>
<!—Service beans —>
<property name="xxxService" ref=“xxxServiceBean"/>
…
...
<property name=“yyyService" ref=“yyyTranslatorServiceBean”/>
</bean>
I don’t think the following is relevant but I am using Camel for multicasting to the service beans.
<camelContext id="camel" xmlns="http://camel.apache.org/schema/blueprint" >
<packageScan>
<package>xxx.search.camel.aggregator</package>
<excludes>**.*Test*</excludes>
<includes>**.*</includes>
</packageScan>
</camelContext>
In fact, the skeleton of the project looks more like https://github.com/arunma/karafcxfcamel (Except for the .kar)
Cheers,
Arun Manivannan
On March 27, 2014 at 3:45:50 PM, Freeman Fang (freeman.fang@gmail.com) wrote:
Hi,
Could you please elaborate how you define the dependency between REST Service and ServiceImpl bundles?
Using OSGi service? Using blueprint to refer the OSGi service?
-------------
Freeman(Yue) Fang
Red Hat, Inc.
FuseSource is now part of Red Hat
On 2014-3-26, at 下午8:07, Arun Manivannan wrote:
This is a little embarrassing considering I have been meddling around with Karaf for a while now.
I have a service implementation bundle and a CXF-REST bundle. If I throw in the REST bundle before the ServiceImpl bundle into my deploy folder, it waits for the service bundle for a few seconds and then goes into a Failed state. Obviously, all goes well if I do it in sequence - ServiceImpl first and REST next. I wanted my REST service to wait forever until the ServiceImpl is deployed (just like the rest of the OSGi bundles)
My guess is that there is some place where I should be increasing the timeout to wait forever. This guess is based on the fact that for a PaxExam test, I should do so.
@Inject @Filter(timeout = 300000) BootFinished bootFinished;
(source : KarafTestSupport.java)
Am I looking at the wrong place or should I be looking at other places for hints like Activator or Import/Export packages?
My REST maven-bundle-plugin looks like this :
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Activator>xxxx.xxx
.rest.Activator</Bundle-Activator>
<Import-Package>*</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
I understand that deploying as a .kar file along with the the rest of the libraries (I deploy the dependencies as a .kar) would solve it but I do not want to do that for the REST and Impl bundles because of faster deployments (and bandwidth sizes - I am on EC2).
Cheers,
Arun Manivannan
Re: Waiting for dependent bundle
Posted by Freeman Fang <fr...@gmail.com>.
Hi,
Could you please elaborate how you define the dependency between REST Service and ServiceImpl bundles?
Using OSGi service? Using blueprint to refer the OSGi service?
-------------
Freeman(Yue) Fang
Red Hat, Inc.
FuseSource is now part of Red Hat
On 2014-3-26, at 下午8:07, Arun Manivannan wrote:
> This is a little embarrassing considering I have been meddling around with Karaf for a while now.
>
> I have a service implementation bundle and a CXF-REST bundle. If I throw in the REST bundle before the ServiceImpl bundle into my deploy folder, it waits for the service bundle for a few seconds and then goes into a Failed state. Obviously, all goes well if I do it in sequence - ServiceImpl first and REST next. I wanted my REST service to wait forever until the ServiceImpl is deployed (just like the rest of the OSGi bundles)
>
> My guess is that there is some place where I should be increasing the timeout to wait forever. This guess is based on the fact that for a PaxExam test, I should do so.
>
> @Inject
> @Filter(timeout = 300000)
> BootFinished bootFinished;
> (source : KarafTestSupport.java)
>
> Am I looking at the wrong place or should I be looking at other places for hints like Activator or Import/Export packages?
>
> My REST maven-bundle-plugin looks like this :
>
>
>
>
>
> <build>
>
> <plugins>
>
> <plugin>
>
> <groupId>org.apache.felix</groupId>
>
> <artifactId>maven-bundle-plugin</artifactId>
>
> <extensions>true</extensions>
>
> <configuration>
>
> <instructions>
>
> <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
>
> <Bundle-Version>${project.version}</Bundle-Version>
>
> <Bundle-Activator>xxxx.xxx
> .rest.Activator</Bundle-Activator>
>
> <Import-Package>*</Import-Package>
>
> </instructions>
>
> </configuration>
>
> </plugin>
>
> </plugins>
>
> </build>
>
>
>
> I understand that deploying as a .kar file along with the the rest of the libraries (I deploy the dependencies as a .kar) would solve it but I do not want to do that for the REST and Impl bundles because of faster deployments (and bandwidth sizes - I am on EC2).
>
>
> Cheers,
> Arun Manivannan
>