Permalink
Browse files

Load tools.reader at run-time instead of compile-time [IMMUTANT-240]

We need to do this because codecs.clj gets loaded by the
ModuleClassLoader for the common module, which can't see the
deployment's CL that provides clojure. Clojure calls getClass() on the
current CL for every import, which won't work for clojure.lang.* from
the common module CL.
  • Loading branch information...
1 parent c9837b7 commit c94257f1c4d942565c1eebcfa3229632497ae662 @tobias tobias committed Mar 11, 2013
@@ -28,7 +28,12 @@
<resource-root path="${project.artifactId}.jar"/>
<resource-root path="immutant-common.jar"/>
<resource-root path="tools.logging.jar"/>
- <resource-root path="tools.reader.jar"/>
+ <!--
+ tools.reader imports clojure.lang.RT, and an gen-classed Exception class, so has to
+ be able to find the clojure classes, which only exist in the deployment ClassLaoder,
+ so we don't load it as a resource-root here, and add it directly to each deployment's
+ effective classpath in AppDependenciesProcessor instead.
+ <resource-root path="tools.reader.jar"/> -->
<resource-root path="cheshire.jar"/>
<resource-root path="jackson-core.jar"/>
<resource-root path="jackson-dataformat-smile.jar"/>
@@ -92,7 +92,11 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro
//mount the runtime jar
mounter.mount( findInModulePath( "org/immutant/core/main/immutant-runtime-impl.jar" ), false );
-
+
+ // tools.reader imports clojure.lang.RT, and an gen-classed Exception class, so has to
+ // be able to find the clojure classes, which only exist in the deployment ClassLaoder,
+ // so we don't load it as a resource-root in the common module, and add it here instead.
+ mounter.mount(findInModulePath("org/immutant/common/main/tools.reader.jar"), false);
} catch (Exception e) {
throw new DeploymentUnitProcessingException( e );
}

0 comments on commit c94257f

Please sign in to comment.