immutant

http://immutant.org Note: dev discussion happens in #immutant on FreeNode IRC.
thomas 2017-03-09T15:36:51.250913Z

Hello lovely people... I am in the process of upgrading our app form a very old version of immutant (1.x.x) to version 2.x and running into a weird problem. in our code we do a (.getPath (<http://clojure.java.io/resource|clojure.java.io/resource> filename)) and on the 1.x version this points to the right files... on the version 2.x it goes to /content/.../.../... and we are getting a FileNotFoundExp Any idea what we are doing wrong here?

2017-03-09T16:09:44.776075Z

@thomas Are you running this app inside WildFly?

2017-03-09T16:10:09.781985Z

and what are you wanting to do with the resource? do you have to have it as a file? or will reading it as an inputstream suffice?

2017-03-09T16:10:56.794104Z

under 1.x, your app was exploded to a directory. Under 2.x, it is a jar, so io/resource will give back a jar url, if I remember correctly

thomas 2017-03-09T16:12:53.826872Z

I am now

thomas 2017-03-09T16:13:00.828732Z

it is a file

2017-03-09T16:13:49.841698Z

under Wildfly, it won't be a file though - it will be an entry in a jar file

thomas 2017-03-09T16:13:57.843827Z

yes.

2017-03-09T16:14:07.846092Z

just as it would in an uberjar

thomas 2017-03-09T16:14:23.850515Z

I have seen that... but even then the path start with /content/.../...

thomas 2017-03-09T16:14:41.855055Z

it is a jar in a jar that has the file in it

thomas 2017-03-09T16:15:04.861461Z

most of the path is correct... just the first bit of it is wrong

2017-03-09T16:15:24.866566Z

can you share the full url you get back?

2017-03-09T16:16:12.879154Z

or maybe a VFS path

2017-03-09T16:16:26.882570Z

true

thomas 2017-03-09T16:18:33.918517Z

doh.. I can't seem to copy and paste the path from the virtualbox... 😞

2017-03-09T16:20:11.944195Z

no worries - if you (str url), does it start with vfs: or jar:?

thomas 2017-03-09T16:21:41.969265Z

let me try

2017-03-09T16:24:05.006828Z

Either way, it doesn't really matter I guess - if you have to treat it as a file, you'll have to write the jarentry out as one: (io/copy (io/input-stream (io/resource filename)) (io/file "/some/tmp/path"))

thomas 2017-03-09T16:25:27.028707Z

I guess I can treat it as stream...

thomas 2017-03-09T16:25:35.031011Z

the lib I use next can take a stream

2017-03-09T16:25:43.033080Z

ah, good deal

thomas 2017-03-09T16:28:52.086042Z

compiling...

thomas 2017-03-09T16:30:28.114082Z

ok that looks a lot better...

thomas 2017-03-09T16:30:44.118769Z

but what is the standard port for wildfly?

2017-03-09T16:31:06.125003Z

by default, it binds to localhost:8080, same as immutant 1.x

thomas 2017-03-09T16:32:19.146656Z

hmmmm. it says it failed to start...

thomas 2017-03-09T16:32:29.149246Z

but that is something for tomorrow.

2017-03-09T16:32:45.153961Z

let us know how it goes, we're here to help

thomas 2017-03-09T16:32:49.155004Z

Thank you for your help @tcrawley

2017-03-09T16:33:53.172388Z

my pleasure!

thomas 2017-03-09T16:35:25.197192Z

just restarted the wildfly server and now i get a 404 at least

thomas 2017-03-09T16:35:27.197514Z

🙂

2017-03-09T16:35:37.200367Z

yay! progress! :)