Code Monkey home page Code Monkey logo

Comments (11)

weavejester avatar weavejester commented on August 20, 2024

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.

from compojure-example.

devth avatar devth commented on August 20, 2024

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"]]

from compojure-example.

devth avatar devth commented on August 20, 2024

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

from compojure-example.

weavejester avatar weavejester commented on August 20, 2024

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.

from compojure-example.

devth avatar devth commented on August 20, 2024

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))

from compojure-example.

weavejester avatar weavejester commented on August 20, 2024

It looks as if you might have a circular dependency in your source code. Could you check to see whether that's the case?

from compojure-example.

devth avatar devth commented on August 20, 2024

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.

from compojure-example.

weavejester avatar weavejester commented on August 20, 2024

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.

from compojure-example.

devth avatar devth commented on August 20, 2024

It ended up being two problems:

  1. a namespace was requiring itself
  2. two namespaces were requiring core

Thanks for your help, @weavejester. Much appreciated.

from compojure-example.

weavejester avatar weavejester commented on August 20, 2024

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.

from compojure-example.

devth avatar devth commented on August 20, 2024

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!

from compojure-example.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.