journeyman-cc / smeagol

Simple Wiki engine inspired by Gollum
GNU General Public License v2.0
69 stars 8 forks source link

Bug in Tomcat startup caused by missing path #55

Open simon-brooke opened 2 years ago

simon-brooke commented 2 years ago

I'm seeing repeated instances of this in the Goldsmith tomcat localhost log:

12-Feb-2022 10:51:10.686 SEVERE [localhost-startStop-1] org.apache.catalina.core
.StandardContext.listenerStart Exception sending context initialized event to li
stener instance of class [smeagol.listener]

...
    Caused by: java.lang.Exception: Directory does not exist: resources/publ
ic/content
        at ring.middleware.file$ensure_dir.invokeStatic(file.clj:17)
        at ring.middleware.file$ensure_dir.invoke(file.clj:12)
        at ring.middleware.file$wrap_file.invokeStatic(file.clj:47)
        at ring.middleware.file$wrap_file.invoke(file.clj:35)
        at smeagol.middleware$fn__13563.invokeStatic(middleware.clj:54)
        at smeagol.middleware$fn__13563.invoke(middleware.clj:51)

It's not altogether clear where this comes from, but it may come from #(wrap-resource % "public") in:

(def production-middleware
  [#(wrap-internal-error % :log (fn [e] (log/error e)))
   wrap-anti-forgery
   #(wrap-resource % "public")
   smeagol-wrap-content-type
   #(try
      (wrap-file % util/content-dir
                 {:index-files? false :prefer-handler? true})
      (catch Exception error
        (log/fatal "Could not locate content dir" util/content-dir error)
        %))
   wrap-not-modified])
simon-brooke commented 2 years ago

This does not stop Tomcat starting up, and as far as I can see it doesn't stop any Smeagol instances starting up, but it isn't good.