Closed devth closed 11 years ago
This project is pretty far out of date. I'll add a note to the README and deprecate the repository.
Try creating a project with lein new compojure <project name>
instead.
Thanks. Generated the new project, which ran fine, moved the config and "hello world" handler into my existing app and hit the same StackOverflowError
.
I just used lein pedantic
to resolve a bunch of transitive dependency issues, but that didn't help. My deps are:
[
[org.clojure/clojure "1.4.0"],
; TODO - kill this some day. We're only relying on it for
; cond-let at this point.
[org.clojure/clojure-contrib "1.2.0"]
[org.clojars.adamwynne/http.async.client "0.4.1"
:exclusions [com.ning/async-http-client]]
[org.apache.commons/commons-lang3 "3.1"]
[robert/hooke "1.3.0"]
[clj-campfire "1.0.0"]
[clj-time "0.4.4"]
[org.clojure/data.json "0.1.2"]
[org.clojure/tools.namespace "0.2.2"]
[org.clojure/java.classpath "0.2.0"]
[org.clojure/core.cache "0.6.2"]
[org.clojure/tools.logging "0.2.3"]
[clj-logging-config "1.9.7"]
[log4j/log4j "1.2.16" :exclusions [javax.mail/mail
javax.jms/jms
com.sun.jdmk/jmxtools
com.sun.jmx/jmxri]]
[evaljs "0.1.2"]
[clj-ssh "0.4.0" :exclusions [slingshot]]
[useful "0.8.3-alpha8"]
[clj-wordnik "0.1.0-alpha1"]
[tentacles "0.2.2"]
[clj-http "0.5.5"
:exclusions [org.apache.httpcomponents/httpclient
org.apache.httpcomponents/httpcore
slingshot
commons-codec]]
[org.clojure/data.xml "0.0.6"]
[org.clojure/data.zip "0.1.1"]
[clj-aws-s3 "0.3.2"]
[overtone/at-at "1.0.0"]
[com.draines/postal "1.9.0"]
[twitter-api "0.6.12" :exclusions [org.apache.httpcomponents/httpcore]]
[inflections "0.7.3"]
[environ "0.3.0"]
[com.bigml/closchema "0.1.8"]
[org.clojure/java.jdbc "0.2.3"]
[mysql/mysql-connector-java "5.1.6"]
[cheshire "5.0.1"]
;;; [incanter "1.4.0"]
[compojure "1.1.5"]
;;; [lib-noir "0.3.4" :exclusions [[org.clojure/tools.namespace]]]
]
And using :plugins [[lein-ring "0.8.0"]]
Actually, new stacktrace is slightly different. The previous stacktrace was when using compojure 1.1.4.
Exception in thread "main" java.lang.StackOverflowError
at clojure.lang.Util.equiv(Util.java:32)
at clojure.lang.PersistentHashMap$BitmapIndexedNode.find(PersistentHashMap.java:615)
at clojure.lang.PersistentHashMap$ArrayNode.find(PersistentHashMap.java:378)
at clojure.lang.PersistentHashMap.valAt(PersistentHashMap.java:153)
at clojure.lang.PersistentHashMap.valAt(PersistentHashMap.java:157)
at clojure.lang.RT.get(RT.java:634)
...etc
I think I'd need to see the full stack trace or the code that's generating the error in order to diagnose the problem.
Edit: looks like stacktrace was too long for github comment. Moving to gist:
https://gist.github.com/4560755
project.clj:
:ring {:handler yetibot.webapp.server/app}
src/yetibot/webapp/server.clj:
(ns yetibot.webapp.server
(:use compojure.core)
(:require [compojure.handler :as handler]
[compojure.route :as route]))
(defroutes app-routes
(GET "/" [] "Hello World")
(route/not-found "Not Found"))
(def app
(handler/site app-routes))
It looks as if you might have a circular dependency in your source code. Could you check to see whether that's the case?
I rm'd all code out src
except my webapp dir and it runs. The thing I don't understand is - why does it matter what else I have in src
? Does lein ring
load all namespaces itself? That may be the problem if so, because I dynamically load namespaces already from my -main
.
The wrap-load
middleware looks at the ns
declarations at the top of each file and constructs a tree of dependencies. So if A requires B, and you modify B, it knows to reload B and then A.
That it's stack overflowing suggests you might have a circular dependency in your source files, e.g. A requires B requires C requires A again.
It ended up being two problems:
Thanks for your help, @weavejester. Much appreciated.
It might be an idea to add a better check for circular dependencies, even if they shouldn't be in the source to begin with.
That would be very helpful. This was my first Clojure project, so remnants of having no idea what I was doing still lurk in my codebase. Also, Clojure's error messages are the worst!
I'm getting a
StackOverflowError
when runninglein ring server
, ending withSubprocess failed
.The stacktrace looks like this:
repeating...
I'm trying to add a web frontend to an existing app.
lein run
still works fine. Any ideas? I've been tweaking deps/versions inproject.clj
for hours to no avail.