Fork me on GitHub
#clojure
<
2023-04-12
>
hkjels08:04:25

I'm experiencing an issue in one of our projects at work with running on WSL. If I use ns-publics on various namespaces, I can see that they are loaded and everything looks fine, but if I run use on said namespaces with :reload I get Could not locate blahblah on classpath. This is not an issue when running natively on Windows. Any ideas what can be wrong?

borkdude08:04:18

You don't need to use use with :reload btw, you can just use use once and then use (require '[foo] :reload)

hkjels08:04:44

That was there way before my time 🙂 require yields the same error-message

borkdude08:04:57

just the single require + reload, right?

borkdude08:04:09

and what is "blablah"?

hkjels08:04:16

`Execution error (FileNotFoundException) at repl/eval39609 (REPL:1). Could not locate openid/core__init.class, openid/core.clj or openid/core.cljc on classpath.`

borkdude08:04:00

Is this WSL1 or WSL2?

hkjels08:04:34

windows 10

hkjels08:04:29

or.. output of wsl.exe --version shows: WSL-versjon: 1.1.6.0 but that is the version of the cli I guess

hkjels08:04:44

I'm pretty sure it's running wsl2 with wslg

hkjels08:04:41

* Ubuntu Running 2

borkdude08:04:16

Does this work for you?

user=> (require '[clojure.set] :reload)
nil

borkdude08:04:20

It does for me in WSL2

hkjels08:04:15

that works

hkjels08:04:36

external dependencies does not

borkdude08:04:34

if you can make a repro I could test this later today on my windows machine, gotta go out now

hkjels08:04:44

it is like everything is loaded into memory, but everything on the classpath is blown away after I reach the repl prompt

hkjels08:04:39

target looks suspiciously empty, but it's the same for the windows build.

hiredman15:04:29

How is it getting loaded the first time?

hiredman16:04:47

My guess is you have something that is scanning the filesystem for .clj files, and then just feeding the contents to eval (rather than loading via require)

hiredman16:04:45

Which would create the namespaces in your ns forms, even if those didn't match the file paths, which they have to do for require to work

hiredman16:04:58

And maybe a reason files and namespaces match under windows, but not match in wsl is file case sensitivity

vemv18:04:57

This case piqued my interest even if it's solved by now. If I specified org.clojure/data.xml {:mvn/version "0.0.8"} instead of org.clojure/data.xml {:mvn/version "0.2.0-alpha8"} in a project that performed (:import clojure.data.xml.node.Element) , the underlying java execution would immediately exit, with no error message. Would happen both under Lein and tools.deps. I found it pretty surprising behavior for java - shouldn't one at least get an error message? (I recall at least one other way of triggering similar behavior: specifying a non-existing lib under the agentpath)

hiredman18:04:10

% clj  -Sdeps '{:deps {org.clojure/data.xml {:mvn/version "0.0.8"}}}' -M -e "(import 'clojure.data.xml.node.Element)"

Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (URLClassLoader.java:445).
clojure.data.xml.node.Element

Full report at:
/tmp/clojure-2092397417642504981.edn
zsh: exit 1     clj -Sdeps '{:deps {org.clojure/data.xml {:mvn/version "0.0.8"}}}' -M -e
%
seems like you have something else going on

rossputin19:04:29

Hi all - I’m hoping someone can point me to an example of passing state into pedestal so it will be available in all functions associated with routes - tutorials or docs etc - thanks!

javahippie19:04:16

You might get a better response over in #C0K65B20P

rossputin19:04:52

Ah - thanks - had not guessed there might be a channel for it - will re-post