Question

I refactored my light webapp to now use Compojure. Everything works fine locally. However, my problem occurs when I deploy to Heroku. I'm trying to run it with lein ring server-headless $PORT, but am getting the error below. My Procfile is web: lein ring server-headless $PORT, due to this issue. But still no luck. Any ideas?

    2013-06-25T02:38:15.671118+00:00 heroku[web.1]: Starting process with command `lein ring server-headless 17731`
    2013-06-25T02:38:16.350715+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true -Djava.rmi.server.useCodebaseOnly=true
    2013-06-25T02:38:19.684531+00:00 app[web.1]:    at clojure.lang.Compiler.eval(Compiler.java:5440)
    2013-06-25T02:38:19.683953+00:00 app[web.1]: Exception in thread "main" java.io.FileNotFoundException: Could not locate leiningen/core/classpath__init.class or leiningen/core/classpath.clj on classpath:  (server.clj:1)
    2013-06-25T02:38:19.685445+00:00 app[web.1]:    at clojure.lang.RT.load(RT.java:381)
    2013-06-25T02:38:19.684682+00:00 app[web.1]:    at clojure.lang.Compiler.eval(Compiler.java:5415)
    2013-06-25T02:38:19.684956+00:00 app[web.1]:    at clojure.lang.RT.loadResourceScript(RT.java:340)
    2013-06-25T02:38:19.685581+00:00 app[web.1]:    at clojure.core$load$fn__4519.invoke(core.clj:4915)
    2013-06-25T02:38:19.684821+00:00 app[web.1]:    at clojure.lang.Compiler.load(Compiler.java:5857)
    2013-06-25T02:38:19.685221+00:00 app[web.1]:    at clojure.lang.RT.load(RT.java:409)
    2013-06-25T02:38:19.685714+00:00 app[web.1]:    at clojure.core$load.doInvoke(core.clj:4914)
    2013-06-25T02:38:19.685976+00:00 app[web.1]:    at clojure.core$load_one.invoke(core.clj:4729)
    2013-06-25T02:38:19.686270+00:00 app[web.1]:    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    2013-06-25T02:38:19.685089+00:00 app[web.1]:    at clojure.lang.RT.loadResourceScript(RT.java:331)
    2013-06-25T02:38:19.686403+00:00 app[web.1]:    at clojure.core$apply.invoke(core.clj:542)
    2013-06-25T02:38:19.685846+00:00 app[web.1]:    at clojure.lang.RestFn.invoke(RestFn.java:408)
    2013-06-25T02:38:19.686106+00:00 app[web.1]:    at clojure.core$load_lib.doInvoke(core.clj:4766)
    2013-06-25T02:38:19.686587+00:00 app[web.1]:    at clojure.core$load_libs.doInvoke(core.clj:4800)
    2013-06-25T02:38:19.686727+00:00 app[web.1]:    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    2013-06-25T02:38:19.686860+00:00 app[web.1]:    at clojure.core$apply.invoke(core.clj:544)
    2013-06-25T02:38:19.687027+00:00 app[web.1]:    at clojure.core$use.doInvoke(core.clj:4892)
    2013-06-25T02:38:19.687158+00:00 app[web.1]:    at clojure.lang.RestFn.invoke(RestFn.java:551)
    2013-06-25T02:38:19.687292+00:00 app[web.1]:    at leiningen.ring$eval68$loading__4414__auto____69.invoke(ring.clj:1)
    2013-06-25T02:38:19.687425+00:00 app[web.1]:    at leiningen.ring$eval68.invoke(ring.clj:1)
    2013-06-25T02:38:19.687557+00:00 app[web.1]:    at clojure.lang.Compiler.eval(Compiler.java:5424)
    ...

Was it helpful?

Solution

Ok, this problem cropped up in several places. This post (and this one) was informative.

I basically stumbled across the Heroku Buildpack: Clojure. This gives some interesting configuration directions. Specifically, I had to

  • set a minimum lein version. :min-lein-version "2.0.0"
  • require JDK 7 and echo "java.runtime.version=1.7" > system.properties
  • added the ring servlet lib: [ring/ring-servlet "1.2.0-RC1"]

And now everything is copasetic. Hope this helps someone.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top