         (run-tests-with-format test-name-pattern)))
     (run-tests-with-format test-name-pattern)))
 
+(defn ensure-dynamic-classloader
+  []
+  (let [thread (Thread/currentThread)
+        cl (.getContextClassLoader thread)]
+    (when-not (instance? DynamicClassLoader cl)
+      (.setContextClassLoader thread (DynamicClassLoader. cl)))))
+
 (defn -main
   "Start Riemann. Loads a configuration file from the first of its args."
   ([]

            [cemerick.pomegranate :as pom]
            [clojure.java.io :as io]
            [clojure.tools.logging :refer :all])
  (:gen-class :name riemann.bin))

(def config-file

   (-main "start" config))
  ([command config & [test-name]]
   (logging/init)
   (ensure-dynamic-classloader)
   (case command
     "start" (try
               (info "PID" (pid))
