Has anyone successfully used Clojure 1.3 from the bootclasspath?

I ran into issues with Clojure 1.2 where you couldn't transitively
require from namespaces on the bootclasspath. So if you loaded
clojure.test, it wouldn't work unless you required clojure.template,
clojure.stacktrace, and the other libs they require separately first.

It looks like the problem is that RT.baseLoader() returns null. Any
class that's loaded by the boot classloader returns null when you call
.getClassLoader on it, so I suppose this is no surprise. I just don't
know if there's a way to call .getResource on the boot classloader,
which is what RT.load is trying to do.

This is more problematic in Clojure 1.3 than it was in 1.2 because in
1.2 you could load clojure.main since it didn't require any other
libs. So as long as you were careful to load things in the right order
you could work around the issue.

The only things needed from clojure.repl are stack-element-str and
root-cause. These are only needed from inside the clojure.main/repl
function. If we can't get clojure.lang.RT to play nicely with the boot
classloader, one possible band-aid would be to move clojure.main/repl
to clojure.repl and move the require out of the ns form into
clojure.main/repl-opt or something like that. Making the repl parts
required on-demand rather than on every invocation of clojure.main
would allow the workarounds that worked in 1.2 to continue to
function.

-Phil

ps. Here's the stack trace:

$ java -Xbootclasspath/a:clojure.jar clojure.main -e 1
Exception in thread "main" java.lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at clojure.lang.RT.loadClassForName(RT.java:1608)
        at clojure.lang.RT.load(RT.java:399)
        at clojure.lang.RT.load(RT.java:381)
        at clojure.core$load$fn__4395.invoke(core.clj:5298)
        at clojure.core$load.doInvoke(core.clj:5297)
        at clojure.lang.RestFn.invoke(RestFn.java:409)
        at clojure.core$load_one.invoke(core.clj:5122)
        at clojure.core$load_lib.doInvoke(core.clj:5159)
        at clojure.lang.RestFn.applyTo(RestFn.java:143)
        at clojure.core$apply.invokeStatic(core.clj:585)
        at clojure.core$load_libs.doInvoke(core.clj:5193)
        at clojure.lang.RestFn.applyTo(RestFn.java:138)
        at clojure.core$apply.invokeStatic(core.clj:585)
        at clojure.core$require.doInvoke(core.clj:5202)
        at clojure.lang.RestFn.invoke(RestFn.java:409)
        at clojure.lang.Var.invoke(Var.java:365)
        at clojure.main.main(main.java:36)
Caused by: java.lang.NullPointerException
        at clojure.lang.RT.load(RT.java:387)
        at clojure.lang.RT.load(RT.java:381)
        at clojure.core$load$fn__4395.invoke(core.clj:5298)
        at clojure.core$load.doInvoke(core.clj:5297)
        at clojure.lang.RestFn.invoke(RestFn.java:409)
        at clojure.core$load_one.invoke(core.clj:5122)
        at clojure.core$load_lib.doInvoke(core.clj:5159)
        at clojure.lang.RestFn.applyTo(RestFn.java:143)
        at clojure.core$apply.invokeStatic(core.clj:585)
        at clojure.core$load_libs.doInvoke(core.clj:5193)
        at clojure.lang.RestFn.applyTo(RestFn.java:138)
        at clojure.core$apply.invokeStatic(core.clj:587)
        at clojure.core$use.doInvoke(core.clj:5264)
        at clojure.lang.RestFn.invoke(RestFn.java:409)
        at clojure.main$loading__4294__auto__.invoke(main.clj:11)
        at clojure.main__init.load(Unknown Source)
        at clojure.main__init.<clinit>(Unknown Source)
        ... 19 more

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

Reply via email to