I have a feeling that I missed something obvious here, but I don’t know where to start.
I have a new noir application created this way:
$ lein noir new hiworld
I add a new page handler in src / hiworld / server.clj:
(ns hiworld.server (:require [noir.server :as server])) (server/load-views "src/hiworld/views/") (def handler (server/gen-handler {:mode :dev :ns 'hiworld}))
I set project.clj for the ring:
(defproject hiworld "0.1.0-SNAPSHOT" :description "FIXME: write this!" :dependencies [[org.clojure/clojure "1.3.0"] [noir "1.2.2-SNAPSHOT"]] :dev-dependencies [[lein-ring "0.5.4"]] :ring {:handler hiworld.server/handler} :main hiworld.server)
Check that it works locally:
$ lein deps $ lein ring server-headless
I am creating a war:
$ lein ring uberwar
All still. Now I divorce him on the pier:
$ sudo apt-get install jetty libjetty-extra $ sudo cp hiworld-0.1.0-SNAPSHOT-standalone.war /usr/share/jetty/webapps/root.war $ sudo chown jetty:adm /usr/share/jetty/webapps/root.war $ sudo mv /usr/share/jetty/webapps/root /usr/share/jetty/webapps/root-orig $ sudo /etc/init.d/jetty restart
But:
$ curl -I localhost:8080/welcome HTTP/1.1 404 Not Found Date: Mon, 20 Feb 2012 08:59:27 GMT Set-Cookie: ring-session=c255da15-6cbd-4d2c-8e17-9d120918bde9;Path=/ Content-Type: text/html; charset=utf-8 Content-Length: 363 Server: Jetty(6.1.24)
What did I miss? As far as I can tell, this should be all I need to do to deploy the trivial web application to the marina, but obviously I have something wrong here. I don't mind restarting, so I don't think I need to define my own context - or am I?
UPDATE
I followed this sequence of instructions to create a simple “welcome world” that did not include clojure at all, and it worked as expected, so there is something not entirely correct on the clojure stack.
UPDATED AGAIN
I created the simplest possible application for calls as an autonomous war and deployed it. It worked, so it looks like something noir-specific.
UPDATED THIRD TIME
I created and deployed a hello-world compojure application that worked as expected.