You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by Jeremiah Robertson <jr...@gmail.com> on 2014/03/20 20:42:38 UTC

Code Exception

What causes the following exception: java.util.NoSuchElementException: key
[aws-ec2] not in list of providers or apis: {}. Or I guess the real
question is why is my provider and api list not populated with values/ how
does the list get populated?

Thank you,

-- 
Jeremiah Robertson
Georgia Tech Junior
Aerospace Engineering
Grand Challenges Program
jrspfd@gmail.com
417.207.1563

Re: Code Exception

Posted by Andrew Phillips <an...@apache.org>.
STOP PRESS: Just found this after writing the text below:

http://stackoverflow.com/questions/5760607/using-serviceloader-on-android

Looks like apk's don't easily support the ServiceLoader pattern...

> I'm trying to use the jar files in an Android app and I get the above
> exception. I have a normal java app that works with jclouds, but for some
> reason I can't get them to work in Android. Here is the list of
> dependencies I'm using:

Ah, it's on Android (I recall this list - I think I mentioned the mix  
of versions already ;-)). The mix of versions certainly won't help,  
although I remember you said things didn't work otherwise. Can you see  
which, if any,

META-INF/services/org.jclouds.providers.ProviderMetadata

files you have on the classpath of the actual compiled binary? If the  
Android packaging (and I'm not the Android expert, so apologies if  
this doesn't make sense) does something like merging all the jclouds  
JARs into something like an uberjar, these files will need to be merged.

As a debugging aid, you can explicitly try to load all resources of  
that name you can find on your app's classpath [1] and print their  
contents. If you can't find any such classpath resources, that will be  
why we see this problem.

ap

[1]  
http://docs.oracle.com/javase/7/docs/api/java/lang/ClassLoader.html#getResources(java.lang.String)

Re: Code Exception

Posted by Jeremiah Robertson <jr...@gmail.com>.
I'm trying to use the jar files in an Android app and I get the above
exception. I have a normal java app that works with jclouds, but for some
reason I can't get them to work in Android. Here is the list of
dependencies I'm using:

aopalliance-1.0
atmos-1.7.0
aws-cloudwatch-1.7.0
aws-ec2-1.7.0
aws-route53-1.7.0
aws-s3-1.7.0
aws-sqs-1.7.0
aws-sts-1.7.0
azure-common-1.7.0
azure-blob-1.7.0
bcprov-jdk16-1.46
bluelock-vcloud-zone01-1.7.0
byon-1.7.0
chef-1.7.0
chef-compute-1.7.0
chef-parent-1.6.2-incubating-tests
chef-project-1.7.0-tests
chef-servlet-1.6.3
cloudfiles-1.7.0
cloudfiles-uk-1.7.0
cloudfiles-us-1.7.0
cloudonestorage-1.7.0
cloudservers-1.7.0
cloudservers-uk-1.7.0
cloudservers-us-1.7.0
cloudsigma-1.7.0
cloudsigma-lvs-1.7.0
cloudsigma-zrh-1.7.0
cloudstack-1.7.0
cloudwatch-1.7.0
dynect-1.7.0
ec2-1.7.0
elastichosts-lon-b-1.7.0
elastichosts-lon-p-1.7.0
elastichosts-sat-p-1.7.0
elasticstack-1.7.0
enterprisechef-1.7.0
filesystem-1.7.0
go2cloud-jhb1-1.7.0
gogrid-1.7.0
greenhouse-element-vcloud-1.7.0
gson-2.2.4
guava-15.0
guice-3.0
guice-assistedinject-3.0
hpcloud-compute-1.7.0
hpcloud-objectstorage-1.7.0
java-xmlbuilder-0.4
javax.inject-1
jclouds-all-1.7.0
jclouds-allblobstore-1.8.0-SNAPSHOT
jclouds-allcompute-1.8.0-SNAPSHOT
jclouds-bouncycastle-1.7.0
jclouds-chef-1.7.0-tests
jclouds-compute-1.8.0-SNAPSHOT
jclouds-core-1.8.0-SNAPSHOT
jclouds-enterprise-1.7.0
jclouds-loadbalancer-1.7.0
jclouds-scriptbuilder-1.8.0-SNAPSHOT
jclouds-slf4j-1.7.0
jclouds-sshj-1.7.0
jsr250-api-1.0
jsr311-api-1.1.1
mule-3.4.0-embedded
mule-core-1.4.2
mule-module-annotations-3.0.0-M4
ninefold-compute-1.7.0
ninefold-storage-1.7.0
openhosting-east1-1.7.0
openstack-cinder-1.7.0
openstack-common-1.7.0
openstack-keystone-1.7.0
openstack-marconi-1.7.0
openstack-nova-1.7.0
openstack-nova-ec2-1.7.0
openstack-trove-1.7.0
rackspace-autoscale-1.7.0
rackspace-autoscale-us-1.7.0
rackspace-cloudblockstorage-uk-1.7.0
rackspace-cloudblockstorage-us-1.7.0
rackspace-clouddns-1.7.0
rackspace-clouddns-uk-1.7.0
rackspace-clouddns-us-1.7.0
rackspace-cloudidentity-1.8.0-SNAPSHOT
rackspace-cloudloadbalancers-1.7.0
rackspace-cloudloadbalancers-uk-1.7.0
rackspace-cloudloadbalancers-us-1.7.0
rackspace-cloudservers-uk-1.8.0-SNAPSHOT
rackspace-cloudservers-us-1.8.0-SNAPSHOT
rocoto-6.2
route53-1.7.0
s3-1.7.0
serverlove-z1-man-1.7.0
skalicloud-sdg-my-1.7.0
slf4j-api-1.7.2
snakeyaml-1.11
softlayer-1.7.0
sqs-1.7.0
sshj-0.8.1
sts-1.7.0
swift-1.7.0
ultradns-ws-1.7.0
vcloud-1.7.0




On Thu, Mar 20, 2014 at 3:50 PM, Andrew Phillips <an...@apache.org> wrote:

> What causes the following exception: java.util.NoSuchElementException: key
>> [aws-ec2] not in list of providers or apis: {}. Or I guess the real
>> question is why is my provider and api list not populated with values/ how
>> does the list get populated?
>>
>
> jclouds uses Java's ServiceLoader mechanism to discover available
> providers. If aws-ec2 isn't found, it probably means there's something
> interesting going on with your classpath. Could you provide some more
> detail on what your project's dependencies are?
>
> Also, are you doing something like creating an uberjar somewhere? That can
> interfere with the files ServiceLoader uses.
>
> Regards
>
> ap
>
> [1] http://docs.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html
>



-- 
Jeremiah Robertson
Georgia Tech Junior
Aerospace Engineering
Grand Challenges Program
jrspfd@gmail.com
417.207.1563

Re: Code Exception

Posted by Andrew Phillips <an...@apache.org>.
> What causes the following exception: java.util.NoSuchElementException: key
> [aws-ec2] not in list of providers or apis: {}. Or I guess the real
> question is why is my provider and api list not populated with values/ how
> does the list get populated?

jclouds uses Java's ServiceLoader mechanism to discover available  
providers. If aws-ec2 isn't found, it probably means there's something  
interesting going on with your classpath. Could you provide some more  
detail on what your project's dependencies are?

Also, are you doing something like creating an uberjar somewhere? That  
can interfere with the files ServiceLoader uses.

Regards

ap

[1] http://docs.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html