I was in the process of porting our clojure code base to work with SVN head when I came across the following behavior. It turns out that the upgrade to head broke our user.clj. If user.clj is broken, and you invoke clojure.lang.Script from the command line (or from an ant build process, or you reset the enclojure REPL), then the class initialization of clojure.lang.RT fails. But because the first reference to RT in Script is inside a try block, execution passes to the finally block, which tries to reference RT again, resulting in a baffling NoClassDefFoundError. The right thing for Script to do would be to throw the exception generated from the loading of user.clj. Getting this behavior is as easy as referencing RT from outside a try block in Script.java.
The following patch demonstrates one way to do this, but there may be a more idiomatic way. With this patch, instead of the following exception: Exception in thread "main" java.lang.NoClassDefFoundError at clojure.lang.Script.main(Script.java:71) ...now we get this exception: Exception in thread "main" java.lang.ExceptionInInitializerError at clojure.lang.Script.<clinit>(Script.java:52) Caused by: java.lang.RuntimeException: java.lang.Exception: Name conflict, can't def format because namespace: clojure.contrib.lib refers to:#=(var clojure/format) (lib.clj:170) at clojure.lang.RT.<clinit>(RT.java:324) ... 1 more Caused by: java.lang.Exception: Name conflict, can't def format because namespace: clojure.contrib.lib refers to:#=(var clojure/ format) (lib.clj:170) ... at snowtide_util_user.eval__2487.invoke(user.clj:6) ... rhickey: does cemerick's CA cover employees of his company? If not, then I can send you one. Will Morgan --- src/jvm/clojure/lang/Script.java 2008-10-27 16:33:43.000000000 -0400 +++ Script.java 2008-10-27 16:33:41.000000000 -0400 @@ -49,6 +49,8 @@ */ public class Script{ +private static final Var out = RT.OUT; + public static void main(String[] args) throws Exception{ try { @@ -68,7 +70,7 @@ } finally { - OutputStreamWriter w = (OutputStreamWriter) RT.OUT.get(); + OutputStreamWriter w = (OutputStreamWriter)out.get(); try { w.flush(); --~--~---------~--~----~------------~-------~--~----~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---