Fork me on GitHub
#immutant
<
2016-03-24
>
edvorg10:03:40

War is created by lein-immutant

edvorg11:03:07

https://github.com/juxt/joplin/blob/v0.2.5/joplin.core/src/joplin/core.clj#L83 (classpath/classpath-jarfiles) returns empty collection so this code can't find any migrations have anybody managed to make this function work under wildfly?

tcrawley12:03:49

@edvorg: can you get the output of (clojure.java.classpath/classpath)?

edvorg14:03:26

Hello @tcrawley . I'm sorry for the delay. This function gives me only some system-wide and wildfly jars

(#object[java.io.File 0x28ddc6d6 "/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/src.zip"] #object[java.io.File 0x6ae2c1bd "/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/lib/tools.jar"] #object[java.io.File 0x2beaf450 "/Users/edvorg/Documents/raven/scripts/deploy/wildfly-10.0.0.Final/jboss-modules.jar"] #object[java.io.File 0x4770e765 "/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/cldrdata.jar"] #object[java.io.File 0x1dd722b "/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/dnsns.jar"] #object[java.io.File 0x7dceb484 "/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/jaccess.jar"] #object[java.io.File 0x1fa9719 "/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/jfxrt.jar"] #object[java.io.File 0x4171038c "/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/localedata.jar"] #object[java.io.File 0x2bd76da3 "/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/nashorn.jar"] #object[java.io.File 0x233586c9 "/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/sunec.jar"] #object[java.io.File 0x76229fe9 "/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar"] #object[java.io.File 0x3f869fc2 "/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar"] #object[java.io.File 0x2f2c47e4 "/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/zipfs.jar"] #object[java.io.File 0x20a09f06 "/System/Library/Java/Extensions/AppleScriptEngine.jar"] #object[java.io.File 0x421f912c "/System/Library/Java/Extensions/dns_sd.jar"] #object[java.io.File 0x49ec6e22 "/System/Library/Java/Extensions/j3daudio.jar"] #object[java.io.File 0x432039c "/System/Library/Java/Extensions/j3dcore.jar"] #object[java.io.File 0x204ef4b3 "/System/Library/Java/Extensions/j3dutils.jar"] #object[java.io.File 0x1e669767 "/System/Library/Java/Extensions/jai_codec.jar"] #object[java.io.File 0x345167f7 "/System/Library/Java/Extensions/jai_core.jar"] #object[java.io.File 0x20ebac02 "/System/Library/Java/Extensions/libAppleScriptEngine.jnilib"] #object[java.io.File 0x77573fc0 "/System/Library/Java/Extensions/libJ3D.jnilib"] #object[java.io.File 0x5d2053e2 "/System/Library/Java/Extensions/libJ3DAudio.jnilib"] #object[java.io.File 0x62f1e96e "/System/Library/Java/Extensions/libJ3DUtils.jnilib"] #object[java.io.File 0x1f87c28e "/System/Library/Java/Extensions/libmlib_jai.jnilib"] #object[java.io.File 0x51605781 "/System/Library/Java/Extensions/mlibwrapper_jai.jar"] #object[java.io.File 0xe80a10c "/System/Library/Java/Extensions/MRJToolkit.jar"] #object[java.io.File 0x6357832b "/System/Library/Java/Extensions/vecmath.jar"] #object[java.io.File 0x42e5ae7d "/usr/lib/java/libjdns_sd.jnilib"])
I don't see our application jar in this list.. Do you have an idea how could we fix it?

tcrawley14:03:24

we had http://dev.clojure.org/jira/browse/CLASSPATH-5 added to address this specifically, but it may be the case that we didn't ever implement the URLClasspath protocol in Immutant

tcrawley14:03:28

checking on that now

tcrawley14:03:06

@edvorg: what version of Immutant are you using?

tcrawley14:03:04

we extend the URLClassloader protocol in 2.1.0 and newer

tcrawley14:03:16

@edvorg: I can recreate it here. I'll need to do some digging

edvorg15:03:19

Any help is needed from my side? I can try to create a minimal project demonstrating an issue..

tcrawley15:03:50

no, but thanks! I have a minimal project already

edvorg15:03:04

ah, nice, thanks

tcrawley16:03:39

@edvorg: I have a workaround for you, but first, some background why this is happening

tcrawley16:03:36

inside WildFly, the jars inside the war are never extracted to disk, so they aren't Files, which is why they aren't visible to java.classpath

tcrawley16:03:56

we can make them files, though, by deploying the war file exploded

tcrawley16:03:25

to do that, you would create a foo.war/ dir in $WILDFLY_HOME/standalone/deployments/

tcrawley16:03:54

then unzip foo.war inside the foo.war/ directory

tcrawley16:03:23

then touch $WILDFLY_HOME/standalone/deployments/foo.war.dodeploy

tcrawley16:03:40

that will cause the jars in the war to be treated as files

tcrawley16:03:53

but, there is a bug in Immutant that prevents them from being visible

tcrawley16:03:05

so you have to patch a function inside immutant, like so:

tcrawley16:03:32

(defn -main [& args]
  (alter-var-root #'immutant.wildfly/vfs->file
    (constantly
      (fn [url]
        (if-let [match (and url (re-find #"^vfs(:.*)/?" (.toExternalForm url)))]
          (URL. (str "file" (last match)))
          url))))
  (pp/pprint (cp/classpath)))

tcrawley16:03:59

alternatively, if there is a way to give joplin a list of the migrations, you could io/resource each one to create a list of resource urls

edvorg16:03:49

@tcrawley: Thank you very much for your rapid help! We will try that soon

edvorg19:03:20

@tcrawley: Thank you once more, it helped