Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class Not Found Exception #85

Closed
caryfitzhugh opened this issue Nov 26, 2014 · 12 comments
Closed

Class Not Found Exception #85

caryfitzhugh opened this issue Nov 26, 2014 · 12 comments

Comments

@caryfitzhugh
Copy link
Contributor

java.lang.ClassNotFoundException: com.amazonaws.auth.profile.ProfileCredentialsProvider

I am trying to use amazonica but get this failure when I require any amazonica.aws.* package.

Does anyone have ideas?

@mcohen01
Copy link
Owner

What version are you using? Can you post your code, and a trace?

@caryfitzhugh
Copy link
Contributor Author

Downgrading to 0.2.29 seems to let me move forward.
I needed to include joda-time explicitly - not sure if that matters.

@caryfitzhugh
Copy link
Contributor Author

I'll go back to 0.2.30 and get you a trace

@caryfitzhugh
Copy link
Contributor Author

going back to just 0.2.30, all I've done is try to run tests, and it's just requiring the sqs package that causes this error.

Exception in thread "main" java.lang.ClassNotFoundException: com.amazonaws.auth.profile.ProfileCredentialsProvider, compiling:(amazonica/core.clj:1:1)
    at clojure.lang.Compiler.load(Compiler.java:7142)
    at clojure.lang.RT.loadResourceScript(RT.java:370)
    at clojure.lang.RT.loadResourceScript(RT.java:361)
    at clojure.lang.RT.load(RT.java:440)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5066.invoke(core.clj:5641)
    at clojure.core$load.doInvoke(core.clj:5640)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5446)
    at clojure.core$load_lib$fn__5015.invoke(core.clj:5486)
    at clojure.core$load_lib.doInvoke(core.clj:5485)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:626)
    at clojure.core$load_libs.doInvoke(core.clj:5524)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:628)
    at clojure.core$use.doInvoke(core.clj:5618)
    at clojure.lang.RestFn.invoke(RestFn.java:436)
    at amazonica.aws.sqs$eval9203$loading__4958__auto____9204.invoke(sqs.clj:1)
    at amazonica.aws.sqs$eval9203.invoke(sqs.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6703)
    at clojure.lang.Compiler.eval(Compiler.java:6692)
    at clojure.lang.Compiler.load(Compiler.java:7130)
    at clojure.lang.RT.loadResourceScript(RT.java:370)
    at clojure.lang.RT.loadResourceScript(RT.java:361)
    at clojure.lang.RT.load(RT.java:440)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5066.invoke(core.clj:5641)
    at clojure.core$load.doInvoke(core.clj:5640)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5446)
    at clojure.core$load_lib$fn__5015.invoke(core.clj:5486)
    at clojure.core$load_lib.doInvoke(core.clj:5485)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:626)
    at clojure.core$load_libs.doInvoke(core.clj:5524)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:626)
    at clojure.core$require.doInvoke(core.clj:5607)
    at clojure.lang.RestFn.invoke(RestFn.java:805)
    at hivewing_core.hive_image$eval9099$loading__4958__auto____9100.invoke(hive_image.clj:1)
    at hivewing_core.hive_image$eval9099.invoke(hive_image.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6703)
    at clojure.lang.Compiler.eval(Compiler.java:6692)
    at clojure.lang.Compiler.load(Compiler.java:7130)
    at clojure.lang.RT.loadResourceScript(RT.java:370)
    at clojure.lang.RT.loadResourceScript(RT.java:361)
    at clojure.lang.RT.load(RT.java:440)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5066.invoke(core.clj:5641)
    at clojure.core$load.doInvoke(core.clj:5640)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5446)
    at clojure.core$load_lib$fn__5015.invoke(core.clj:5486)
    at clojure.core$load_lib.doInvoke(core.clj:5485)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:626)
    at clojure.core$load_libs.doInvoke(core.clj:5524)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:626)
    at clojure.core$require.doInvoke(core.clj:5607)
    at clojure.lang.RestFn.invoke(RestFn.java:703)
    at hivewing_core.hive_images_test$eval9093$loading__4958__auto____9094.invoke(hive_images_test.clj:1)
    at hivewing_core.hive_images_test$eval9093.invoke(hive_images_test.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6703)
    at clojure.lang.Compiler.eval(Compiler.java:6692)
    at clojure.lang.Compiler.load(Compiler.java:7130)
    at clojure.lang.RT.loadResourceScript(RT.java:370)
    at clojure.lang.RT.loadResourceScript(RT.java:361)
    at clojure.lang.RT.load(RT.java:440)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5066.invoke(core.clj:5641)
    at clojure.core$load.doInvoke(core.clj:5640)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5446)
    at clojure.core$load_lib$fn__5015.invoke(core.clj:5486)
    at clojure.core$load_lib.doInvoke(core.clj:5485)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:626)
    at clojure.core$load_libs.doInvoke(core.clj:5524)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:626)
    at clojure.core$require.doInvoke(core.clj:5607)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:626)
    at user$eval85.invoke(form-init4436878907904833254.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6703)
    at clojure.lang.Compiler.eval(Compiler.java:6693)
    at clojure.lang.Compiler.load(Compiler.java:7130)
    at clojure.lang.Compiler.loadFile(Compiler.java:7086)
    at clojure.main$load_script.invoke(main.clj:274)
    at clojure.main$init_opt.invoke(main.clj:279)
    at clojure.main$initialize.invoke(main.clj:307)
    at clojure.main$null_opt.invoke(main.clj:342)
    at clojure.main$main.doInvoke(main.clj:420)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:383)
    at clojure.lang.AFn.applyToHelper(AFn.java:156)
    at clojure.lang.Var.applyTo(Var.java:700)
    at clojure.main.main(main.java:37)
Caused by: java.lang.ClassNotFoundException: com.amazonaws.auth.profile.ProfileCredentialsProvider
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:190)
    at amazonica.core$eval9209$loading__4958__auto____9210.invoke(core.clj:1)
    at amazonica.core$eval9209.invoke(core.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6703)
    at clojure.lang.Compiler.eval(Compiler.java:6692)
    at clojure.lang.Compiler.load(Compiler.java:7130)

@alilee
Copy link

alilee commented Nov 27, 2014

I have a similar issue with 0.3.1 which downgrading to 0.3.0 solved. In the ns:

(ns ingest-f0001.s3
   (:require [amazonica.aws.s3 :as s3]
             [clj-time.core :as t]))

from my project.clj:

:dependencies [[org.clojure/clojure "1.6.0"]
               [org.clojure/data.csv "0.1.2"]
               [yieldbot/flambo "0.4.0-SNAPSHOT"]
               [clj-time "0.8.0"]
               [amazonica "0.3.1" :exclusions [joda-time]]]

I was getting the error message:

Failed trying to require ingest-f0001.s3 with: java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.ClientConfiguration

There doesn't seem to be a problem building an uberjar or under lein repl, but it won't compile the ns clause inside Lighttable unless I downgrade. I'm cool for now, but I put this here as a data point. Thanks!

@mcohen01
Copy link
Owner

@caryfitzhugh and @alilee I think the problem in both your cases is a version conflict with Jackson. The >=1.9 Java SDK bumped the version from 2.1 to 2.3. So for instance, I had a slightly older version of cheshire in a project which would reproduce the NoClassDef error (for the ClientConfiguration). The fix was either upgrading cheshire to 5.3.1 or excluding jackson like so:

[cheshire "5.2.0" :exclusions [com.fasterxml.jackson.core/jackson-databind
                                                com.fasterxml.jackson.core/jackson-core
                                                com.fasterxml.jackson.core/jackson-annotations]]

Can you give that a try and let us know if that works?

@caryfitzhugh
Copy link
Contributor Author

I don’t use cheshire. And so those changes didn't help me.

And I’m also a beginner, so maybe I’m mistaken. But - in the lib
directory, I do see

jackson-core-asl-1.8.9.jar

jackson-mapper-asl-1.8.9.jar

I’m not sure how to discover who is including that - or if I need it… Or
if excluding it is an option.
Sorry.

On Fri, Nov 28, 2014 at 2:58 PM, Michael Cohen notifications@github.com
wrote:

@caryfitzhugh https://github.com/caryfitzhugh and @alilee
https://github.com/alilee I think the problem in both your cases is a
version conflict with Jackson. The >=1.9 Java SDK bumped the version from
2.1 to 2.3. So for instance, I had a slightly older version of cheshire in
a project which would reproduce the NoClassDef error (for the
ClientConfiguration). The fix was either upgrading cheshire to 5.3.1 or
excluding jackson like so:

[cheshire "5.2.0" :exclusions [com.fasterxml.jackson.core/jackson-databind
com.fasterxml.jackson.core/jackson-core
com.fasterxml.jackson.core/jackson-annotations]]

Can you give that a try and let us know if that works?


Reply to this email directly or view it on GitHub
#85 (comment).

@mcohen01
Copy link
Owner

If you're using leiningen, in the root of your project you can type lein deps :tree, which will print out the dependency tree for your project. Then you can search for jackson to see what other libraries depend on it and the versions they're pulling in.

@caryfitzhugh
Copy link
Contributor Author

Ahh... Rotary is including it (I'm converting over from rotary to
amazonica... Just too many AWS services I use, can't have a lib for each :)
)
I will touch base again once the conversion is complete, and I'll try to
roll amazonica back up to 0.2.30

Thanks!

On Fri, Nov 28, 2014 at 7:10 PM, Michael Cohen notifications@github.com
wrote:

If you're using leiningen, in the root of your project you can type lein
deps :tree, which will print out the dependency tree for your project.
Then you can search for jackson to see what other libraries depend on it
and the versions they're pulling in.


Reply to this email directly or view it on GitHub
#85 (comment).

@mcohen01
Copy link
Owner

@alilee I think the problem manifests when using LightTable because they have a dependency on fetch, which pulls in jackson 2.0.0 via cheshire 4.0.0 via lib-noir via noir. Maybe you can ask the LightTable devs how to specify exclusions in the IDE deps.

@alilee
Copy link

alilee commented Nov 29, 2014

Thanks for the comment.. will think about what I can do.

@kubek2k
Copy link

kubek2k commented Apr 7, 2015

@alilee the cheshire is added to classpath implicitly - my way to go was to explicitly add repl deplendencies as stated here:
http://docs.lighttable.com/#connect-to-an-nrepl-server?

but, I've added exclusion for jackson:

(defproject amazonica-test "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.6.0"]
                 [lein-light-nrepl "0.1.0" :exclusions [[com.fasterxml.jackson.core/jackson-core]]]
                 [amazonica "0.3.19"]]
  :repl-options {:nrepl-middleware [lighttable.nrepl.handler/lighttable-ops]})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants