Fork me on GitHub
#clj-yaml
<
2023-09-25
>
Kiyanosh Kamdar22:09:59

Hello, I’m try to figure out this issue running the latest version 1.0.27

Kiyanosh Kamdar22:09:21

Error:

; Execution error (NoSuchMethodError) at clj-yaml.core/make-yaml (core.clj:126).
; org.yaml.snakeyaml.representer.Representer: method <init>()V not found
Code that generates the error:
(defn ^:private load-yaml [fileName]
  (-> fileName
      (io/resource)
      (slurp)
      (yaml/parse-string)))
The (yaml/parse-string) generates the error I’m using latest clj-commons/clj-yaml {:mvn/version "1.0.27"}, Version 1.0.26 works fine. Runtime code works fine.

Kiyanosh Kamdar22:09:08

By runtime, I mean running the application like:

exec java $JAVA_OPTS \
    -Dfile.encoding=UTF-8 \
    -Dclojure.debug=false \
    -jar /app/smoketests-standalone.jar

Kiyanosh Kamdar22:09:44

I’m using clj version Clojure CLI version 1.11.1.1165

lread22:09:41

Hi @U03EEEB90DV! Does this happen for all YAML you are trying to parse? Do you have a minimal YAML file that you can share so that we can try to reproduce your issue on our computers?

lread22:09:59

Without knowing more, it feels like there might be some library dependency conflict. Have you looked at your dependency tree? But, that said, share a minimal reproduction and we'll lend a hand.

Kiyanosh Kamdar15:09:29

HI @UE21H2HHD, Yes, I did look at the deps tree. I excluded an older version of snakeyaml, and the error is still there. The problem is, it doesn’t get to the yaml loading yet. It crashes before it parses the file.

Kiyanosh Kamdar15:09:44

it also works for 1.0.26.

Kiyanosh Kamdar15:09:03

would pasting in the deps tree help?

lread16:09:52

If you can share a small example we can easily run on our computers, we can help.

lread16:09:15

Otherwise we are just guessing

lread16:09:59

Is your project public and on github?

Kiyanosh Kamdar16:09:56

Unfortunately its not. I work for Viasat, and things are all internal. I provided the code above. ☝️ , and any old yaml will do. I can give you the config.clj that contains that code, I don’t think it has proprietary information in it. Would that be enough? Maybe a paired down deps.edn file as well. Would that work?

Kiyanosh Kamdar16:09:18

Let me do that. You may have to tweak things a little bit.

Kiyanosh Kamdar16:09:06

I used the same to reproduce

lread16:09:35

Coolio, I’ll take a peek later today.

lread20:09:19

> You may have to tweak things a little bit. Oh. You are asking too much of me here! simple_smile I need for you to give me something I can just run here from my computer.

Ingy döt Net23:09:51

In wanting to know how how to run clojure one liners using just java (not the clojure or clj wrappers) for clj-yaml things I made this little script: https://gist.github.com/ingydotnet/a443d9b9720a5429db7e22d1160e4eb8

slipset16:09:23

You should be doing that in babashka 🙂

Ingy döt Net18:09:53

Babashka is just an abstraction over Bash. I don't see how using it would help me better understand how Java was being invoked.

slipset18:09:30

That’s true, I just saw a bunch of sh which could have been clj.

Ingy döt Net18:09:29

When I look at Babashka I see a bunch of clj which could have been bash 😎

slipset18:09:51

I guess it’s all a question of perspective 🙂

Ingy döt Net18:09:42

But then again I've written large frameworks completely in Bash including a test framework and a packaging framework. So yeah.