jclouds-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paolo Viotti <paolo.vio...@eurecom.fr>
Subject Re: Trouble compiling JClouds with Clojure
Date Sun, 08 Sep 2013 12:43:24 GMT
Hello,

recently I had the same problem with Java and Maven.
The root cause was that in the created uber-jar the files 
"org.jclouds.apis.ApiMetadata" "org.jclouds.providers.ProviderMetadata" 
located in /META-INF/services didn't contain all the API/Provider ids.
So I had to tell Maven to merge those metadata files present in each of 
the providers' jar into one single file in the uber-jar, instead of just 
overwriting them.

This, with Maven, can be accomplished in two ways:

  * using the maven assembly plugin: with a configuration file in which
    you specify the metaInf-services handler (e.g. like this
    <https://dl.dropboxusercontent.com/u/782932/jar-with-dependencies.xml>)
  * using the maven shade plugin: with a "ServicesResourceTransformer"


Hope this helps,
Paolo



On 08/09/2013 06:46, Max Countryman wrote:
> Hi Everett,
>
> Thanks for the quick response. I've tried updating to 1.6.2-incubating but still seem
to receive the same error.
>
>  From inside the compiled jar I tried calling:
>
> (clojure.pprint/pprint (.getURLs (java.lang.ClassLoader/getSystemClassLoader))).
>
> This was the result:
>
> [#<URL file:/Users/max/Documents/projects/my-app/target/my-app-0.1.0-SNAPSHOT-standalone.jar>]
>
> I'm wondering if this could have something to do with AOT complication given that it
works fine from the repl?
>
> Thanks,
>
>
> Max
>
> On Sep 7, 2013, at 7:28 PM, Everett Toews <everett.toews@RACKSPACE.COM> wrote:
>
>> It means that the cloudfiles-us JAR isn't contained on your classpath. Although [org.jclouds/jclouds-allblobstore
"1.6.0"] should contain it. Can you list your classpath from within your app or see what leiningen
is using for the classpath?
>>
>> You might also want to try [org.apache.jclouds/jclouds-allblobstore "1.6.2-incubating"]
as that's our most recent release.
>>
>> HTH,
>> Everett
>>
>>
>> On Sep 7, 2013, at 9:12 PM, Max Countryman wrote:
>>
>>> Hi all,
>>>
>>> I am attempting to compile a jar via leiningen's uberjar command that uses JCloud's
org.jclouds.blobstore2.
>>>
>>> The trouble I'm running into is that it seems the providers list isn't populated.
Interestingly this works fine from the repl, but the compiled jar throws this error:
>>>
>>> Exception in thread "main" java.util.NoSuchElementException: key [cloudfiles-us]
not in the list of providers or apis: {providers=[hpcloud-objectstorage], apis=[atmos]}
>>> 	at org.jclouds.ContextBuilder.newBuilder(ContextBuilder.java:178)
>>> 	at org.jclouds.blobstore2$blobstore.doInvoke(blobstore2.clj:103)
>>> 	at clojure.lang.RestFn.invoke(RestFn.java:445)
>>> 	at stint_uploader.core$_main.invoke(core.clj:40)
>>> 	at clojure.lang.AFn.applyToHelper(AFn.java:159)
>>> 	at clojure.lang.AFn.applyTo(AFn.java:151)
>>> 	at stint_uploader.core.main(Unknown Source)
>>>
>>> Here's a simple example:
>>>
>>> (ns my-app.core
>>> (:require [org.jclouds.blobstore2 :refer :all])
>>> (:gen-class))
>>>
>>> (defn -main []
>>> (blobstore "cloudfiles-us" "foo" "bar"))
>>>
>>> And the project.clj would look something like:
>>>
>>> (defproject my-app "0.1.0-SNAPSHOT"
>>> :description "FIXME: write description"
>>> :url "http://example.com/FIXME"
>>> :license {:name "Eclipse Public License"
>>>            :url "http://www.eclipse.org/legal/epl-v10.html"}
>>> :dependencies [[org.clojure/clojure "1.4.0"]
>>>                 [org.clojure/tools.logging "0.2.3"]
>>>                 [org.clojure/core.incubator "0.1.0"]
>>>                 [org.jclouds/jclouds-allblobstore "1.6.0"]]
>>> :main my-app.core)
>>>
>>> Any advice is greatly appreciated,
>>>
>>> Thanks,
>>>
>>>
>>> Max


Mime
View raw message