Fork me on GitHub
#clojure
<
2023-01-12
>
Sam Ritchie20:01:57

huh, TIL that (conj <map> <map>) returns acts like merge

borkdude20:01:48

merge itself uses conj under the hood

Sam Ritchie20:01:09

curious, why would one prefer this?

Andrew Huggins20:01:43

anyone using #clerk I am trying to run the example at clerk/dev/user.clj, but when I try to cider clj jack in I get the following error :

{:clojure.main/message
 "Execution error (FileNotFoundException) at java.io.FileInputStream/open0 (FileInputStream.java:-2).\n-Sdeps (No such file or directory)\n",
 :clojure.main/triage
 {:clojure.error/class java.io.FileNotFoundException,
  :clojure.error/line -2,
  :clojure.error/cause "-Sdeps (No such file or directory)",
  :clojure.error/symbol java.io.FileInputStream/open0,
  :clojure.error/source "FileInputStream.java",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type java.io.FileNotFoundException,
    :message "-Sdeps (No such file or directory)",
    :at [java.io.FileInputStream open0 "FileInputStream.java" -2]}],
  :trace
  [[java.io.FileInputStream open0 "FileInputStream.java" -2]
   [java.io.FileInputStream open "FileInputStream.java" 216]
   [java.io.FileInputStream <init> "FileInputStream.java" 157]
   [java.io.FileInputStream <init> "FileInputStream.java" 111]
   [clojure.lang.Compiler loadFile "Compiler.java" 7575]
   [clojure.main$load_script invokeStatic "main.clj" 475]
   [clojure.main$script_opt invokeStatic "main.clj" 535]
   [clojure.main$script_opt invoke "main.clj" 530]
   [clojure.main$main invokeStatic "main.clj" 664]
   [clojure.main$main doInvoke "main.clj" 616]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.main main "main.java" 40]],
  :cause "-Sdeps (No such file or directory)"}}
I have installed babashka, but feel like I might be missing other dependencies. Thanks in advance for any advice.

👀 1
ghadi20:01:59

hey, please use snippets when posting long trace

ghadi20:01:05

CMD-shift-enter

borkdude20:01:50

:clojure.error/cause "-Sdeps (No such file or directory)"
This looks like you're not invoking the clojure CLI correctly

p-himik20:01:15

Also, for future reference, that "hashtag" is actually a link - a dedicated channel for Clerk where such questions should go first.

Andrew Huggins20:01:18

thanks for the advice, I will look at using clojure CLI.

borkdude20:01:28

Perhaps you have an old or invalid version of clj installed. Can you post the output of clj --version?

borkdude20:01:33

or clojure --version

Andrew Huggins20:01:03

clojure --version Execution error (FileNotFoundException) at http://java.io.FileInputStream/open0 (FileInputStream.java:-2). --version (No such file or directory) Full report at: /tmp/clojure-329137397675565149.edn

Andrew Huggins20:01:16

Looks like my clojure install has issues

borkdude20:01:02

which OS are you on?

borkdude20:01:48

this is what you should follow to install clojure: https://clojure.org/guides/install_clojure make sure you remove any older/other clojure thing in your environment

Andrew Huggins20:01:20

ok, will do. Thanks for the help.

sun-one22:01:52

I have an issue with a dynamic variable when compiling code. I'm getting the following error:

#15 335.1 Done in 1221ms.
#15 356.2 Execution error (IllegalAccessError) at gen-fhi.resource-providers.postgres.core/loading (core.clj:1).
#15 356.2 *nested-tx* does not exist
*nested-tx* is a dynamic variable used in next.jdbc to configure nested transaction behavior. My require statements on the file are as follows (note line 3 is where the issue is occurring):
(ns gen-fhi.resource-providers.postgres.core
  (:require [next.jdbc :as jdbc]
            [next.jdbc.transaction :refer [*nested-tx*]]
            [hugsql.core :as hugsql]
            [hugsql.adapter.next-jdbc :as next-adapter]
            [clj-json-patch.core :as patch]
            [clojure.core.match :refer [match]]
            [clojure.string :as string]
            [honey.sql :as hsql]
            [honey.sql.helpers :refer [where]]
            [loom.graph :as graph]
            [loom.alg :as alg]

            [gen-fhi.resource-providers.transactions :as bundle-transaction]
            [gen-fhi.resource-providers.util :refer [param-value->param-value-map]]
            [gen-fhi.operation-outcome.core :as oo]
            [gen-fhi.resource-providers.postgres.extensions]
            [ :refer [WSDataHandler get-patches-after]]
            [gen-fhi.fhir-client.protocols :refer [Client] :as fdb]
            [gen-fhi.fhirpath.core :as fp]))
Strangely this error is only occurring during compilation inside of a dockerfile (not compilation outside of it which works as expected). Though I'm not sure what difference between the two would cause this issue. My clojure versions are the same between dockerfile and my native environment and compilation has worked fine up until adding this import of dynamic variable nested-tx. Deps are getting installed and deps unrelated to that dynamic variable get resolved (commenting that line out and removing the line where I bind the variable leads to successful compilation). My only guess at this point would be a difference in java versions between my native environment and docker is causing the issue?

p-himik23:01:29

*nested-tx* appeared only in 1.1.547. Which makes me think that maybe somehow the classpath inside your container is different. Maybe different aliases are used, maybe something else is off.

p-himik23:01:42

Should be easy enough to check.

sun-one23:01:51

That makes sense, I'll check the classpath in the docker build .

sun-one23:01:00

There are two versions of next.jdbc (in both native environment and on docker). I'm guessing in docker it's resolving to the wrong version (prev version before nested-tx seancorfield/next.jdbc/1.0.7/) I'll need to figure out why next.jdbc is getting installed twice. Does the clj cli tool have a way to show a dep tree? searching my repo this appears to be a transitive dependency.

sun-one00:01:47

Ah nvm I think. I found it clj -X:deps tree

sun-one00:01:34

It's working! thanks for the help @U2FRKM4TW! I had two next.jdbc packages and the lib was getting resolved differently between the two environments (my guess would be this is caused by different java versions). I bumped the package that had the transitive dependency to the outdated next.jdbc.

👍 2