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

Could not locate clojure/data/xml__init.class, clojure/data/xml.clj or clojure/data/xml.cljc on classpath #86

Closed
cjsauer opened this issue Jul 6, 2019 · 8 comments
Labels
bug Something isn't working

Comments

@cjsauer
Copy link

cjsauer commented Jul 6, 2019

Dependencies

        com.cognitect.aws/api                        {:mvn/version "0.8.342"}
        com.cognitect.aws/endpoints                  {:mvn/version "1.1.11.568"}
        com.cognitect.aws/email                      {:mvn/version "722.2.470.0"}
        com.cognitect.aws/sns                        {:mvn/version "718.2.444.0"}
        com.cognitect.aws/pinpoint                   {:mvn/version "711.2.411.0"}

Description with failing test case

Started running into this error while attempting to deploy via Datomic Ions after upgrading to 0.8.342 (although I believe the offending release is 0.8.335, in which a switch was made from clojure.xml to clojure.data.xml). Including an explicit dependency on clojure.data.xml does not fix the issue.

Stack traces

Here is an abbreviated stack trace from CloudWatch logs:

"Type": "clojure.lang.ExceptionInfo",
                "Message": "Syntax error compiling at (cognitect/aws/util.clj:1:1).",
                "Data": {
                    "CognitectAnomaliesCategory": "CognitectAnomaliesFault",
                    "DatomicAnomaliesException": {
                        "Via": [
                            {
                                "Type": "clojure.lang.Compiler$CompilerException",
                                "Message": "Syntax error compiling at (cognitect/aws/util.clj:1:1).",
                                "Data": {
                                    "ClojureErrorPhase": "CompileSyntaxCheck",
                                    "ClojureErrorLine": 1,
                                    "ClojureErrorColumn": 1,
                                    "ClojureErrorSource": "cognitect/aws/util.clj"
                                },
                                "At": [
                                    "clojure.lang.Compiler",
                                    "load",
                                    "Compiler.java",
                                    7647
                                ]
                            },
                            {
                                "Type": "java.io.FileNotFoundException",
                                "Message": "Could not locate clojure/data/xml__init.class, clojure/data/xml.clj or clojure/data/xml.cljc on classpath.",
                                "At": [
                                    "clojure.lang.RT",
                                    "load",
                                    "RT.java",
                                    466
                                ]
                            }
                        ],
@cjsauer cjsauer changed the title Could not locate clojure/data/xml__init.class, clojure/data/xml.clj or clojure/data/xml.cljc on classpath. Syntax error compiling at (cognitect/aws/util.clj:1:1). Jul 6, 2019
@cjsauer cjsauer changed the title Syntax error compiling at (cognitect/aws/util.clj:1:1). Could not locate clojure/data/xml__init.class, clojure/data/xml.clj or clojure/data/xml.cljc on classpath Jul 6, 2019
@cjsauer
Copy link
Author

cjsauer commented Jul 6, 2019

Does tools.deps integrate with lein? It appears that clojure.data.xml does not include a deps.edn file, would this cause transitive dependencies to fail to be downloaded?

@dchelimsky
Copy link
Contributor

I can't explain why adding an explicit dep doesn't resolve it, but the issue is that I failed to update the pom (nothing to do w/ tools.deps or lein).

Fix coming soon.

@cjsauer
Copy link
Author

cjsauer commented Jul 6, 2019

@dchelimsky ah okay, appreciate the quick response.

@dchelimsky dchelimsky added the bug Something isn't working label Jul 6, 2019
@dchelimsky
Copy link
Contributor

Fixed in 6835cb6

@dchelimsky
Copy link
Contributor

Released in 0.8.345

@usernolan
Copy link

usernolan commented Jul 26, 2019

This issue seems to have mutated in com.cognitect.aws/api {:mvn/version "0.8.345"}.

com.cognitect.aws/api {:mvn/version "0.8.345"}
com.cognitect.aws/endpoints {:mvn/version "1.1.11.592"},
com.cognitect.aws/sns {:mvn/version "718.2.444.0"},

0.8.305 is the last version that works for our application. 0.8.335 and 0.8.342 both cause the exception as described in the issue. 0.8.345 causes calls to aws/invoke to return the following:

{:cognitect.anomalies/category :cognitect.anomalies/fault, :cognitect.aws.client/throwable #error {
 :cause "clojure.data.xml$parse"
 :via [{:type java.lang.NoClassDefFoundError
        :message "clojure/data/xml$parse"
        :at [cognitect.aws.util$xml_read invokeStatic "util.clj" 137]}
       {:type java.lang.ClassNotFoundException
        :message "clojure.data.xml$parse"
        :at [java.net.URLClassLoader findClass "URLClassLoader.java" 382]}]
 :trace [[java.net.URLClassLoader findClass "URLClassLoader.java" 382] ...]

I'm not sure if it will have any impact, but this is in Java 8. Let me know if I can provide any additional information, or if you'd like me to open a new issue. Otherwise 0.8.305 works well for us!

@dchelimsky
Copy link
Contributor

@Nolan330 I can use "0.8.345" with java 8 without seeing this.

$ java -version
java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)
$ clj -Sdeps '{:deps
               {com.cognitect.aws/api       {:mvn/version "0.8.345"}
               com.cognitect.aws/endpoints {:mvn/version "1.1.11.592"}
               com.cognitect.aws/s3        {:mvn/version "726.2.488.0"}}}'
>              {com.cognitect.aws/api       {:mvn/version "0.8.345"}
>               com.cognitect.aws/endpoints {:mvn/version "1.1.11.592"}
>               com.cognitect.aws/s3        {:mvn/version "726.2.488.0"}}}'
Clojure 1.10.1
user=> user=> (require '[cognitect.aws.client.api :as aws])
nil
user=> (def c (aws/client {:api :s3}))
#'user/c
user=> (aws/invoke c {:op :ListBuckets})
{:Buckets [{:Name "..."}] :Owner {...}}

I wonder what's different about our environments.

@usernolan
Copy link

usernolan commented Jul 26, 2019

Really appreciate the response @dchelimsky. I'm not sure what's happening either.

For additional context, the failing code is running in a java8 lambda in a tools.deps workflow. I narrowed down the issue to merely changing 0.8.305 to 0.8.345; the former runs great, the latter causes the NoClassDefFoundError. I'm thinking it's some form of dependency conflict being introduced. I'll check the classpath to see what else is in there.

Let me know if you have any ideas on debugging this beyond inspecting -Spath and -Stree. Thanks again for your quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants