clj-yaml

Kiyanosh Kamdar 2023-09-25T22:18:10.598229Z

@kiyanosh.kamdar has joined the channel

Kiyanosh Kamdar 2023-09-25T22:18:59.024189Z

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

Kiyanosh Kamdar 2023-09-25T22:19:21.471669Z

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 Kamdar 2023-09-25T22:20:08.969529Z

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 Kamdar 2023-09-25T22:20:44.028379Z

I’m using clj version Clojure CLI version 1.11.1.1165

lread 2023-09-25T22:30:41.006479Z

Hi @kiyanosh.kamdar! 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?

lread 2023-09-25T22:33:59.780089Z

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 Kamdar 2023-09-26T15:16:29.159329Z

HI @lee, 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 Kamdar 2023-09-26T15:16:44.408359Z

it also works for 1.0.26.

Kiyanosh Kamdar 2023-09-26T15:17:03.811749Z

would pasting in the deps tree help?

lread 2023-09-26T16:36:52.168029Z

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

lread 2023-09-26T16:37:15.561999Z

Otherwise we are just guessing

lread 2023-09-26T16:37:59.675339Z

Is your project public and on github?

Kiyanosh Kamdar 2023-09-26T16:39:56.412869Z

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 Kamdar 2023-09-26T16:48:18.908219Z

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

Kiyanosh Kamdar 2023-09-26T16:49:11.706679Z

Kiyanosh Kamdar 2023-09-26T16:50:27.694509Z

Kiyanosh Kamdar 2023-09-26T16:50:53.459109Z

Kiyanosh Kamdar 2023-09-26T16:51:06.183969Z

I used the same to reproduce

lread 2023-09-26T16:52:35.689839Z

Coolio, I’ll take a peek later today.

lread 2023-09-26T20:27:19.063089Z

> 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 Net 2023-09-25T23:58:51.021809Z

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

slipset 2023-09-26T16:51:23.247539Z

You should be doing that in babashka 🙂

Ingy döt Net 2023-09-26T18:14:53.261789Z

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

slipset 2023-09-26T18:15:30.177899Z

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

Ingy döt Net 2023-09-26T18:16:29.341139Z

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

slipset 2023-09-26T18:16:51.270449Z

I guess it’s all a question of perspective 🙂

Ingy döt Net 2023-09-26T18:17:42.276739Z

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