I'm attempting to start a swank-clojure session within a grails application. This part is easy and works fine. However, whenever I change a groovy class clojure does not see this change until I restart the jvm. I mucked around a bit with classlojure and pomegranate trying to figure out if I could shadow the default class loader to force clojure to relaod the groovy class files on demand, but at the moment it seems beyond me. I've heard of JRebel for reloading class files in an existing jvm and ran across a few posts where people have had success using JRebel to reload classes in clojure. I was able to get this to work with clojure 1.2.1 however I can't get it to work with clojure 1.3 or 1.4.
The simplest reproducible test case I could think of was just to start the repl as follows: java -javaagent:/Applications/ZeroTurnaround/JRebel/jrebel.jar -cp lib/clojure-1.4.0.jar clojure.main -r JRebel: Starting logging to file: /Users/kurtharriger/var/jrebel.log [2012-05-05 16:19:40] [2012-05-05 16:19:40] ############################################################# [2012-05-05 16:19:40] [2012-05-05 16:19:40] JRebel 4.6.2 (201205021440) [2012-05-05 16:19:40] (c) Copyright ZeroTurnaround OU, Estonia, Tartu. [2012-05-05 16:19:40] [2012-05-05 16:19:40] Over the last 1 days JRebel prevented [2012-05-05 16:19:40] at least 1 redeploys/restarts saving you about 0 hours. [2012-05-05 16:19:40] [2012-05-05 16:19:40] This product is licensed to Kurt Harriger (FullContact) [2012-05-05 16:19:40] until June 4, 2012 [2012-05-05 16:19:40] [2012-05-05 16:19:40] ************************************************************* [2012-05-05 16:19:40] Your license is about to EXPIRE! [2012-05-05 16:19:40] ************************************************************* [2012-05-05 16:19:40] [2012-05-05 16:19:40] This license will expire in 29 days and JRebel will [2012-05-05 16:19:40] stop working after that. Renew your license at: [2012-05-05 16:19:40] http://sales.zeroturnaround.com/?1338842936 [2012-05-05 16:19:40] [2012-05-05 16:19:40] The following plugins are disabled at the moment: [2012-05-05 16:19:40] * Apache MyFaces plugin (set -Drebel.myfaces_plugin=true to enable) [2012-05-05 16:19:40] Reloads JSF configuration and reconfigures managed beans. [2012-05-05 16:19:40] * Click plugin (set -Drebel.click_plugin=true to enable) [2012-05-05 16:19:40] Reloads menu.xml menu definitions of Apache Click projects. [2012-05-05 16:19:40] * JRuby Plugin (set -Drebel.jruby_plugin=true to enable) [2012-05-05 16:19:40] * Jersey plugin (set -Drebel.jersey_plugin=true to enable) [2012-05-05 16:19:40] Reloads Jersey configuration from Java annotations. [2012-05-05 16:19:40] * Oracle ADF Core plugin (set -Drebel.adf_core_plugin=true to enable) [2012-05-05 16:19:40] JRebel ADF Core Plugin [2012-05-05 16:19:40] * Oracle ADF Faces plugin (set -Drebel.adf_faces_plugin=true to enable) [2012-05-05 16:19:40] JRebel ADF Faces Plugin [2012-05-05 16:19:40] * Seam-Wicket plugin (set -Drebel.seam_wicket_plugin=true to enable) [2012-05-05 16:19:40] Integration with load time weaving seam annotations to wicket classes [2012-05-05 16:19:40] (-javaagent:<path-to-jboss-seam-wicket-jar>) [2012-05-05 16:19:40] * WebObjects plugin (set -Drebel.webobjects_plugin=true to enable) [2012-05-05 16:19:40] WebObjects JRebel Plugin [2012-05-05 16:19:40] [2012-05-05 16:19:40] ############################################################# [2012-05-05 16:19:40] Exception in thread "main" java.lang.ExceptionInInitializerError at clojure.main.<clinit>(main.java:20) Caused by: java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/first, compiling:(clojure/core.clj:55) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6462) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.access$100(Compiler.java:37) at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:518) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6455) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.analyze(Compiler.java:6223) at clojure.lang.Compiler.eval(Compiler.java:6515) at clojure.lang.Compiler.load(Compiler.java:6952) at clojure.lang.RT.loadResourceScript(RT.java:359) at clojure.lang.RT.loadResourceScript(RT.java:350) at clojure.lang.RT.load(RT.java:429) at clojure.lang.RT.load(RT.java:400) at clojure.lang.RT.doInit(RT.java:436) at clojure.lang.RT.<clinit>(RT.java:318) ... 1 more Caused by: java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/first at clojure.lang.Var$Unbound.throwArity(Var.java:43) at clojure.lang.AFn.invoke(AFn.java:39) at clojure.core$fn.doInvoke(core.clj:3999) at clojure.lang.RestFn.invoke(RestFn.java:490) at clojure.lang.Var.invoke(Var.java:431) at clojure.lang.AFn.applyToHelper(AFn.java:178) at clojure.lang.Var.applyTo(Var.java:532) at clojure.lang.Compiler.macroexpand1(Compiler.java:6366) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6441) ... 15 more If I remove jrebel agent it works fine: java -cp lib/clojure-1.4.0.jar clojure.main -r Clojure 1.4.0 user=> However JRebel does work with clojure 1.2.1 java -javaagent:/Applications/ZeroTurnaround/JRebel/jrebel.jar -cp /Users/kurtharriger/.m2/repository/org/clojure/clojure/1.2.1/clojure-1.2.1.jar clojure.main -r [2012-05-05 17:06:29] [2012-05-05 17:06:29] ############################################################# [2012-05-05 17:06:29] [2012-05-05 17:06:29] JRebel 4.6.2 (201205021440) [2012-05-05 17:06:29] (c) Copyright ZeroTurnaround OU, Estonia, Tartu. [2012-05-05 17:06:29] [2012-05-05 17:06:29] Over the last 1 days JRebel prevented [2012-05-05 17:06:29] at least 1 redeploys/restarts saving you about 0 hours. [2012-05-05 17:06:29] [2012-05-05 17:06:29] This product is licensed to Kurt Harriger (FullContact) [2012-05-05 17:06:29] until June 4, 2012 [2012-05-05 17:06:29] [2012-05-05 17:06:29] ************************************************************* [2012-05-05 17:06:29] Your license is about to EXPIRE! [2012-05-05 17:06:29] ************************************************************* [2012-05-05 17:06:29] [2012-05-05 17:06:29] This license will expire in 29 days and JRebel will [2012-05-05 17:06:29] stop working after that. Renew your license at: [2012-05-05 17:06:29] http://sales.zeroturnaround.com/?1338842936 [2012-05-05 17:06:29] [2012-05-05 17:06:29] The following plugins are disabled at the moment: [2012-05-05 17:06:29] * Apache MyFaces plugin (set -Drebel.myfaces_plugin=true to enable) [2012-05-05 17:06:29] Reloads JSF configuration and reconfigures managed beans. [2012-05-05 17:06:29] * Click plugin (set -Drebel.click_plugin=true to enable) [2012-05-05 17:06:29] Reloads menu.xml menu definitions of Apache Click projects. [2012-05-05 17:06:29] * JRuby Plugin (set -Drebel.jruby_plugin=true to enable) [2012-05-05 17:06:29] * Jersey plugin (set -Drebel.jersey_plugin=true to enable) [2012-05-05 17:06:29] Reloads Jersey configuration from Java annotations. [2012-05-05 17:06:29] * Oracle ADF Core plugin (set -Drebel.adf_core_plugin=true to enable) [2012-05-05 17:06:29] JRebel ADF Core Plugin [2012-05-05 17:06:29] * Oracle ADF Faces plugin (set -Drebel.adf_faces_plugin=true to enable) [2012-05-05 17:06:29] JRebel ADF Faces Plugin [2012-05-05 17:06:29] * Seam-Wicket plugin (set -Drebel.seam_wicket_plugin=true to enable) [2012-05-05 17:06:29] Integration with load time weaving seam annotations to wicket classes [2012-05-05 17:06:29] (-javaagent:<path-to-jboss-seam-wicket-jar>) [2012-05-05 17:06:29] * WebObjects plugin (set -Drebel.webobjects_plugin=true to enable) [2012-05-05 17:06:29] WebObjects JRebel Plugin [2012-05-05 17:06:29] [2012-05-05 17:06:29] ############################################################# [2012-05-05 17:06:29] Clojure 1.2.1 user=> Has anyone had any success using JRebel with clojure 1.3+? or perhaps any ideas how I might go about reloading class files dynamically without JRebel? Thanks -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en