Compojure on a Slicehost VPS

This article has been archived because much better Clojure resources are available now. Some of my favorite Clojure learning resources include Learn Clojure and Clojure web applications on Heroku. You can also find commercial support at Clojure Core.

About these ads

18 Comments

Filed under Programming

18 responses to “Compojure on a Slicehost VPS

  1. rzezeski

    I’ve been meaning to start learning Compojure. This was the perfect kick-start. Thanks!

  2. Thanks for the feedback, rzezeski. Building a Compojure application has been a lot of fun so far. If this article inspires someone else to start building, then it was definitely worth writing. Hopefully I can finish a second article in the next few days.

  3. Pingback: Using PostgreSQL with Compojure « Eric Lavigne

  4. Mathias Dahl

    I can only agree with rzezeski, this was a great kickstart! I have developed a couple of small web apps using webjure, another web framework for clojure which runs under Tomcat (or similar, I assume), but development of it seems to have stopped. Also, compojure looked more powerful the last time I checked.

    Thanks!

  5. Pingback: Autodidact » Blog Archive » On Clojure: A close look at Luke VanderHart’s Markov Chain generator

  6. Pingback: Clojure roundup « Clojure Study Group DC

  7. arjun

    hey, thanks for the post, eric. just trying out compojure myself. all your steps seem to work great, until I try to execute the simple web app:

    root@arjun:~/site# ./run
    Caused by: java.io.FileNotFoundException: Could not locate compojure/http__init.class or compojure/http.clj on classpath:

    any thoughts/ideas? sorry for being such a n00b :-)

  8. Arjun, this is definitely NOT your fault. There have been some recent changes to Compojure, and I haven’t yet found time to update these articles.

    At the beginning of the program, there are two lines of code for importing libraries:

    (use ‘compojure.http)
    (use ‘compojure.jetty)

    Try changing them as follows:

    (use ‘compojure.http.servlet)
    (use ‘compojure.http.routes)
    (use ‘compojure.server.jetty)

    The other articles have similar issues. I hope to fix those issues in the next few days. Until then, please feel free to ask for help with any problems you encounter.

  9. I just finished updating the code in this article for the latest version of Compojure.

    If you are still using an old version of Compojure, use the following commands to update to the latest version:

    cd /root/install/compojure
    git pull
    ant

    The other two articles also need to be updated. I will place a comment like this one at the bottom of each article after I finish updating them. I hope to finish by the end of the day.

    I am preparing to deliver a Clojure presentation to a Java user group in mid-February. I will definitely post my slides later.

  10. arjun

    awesome, i’m up & running now. thanks, eric.

  11. Thanks Eric for sharing this information.

    I’d like to mention there’s more slice set up and lock down tips in the slice setup article for Ubuntu Hardy: http://articles.slicehost.com/2008/4/25/ubuntu-hardy-setup-page-1

    It’s important to disallow root login via ssh, and there are a few more good tips in there.

    Welcome to Slicehost.
    :)

  12. Thanks, this was really helpful as I set up my blog in Clojure.

  13. Thanks for the good post – you might want to add ant deps before ant (I got
    “BUILD FAILED
    /home/compojure/install/compojure/build.xml:34: /home/compojure/install/compojure/deps not found.”
    until I went to http://en.wikibooks.org/wiki/Compojure/Getting_Started and saw that addition)

  14. You can abbreviate the classpath with “java -Djava.ext.dirs=/root/install/compojure/deps” — there is no need to list every jar individually on the classpath.

  15. Pingback: Setting up clojure « Follow the Data

  16. Martin

    I needed – in addition to the above – to do the following:

    Add the partner sources to sources.list:
    deb http://archive.canonical.com/ubuntu karmic partner
    deb-src http://archive.canonical.com/ubuntu karmic partner

    Change the default jvm:
    https://help.ubuntu.com/community/Java

  17. Daniel Cotter

    Great article. Here’s the script that ended up working for me, a slightly modified version of one that somebody else linked to:

    #!/bin/sh
    COMPOJURE_DIR=~/Documents/compojure
    CLASSPATH=$COMPOJURE_DIR/compojure.jar

    for f in $COMPOJURE_DIR/deps/*.jar; do
    CLASSPATH=$CLASSPATH:$f
    done

    java -cp $CLASSPATH clojure.lang.Script $1

  18. Will

    I know this post is old(er), but instead of screen, you can use `nohup`. Also, instead of a massive classpath, you can throw your jars in a `lib` directory and use `java -cp “lib/*” clojure.main page.clj`, which might be easier.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s