Fork me on GitHub
#immutant
<
2017-03-09
>
thomas15:03:51

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 ( 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?

tcrawley16:03:44

@thomas Are you running this app inside WildFly?

tcrawley16:03:09

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?

tcrawley16:03:56

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

thomas16:03:00

it is a file

tcrawley16:03:49

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

tcrawley16:03:07

just as it would in an uberjar

thomas16:03:23

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

thomas16:03:41

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

thomas16:03:04

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

tcrawley16:03:24

can you share the full url you get back?

tcrawley16:03:12

or maybe a VFS path

thomas16:03:33

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

tcrawley16:03:11

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

thomas16:03:41

let me try

tcrawley16:03:05

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"))

thomas16:03:27

I guess I can treat it as stream...

thomas16:03:35

the lib I use next can take a stream

tcrawley16:03:43

ah, good deal

thomas16:03:52

compiling...

thomas16:03:28

ok that looks a lot better...

thomas16:03:44

but what is the standard port for wildfly?

tcrawley16:03:06

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

thomas16:03:19

hmmmm. it says it failed to start...

thomas16:03:29

but that is something for tomorrow.

tcrawley16:03:45

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

thomas16:03:49

Thank you for your help @tcrawley

tcrawley16:03:53

my pleasure!

thomas16:03:25

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

thomas16:03:27

🙂

tcrawley16:03:37

yay! progress! :)