Code Monkey home page Code Monkey logo

compojure-example's Introduction

This is an example web application that uses Ring and Compojure. It demonstrates basic routing and embedded resources.

To play around with this example project, you will first need Leiningen installed.

Download the project dependencies with:

lein deps

Now you can start a development web server with:

lein ring server

Or you can compile the project into a war-file ready for deployment to a servlet container like Tomcat or Jetty:

lein ring uberwar

compojure-example's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

compojure-example's Issues

uberwar does not work under tomcat for lein-ring 0.4.5

Since the version of lein-ring (0.3.2) specified in project.clj does not work with leningen 1.6.0 or above due to a bug with lein-ring, I changed the lein-ring version to the latest 0.4.5 which fixed the bug. However, the uberwar created with lein-ring 0.4.5 does not work for tomcat. The style.css cannot be found. The war created by 0.3.2 (using leningen 1.5.2) works though.

The difference between the wars created by 0.4.5 and that by 0.3.2 is the location of the "public" directory, it is under WEB-INF/classes for 0.4.5 whereas it is under root for 0.3.2.

I think this creates a difficulty situation for users. Basically, the latest versions of lein-ring and leningen do not work together for compojure-example project.

From the amount of discussions on the groups, it seems the placement of resources to work well for both lein-ring and war deployment is problematic. Could you investigate this more, and create a updated version of this compojure-example project that works with lein-ring 0.4.5?

StackOverflowError

I'm getting a StackOverflowError when running lein ring server, ending with Subprocess failed.

The stacktrace looks like this:

Exception in thread "main" java.lang.StackOverflowError
    at clojure.lang.APersistentSet.iterator(APersistentSet.java:155)
    at clojure.core.protocols$fn__5871.invoke(protocols.clj:73)
    at clojure.core.protocols$fn__5828$G__5823__5841.invoke(protocols.clj:13)
    at clojure.core$reduce.invoke(core.clj:6030)
    at ns_tracker.dependency$transitive.invoke(dependency.clj:15)
    at ns_tracker.dependency$transitive$fn__748.invoke(dependency.clj:14)
    at clojure.core.protocols$fn__5871.invoke(protocols.clj:76)
    at clojure.core.protocols$fn__5828$G__5823__5841.invoke(protocols.clj:13)
    at clojure.core$reduce.invoke(core.clj:6030)
    at ns_tracker.dependency$transitive.invoke(dependency.clj:15)
    at ns_tracker.dependency$transitive$fn__748.invoke(dependency.clj:14)
    at clojure.core.protocols$fn__5871.invoke(protocols.clj:76)
    at clojure.core.protocols$fn__5828$G__5823__5841.invoke(protocols.clj:13)
    at clojure.core$reduce.invoke(core.clj:6030)
    at ns_tracker.dependency$transitive.invoke(dependency.clj:15)
    at ns_tracker.dependency$transitive$fn__748.invoke(dependency.clj:14)

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 in project.clj for hours to no avail.

Headless Server?

Maybe it would be better to use lein ring server-headless to run the server as I imagine most people will be running this from a terminal.

When I ran it using lein ring server I get:

Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
        at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:207)
        at java.awt.Window.<init>(Window.java:536)
        at java.awt.Frame.<init>(Frame.java:420)
        at java.awt.Frame.<init>(Frame.java:385)
        at javax.swing.JFrame.<init>(JFrame.java:181)
        at clojure.java.browse_ui$open_url_in_swing.invoke(browse_ui.clj:20)
        at clojure.lang.Var.invoke(Var.java:415)
        at clojure.java.browse$open_url_in_swing.invoke(browse.clj:44)
        at clojure.java.browse$browse_url.invoke(browse.clj:52)
        at ring.server.standalone$open_browser_to.invoke(standalone.clj:39)
        at ring.server.standalone$serve$fn__1506.invoke(standalone.clj:102)
        at ring.server.standalone$try_port.invoke(standalone.clj:16)
        at ring.server.standalone$serve.doInvoke(standalone.clj:95)
        at clojure.lang.RestFn.invoke(RestFn.java:423)
        at ring.server.leiningen$serve.invoke(leiningen.clj:20)
        at user$eval2054.invoke(form-init2066820887519135966.clj:1)
        at clojure.lang.Compiler.eval(Compiler.java:6511)
        at clojure.lang.Compiler.eval(Compiler.java:6501)
        at clojure.lang.Compiler.load(Compiler.java:6952)
        at clojure.lang.Compiler.loadFile(Compiler.java:6912)
        at clojure.main$load_script.invoke(main.clj:283)
        at clojure.main$init_opt.invoke(main.clj:288)
        at clojure.main$initialize.invoke(main.clj:316)
        at clojure.main$null_opt.invoke(main.clj:349)
        at clojure.main$main.doInvoke(main.clj:427)
        at clojure.lang.RestFn.invoke(RestFn.java:421)
        at clojure.lang.Var.invoke(Var.java:419)
        at clojure.lang.AFn.applyToHelper(AFn.java:163)
        at clojure.lang.Var.applyTo(Var.java:532)
        at clojure.main.main(main.java:37)

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.