Clojure-Contrib

clojure.java.classpath/system-classpath is incorrect when running in a classloader other than the application classloader

Details

  • Type: Defect Defect
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code

Description

Because system-classpath uses java.class.path, it doesn't work when running in a classloader other than the application classloader.

This happens when running in any container that uses a custom classloader (e.g. Jetty, Cake, TomCat).

The fix is to use (.getURLs (.getClassLoader clojure.lang.RT)) instead of (System/getProperty "java.class.path"). A patch is attached.

  1. system-classpath.diff
    07/Jul/11 1:43 PM
    3 kB
    Justin Balthrop
  2. system-classpath2.diff
    07/Jul/11 1:52 PM
    3 kB
    Justin Balthrop

Activity

Hide
Justin Balthrop added a comment -

Here is an updated patch with a fix for the system-classpath docstring as well.

Show
Justin Balthrop added a comment - Here is an updated patch with a fix for the system-classpath docstring as well.
Hide
Justin Balthrop added a comment -

Any update on this?

Show
Justin Balthrop added a comment - Any update on this?
Hide
Justin Balthrop added a comment - - edited

There is now a ticket in the CLASSPATH project for this (http://dev.clojure.org/jira/browse/CLASSPATH-1).

Show
Justin Balthrop added a comment - - edited There is now a ticket in the CLASSPATH project for this (http://dev.clojure.org/jira/browse/CLASSPATH-1).
Hide
Stuart Sierra added a comment -
Show
Stuart Sierra added a comment - CLASSPATH-1

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: