problem with using jclouds and cxf in the same karaf osgi container

59 views
Skip to first unread message

Marek Kasztelnik (25/11)

unread,
Jan 21, 2012, 5:02:33 AM1/21/12
to jclouds
Hello everyone,

First of all thanks for the great jclouds library :)

In my project we use cxf (camel-cxf 2.9.0 to be more specific) to
deliver rest services to the user and camel itself to integrate
several systems together. We would also like to use jclouds (currently
1.3.1) to manage our clouds installations (based on open stack and
amazon). Unfortunatelly these two frameworks do not work well
together. The problem is connected to http://www.dankulp.com/blog/2011/11/apache-cxf-in-osgi/.
CXF uses library:

mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jsr311-
api-1.1.1/1.9.0

which causes following exception in jclouds:

Error in custom provider, java.lang.RuntimeException: method is
intended solely to set constants: public abstract
com.google.common.util.concurrent.ListenableFuture
org.jclouds.ec2.services.AvailabilityZoneAndRegionAsyncClient.describeRegions(org.jclouds.ec2.options.DescribeRegionsOptions[])
while locating org.jclouds.ec2.config.EC2RestClientModule
$RegionIdsToURI
at
org.jclouds.aws.config.AWSRestClientModule.bindRegionsToProvider(AWSRestClientModule.java:
103)
while locating java.util.Map<java.lang.String, java.net.URI>
annotated with @org.jclouds.location.Region()
for parameter 1 at org.jclouds.ec2.config.EC2RestClientModule
$RegionIdToZoneId.<init>(EC2RestClientModule.java:147)
at org.jclouds.ec2.config.EC2RestClientModule
$RegionIdToZoneId.class(EC2RestClientModule.java:138)
while locating org.jclouds.ec2.config.EC2RestClientModule
$RegionIdToZoneId
at
org.jclouds.aws.config.WithZonesFormSigningRestClientModule.bindZonesToProvider(WithZonesFormSigningRestClientModule.java:
60)
while locating java.util.Map<java.lang.String, java.lang.String>
annotated with @org.jclouds.location.Zone()
for parameter 4 at
org.jclouds.location.suppliers.ZoneToRegionToProviderOrJustProvider.<init>(ZoneToRegionToProviderOrJustProvider.java:
56)
at
org.jclouds.location.suppliers.ZoneToRegionToProviderOrJustProvider.class(ZoneToRegionToProviderOrJustProvider.java:
47)
while locating
org.jclouds.location.suppliers.ZoneToRegionToProviderOrJustProvider
at
org.jclouds.compute.config.BindComputeSuppliersByClass.bindLocationSupplier(BindComputeSuppliersByClass.java:
83)
while locating com.google.common.base.Supplier<java.util.Set<?
extends org.jclouds.domain.Location>>
at
org.jclouds.location.config.LocationModule.supplyLocationCache(LocationModule.java:
58)
at
org.jclouds.location.config.LocationModule.supplyLocationCache(LocationModule.java:
58)
while locating com.google.common.base.Supplier<java.util.Set<?
extends org.jclouds.domain.Location>> annotated with
@org.jclouds.collect.Memoized()
for parameter 3 at
org.jclouds.aws.ec2.compute.functions.AWSRunningInstanceToNodeMetadata.<init>(AWSRunningInstanceToNodeMetadata.java:
58)
at
org.jclouds.aws.ec2.compute.functions.AWSRunningInstanceToNodeMetadata.class(AWSRunningInstanceToNodeMetadata.java:
58)
while locating
org.jclouds.aws.ec2.compute.functions.AWSRunningInstanceToNodeMetadata
while locating
org.jclouds.ec2.compute.functions.RunningInstanceToNodeMetadata
at
org.jclouds.ec2.compute.config.EC2ComputeServiceDependenciesModule.bindNodeConverter(EC2ComputeServiceDependenciesModule.java:
123)
at
org.jclouds.ec2.compute.config.EC2ComputeServiceDependenciesModule.bindNodeConverter(EC2ComputeServiceDependenciesModule.java:
123)
while locating
com.google.common.base.Function<org.jclouds.ec2.domain.RunningInstance,
org.jclouds.compute.domain.NodeMetadata>
for parameter 1 at
org.jclouds.aws.ec2.compute.strategy.AWSEC2GetNodeMetadataStrategy.<init>(AWSEC2GetNodeMetadataStrategy.java:
50)
at
org.jclouds.aws.ec2.compute.strategy.AWSEC2GetNodeMetadataStrategy.class(AWSEC2GetNodeMetadataStrategy.java:
50)
while locating
org.jclouds.aws.ec2.compute.strategy.AWSEC2GetNodeMetadataStrategy
while locating
org.jclouds.ec2.compute.strategy.EC2GetNodeMetadataStrategy
at
org.jclouds.compute.config.BindComputeStrategiesByClass.bindGetNodeMetadataStrategy(BindComputeStrategiesByClass.java:
79)
while locating org.jclouds.compute.strategy.GetNodeMetadataStrategy
for parameter 0 at
org.jclouds.compute.predicates.NodeTerminated.<init>(NodeTerminated.java:
49)
at
org.jclouds.compute.predicates.NodeTerminated.class(NodeTerminated.java:
40)
while locating org.jclouds.compute.predicates.NodeTerminated
Caused by: java.lang.RuntimeException: method is intended solely to
set constants: public abstract
com.google.common.util.concurrent.ListenableFuture
org.jclouds.ec2.services.AvailabilityZoneAndRegionAsyncClient.describeRegions(org.jclouds.ec2.options.DescribeRegionsOptions[])
at
org.jclouds.rest.internal.AsyncRestClientProxy.invoke(AsyncRestClientProxy.java:
128)
at $Proxy84.describeRegions(Unknown Source)
at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown
Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.jclouds.concurrent.internal.SyncProxy.invoke(SyncProxy.java:137)
at $Proxy85.describeRegions(Unknown Source)
at org.jclouds.ec2.config.EC2RestClientModule
$RegionIdsToURI.get(EC2RestClientModule.java:128)
at org.jclouds.ec2.config.EC2RestClientModule
$RegionIdsToURI.get(EC2RestClientModule.java:109)
at
com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:
55)
at com.google.inject.internal.ProviderToInternalFactoryAdapter
$1.call(ProviderToInternalFactoryAdapter.java:46)
at
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:
1031)
at
com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:
40)
at com.google.inject.Scopes$1$1.get(Scopes.java:65)


Do you have any clue how I can solve this conflict and allow to live
jclouds and cxf in the same osgi container?

greetings from Krakow,
Marek

Ioannis Canellos

unread,
Jan 21, 2012, 10:22:34 AM1/21/12
to jcl...@googlegroups.com
Hi,

This is a PITA.

I am a bit curious on how you came to the conclusion that servicemix specs jsr311 is the root of the problem. I don't disagree, but its not obvious to me. I may miss some pieces of information here.
I agree that the problem lies in the fact that CXF requires masking some of the JRE exported packages.
You seem to be certain that the problem is related to javax.rs which is exported by smx specs jsr311. Why?

In any case we will need to identify the package/bundle that is causing the issues and see what we can do about it.
--
You received this message because you are subscribed to the Google Groups "jclouds" group.
To post to this group, send email to jcl...@googlegroups.com.
To unsubscribe from this group, send email to jclouds+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jclouds?hl=en.


Ioannis Canellos

Marek Kasztelnik (25/11)

unread,
Jan 22, 2012, 7:42:03 AM1/22/12
to jclouds
Hi,

At the beginning I installed jclouds and my bundle which managed our
cloud (everything worked OK). Then I tried to start something which
uses camel-cxf. camel-cxf caused the problem with my application so I
started to find which budle caused this problem. The problem was
connected with cxf-specs. Next I inspected cxf-specs feature bundles.
At the end, I discovered that when smx specs jsr311 is stopped (while
starting karaf), everything works OK. When it is started exception
described in my first post occurs.

greetings,
Marek

On 21 Sty, 16:22, Ioannis Canellos <ioca...@gmail.com> wrote:
> Hi,
>
> This is a PITA.
>
> I am a bit curious on how you came to the conclusion that servicemix specs jsr311 is the root of the problem. I don't disagree, but its not obvious to me. I may miss some pieces of information here.
> I agree that the problem lies in the fact that CXF requires masking some of the JRE exported packages.
> You seem to be certain that the problem is related to javax.rs which is exported by smx specs jsr311. Why?
>
> In any case we will need to identify the package/bundle that is causing the issues and see what we can do about it.
>
> On 21 Ιαν 2012, at 12:02 μ.μ., Marek Kasztelnik (25/11) wrote:
>
>
>
>
>
>
>
>
>
> > Hello everyone,
>
> > First of all thanks for the great jclouds library :)
>
> > In my project we use cxf (camel-cxf 2.9.0 to be more specific) to
> > deliver rest services to the user and camel itself to integrate
> > several systems together. We would also like to use jclouds (currently
> > 1.3.1) to manage our clouds installations (based on open stack and
> > amazon). Unfortunatelly these two frameworks do not work well
> > together. The problem is connected tohttp://www.dankulp.com/blog/2011/11/apache-cxf-in-osgi/.
> > For more options, visit this group athttp://groups.google.com/group/jclouds?hl=en.

Ioannis Canellos

unread,
Jan 22, 2012, 7:51:16 AM1/22/12
to jcl...@googlegroups.com
Thanks for the response. I will try to reproduce it.

The camel 2.9.0 feature descriptor has a reference to jclouds-karaf 1.2.x feature. Do you modify the camel feature descriptor itself, or you use the original and install the jclouds-karaf-1.3.1 feature descriptor on your own?

For more options, visit this group at http://groups.google.com/group/jclouds?hl=en.

Marek Kasztelnik (25/11)

unread,
Jan 22, 2012, 8:07:45 AM1/22/12
to jclouds
Hi Ioannis,

I use original camel features descriptor and I add

mvn:org.jclouds.karaf/jclouds-karaf/1.3.1/xml/features

by my own. Bellow you can find the list of all features installed in
my karaf:

karaf@root> features:list -i
State Version Name
Repository Description
[installed ] [2.5.1 ] cxf-specs
cxf-2.5.1
[installed ] [1.9.0 ] xml-specs-api
camel-2.9.0
[installed ] [2.9.0 ] camel
camel-2.9.0
[installed ] [2.9.0 ] camel-core
camel-2.9.0
[installed ] [2.9.0 ] camel-spring
camel-2.9.0
[installed ] [3.0 ] guice
jclouds-1.3.1 Google Guice
[installed ] [1.3.1 ] jclouds
jclouds-1.3.1 JClouds
[installed ] [1.3.1 ] jclouds-compute
jclouds-1.3.1 JClouds Compute
[installed ] [1.3.1 ] jclouds-driver-jsch
jclouds-1.3.1 JClouds - Drivers - Jsch
[installed ] [1.3.1 ] jclouds-driver-sshj
jclouds-1.3.1 JClouds - Drivers - Sshj
[installed ] [1.3.1 ] jclouds-driver-slf4j
jclouds-1.3.1 JClouds - Drivers - Slf4j
[installed ] [1.3.1 ] jclouds-driver-log4j
jclouds-1.3.1 JClouds - Drivers - Slf4j
[installed ] [1.3.1 ] jclouds-driver-bouncycastle
jclouds-1.3.1 JClouds - Drivers - Bouncycastle
[installed ] [1.3.1 ] jclouds-aws-ec2
jclouds-1.3.1 Amazon Web Service - EC2
[installed ] [0.1.0-SNAPSHOT] dyrealla-api
dyrealla-0.5.0-SNAPSHOT
[installed ] [0.3.0-SNAPSHOT] dyrealla-commons
dyrealla-0.5.0-SNAPSHOT
[installed ] [0.1.0-SNAPSHOT] dyrealla-console
dyrealla-0.5.0-SNAPSHOT
[installed ] [0.1.0-SNAPSHOT] dyrealla-jclouds-client
dyrealla-0.5.0-SNAPSHOT
[installed ] [3.0.6.RELEASE ] spring
karaf-2.2.5
[installed ] [1.2.1 ] spring-dm
karaf-2.2.5
[installed ] [3.0.6.RELEASE ] spring-tx
karaf-2.2.5
[installed ] [2.2.5 ] config
karaf-2.2.5
[installed ] [2.2.5 ] kar
karaf-2.2.5
[installed ] [2.2.5 ] ssh
karaf-2.2.5
[installed ] [2.2.5 ] management
karaf-2.2.5
[installed ] [3.0 ] guice
jclouds-1.2.2 Google Guice

Regards

Marek

Marek Kasztelnik (25/11)

unread,
Feb 6, 2012, 5:17:56 AM2/6/12
to jclouds
Hi Ioannis,

did you manage to reproduce problem described in this topic?

greetings,
Marek

On 22 Sty, 14:07, "Marek Kasztelnik (25/11)" <mkasztel...@gmail.com>
wrote:
> ...
>
> więcej »

Ioannis Canellos

unread,
Feb 6, 2012, 5:48:00 AM2/6/12
to jcl...@googlegroups.com
Hi Marek,

Yes, I did manage to reproduce the problem. Unfortunately I didn't have much time to get to a solution.


--
You received this message because you are subscribed to the Google Groups "jclouds" group.
To post to this group, send email to jcl...@googlegroups.com.
To unsubscribe from this group, send email to jclouds+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jclouds?hl=en.

Tomek

unread,
Feb 20, 2012, 5:51:30 AM2/20/12
to jclouds
Hello,

I'm experiencing the same problem as Marek. I'm using Karaf 2.2.5 with
jre.properties.cxf (supplied with karaf). Any progress with this
issue?

Best regards,
Tomek
> ...
>
> więcej »

Ioannis Canellos

unread,
Feb 20, 2012, 6:44:20 AM2/20/12
to jcl...@googlegroups.com
I will spend some time on it today and see what can be done about it.

--

Ioannis Canellos

unread,
Feb 20, 2012, 1:17:36 PM2/20/12
to jcl...@googlegroups.com
The root of the problem is the jersey-core bundle. If you install the jclouds features, before the cxf feature, then you will not face that problem.
The other way around will not work until we have a proper jersey-core bundle (I am working on it).

Ioannis Canellos

unread,
Feb 20, 2012, 1:30:11 PM2/20/12
to jcl...@googlegroups.com
I added a "special case" integration test to all jclouds karaf branch from 1.3.x and above, that test this scenario. I hope it works for you, till we have a proper jersey bundle.

Adrian Cole

unread,
Feb 21, 2012, 3:56:10 AM2/21/12
to jcl...@googlegroups.com, jclou...@googlegroups.com
Thanks for troubleshooting and chasing this down, Ioannis!

-A

Andrew Phillips

unread,
Feb 21, 2012, 4:17:30 AM2/21/12
to jcl...@googlegroups.com
> Thanks for troubleshooting and chasing this down, Ioannis!

+1! The OSGi detective strikes again ;-)

Thanks!

ap

Marek Kasztelnik (25/11)

unread,
Feb 22, 2012, 3:07:42 AM2/22/12
to jclouds
Ioannis,

Thanks for the hint and troubleshooting :)

greetings,
Marek

On 20 Lut, 19:30, Ioannis Canellos <ioca...@gmail.com> wrote:
> I added a "special case" integration test to all jclouds karaf branch from
> 1.3.x and above, that test this scenario. I hope it works for you, till we
> have a proper jersey bundle.
>
> --
> *Ioannis Canellos*
> *
> FuseSource <http://fusesource.com>
>
> **
> Blog:http://iocanel.blogspot.com
> **
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> Apache Camel <http://camel.apache.org/> Committer
> Apache ServiceMix <http://servicemix.apache.org/>  Committer
> Apache Gora <http://incubator.apache.org/gora/> Committer
> Apache DirectMemory <http://incubator.apache.org/directmemory/> Committer
> *
Reply all
Reply to author
Forward
0 new messages