immutant

http://immutant.org Note: dev discussion happens in #immutant on FreeNode IRC.
edvorg 2016-03-24T10:55:40.000244Z

War is created by lein-immutant

edvorg 2016-03-24T11:40:07.000246Z

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?

edvorg 2016-03-24T11:43:49.000248Z

Implementation of classpath-jarfiles https://github.com/clojure/java.classpath/blob/master/src/main/clojure/clojure/java/classpath.clj#L87

2016-03-24T12:54:49.000250Z

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

edvorg 2016-03-24T14:22:26.000251Z

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?

2016-03-24T14:38:24.000253Z

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

2016-03-24T14:38:28.000254Z

checking on that now

2016-03-24T14:40:06.000255Z

@edvorg: what version of Immutant are you using?

2016-03-24T14:41:04.000256Z

we extend the URLClassloader protocol in 2.1.0 and newer

edvorg 2016-03-24T14:41:54.000257Z

2.1.0

2016-03-24T14:59:16.000258Z

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

edvorg 2016-03-24T15:00:19.000259Z

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

2016-03-24T15:00:50.000260Z

no, but thanks! I have a minimal project already

edvorg 2016-03-24T15:01:04.000261Z

ah, nice, thanks

2016-03-24T16:41:39.000262Z

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

2016-03-24T16:42:36.000263Z

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

2016-03-24T16:42:56.000264Z

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

2016-03-24T16:43:25.000265Z

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

2016-03-24T16:43:54.000266Z

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

2016-03-24T16:44:23.000267Z

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

2016-03-24T16:44:40.000268Z

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

2016-03-24T16:44:53.000269Z

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

2016-03-24T16:45:05.000270Z

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

2016-03-24T16:45:32.000271Z

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

2016-03-24T16:46:59.000273Z

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

edvorg 2016-03-24T16:47:49.000274Z

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

edvorg 2016-03-24T19:55:20.000275Z

@tcrawley: Thank you once more, it helped