Hey Luc, Are you deploying to Tomcat using a war file? Are you perhaps missing the :web-content key in your project.clj file (I presume you're using Leiningen + leiningen-war)
(defproject myproject "0.0.1" :description "" :dependencies [[org.clojure/clojure "1.2.0"] ... ] :dev-dependencies [... [uk.org.alienscience/leiningen-war "0.0.8"]] ;; Used by leiningen-war to deploy static resources :web-content "public" :aot [myproject.servlet]) In your case "public" would be "stylesheets". Is this the approach you're taking? Ultimately it is probably a best to let nginx or apache serve up static files (rather than tomcat/ring) but at the moment I am actually just serving up static content directly from Tomcat which works fine. I have one servlet handling the application and a default servlet on the same Tomcat instance serving up the static files. So I only use the file middleware in development: (wrap-if development? wrap-file "public") (wrap-if development? wrap-file-info) Not sure if that addresses your problem? Cheers, David On 18 October 2010 20:06, <lprefonta...@softaddicts.ca> wrote: > Hi everyone, > > I have been banging my head on the walls for a few hours now and really cannot > figure out the proper way to serve static files in a Compojure application > deployed on Tomcat or Glassfish... > > Feeling pretty dumb in fact... > > I tried to configure the default servlet to catch up requests but I feel > that I cannot escape the Ring routes so this never worked. > > The static files reside in the folder stylesheets at the very top of the > application folder. The application path is IDEMDossierPatient. > > The HTML link references stylesheets/... > > I get the following stack trace: > > SEVERE: Allocate exception for servlet IDEMDossierPatient > java.lang.Exception: Directory does not exist: stylesheets > at ring.middleware.file$ensure_dir.invoke(file.clj:13) > at ring.middleware.file$wrap_file.doInvoke(file.clj:23) > at clojure.lang.RestFn.invoke(RestFn.java:426) > at ring.middleware.static$wrap_static.invoke(static.clj:13) > at > idem.mr.clinic.webaccess.medicalrecord$eval1206.invoke(medicalrecord.clj:52) > ... > > The routes are the following (after several attempts with the file wrapper): > > (defroutes app-routes > (GET "/patient" [patient-id] > (render-page "Dossier médical") (render-page (load-patient-mr > patient-id))) > (GET "/req" req (str req)) > (GET "/file" [] (doto (java.io.File. ".") (.getAbsolutePath))) > (GET "/" [] (render-page "Saisie du # de patient" patient-form)) > (route/not-found "Page inconnue") > ) > > (wrap! app-routes :stacktrace) > (wrap! app-routes (:static "stylesheets" ["stylesheets"])) > > Any ideas where I am going with this aside from a dead end ? > Is there another way to specify the folder for static file ? > Should I specify an absolute path (ugly but given where I am right > now I would not care...) ? > Should I move the folder elsewhere ? > > Blblblblblblbl... > > Thank you, > > Luc > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en