I need to pack this Compojure/Ring little application to .war file to deploy with Tomcat/Elastic Beanstalk. It works fine with lein/jetty locally, but under tomcat it gives me this:
HTTP Status 500 - resources/public/login.html (No such file or directory)
type Exception report
message resources/public/login.html (No such file or directory)
description The server encountered an internal error that prevented it from fulfilling this request.
exception
java.io.FileNotFoundException: resources/public/login.html (No such file or directory)
java.io.FileInputStream.open(Native Method
the project structure:
├── project.clj
├── README.md
├── repo
│ └── local
├── resources
│ └── public
│ └── login.html
├── src
│ └── framework
│ ├── handler.clj
│ ├── session
│ │ └── session.clj
│ └── view
│ └── injectJson.clj
├── target
│ └── framework.war
└── test
└── framework
└── test
└── handler.clj
project.clj:
(defproject framework "0.1.0-SNAPSHOT"
:repositories {"local" "file:repo"}
:dependencies [[org.clojure/clojure "1.5.1"]
[compojure "1.1.6"]]
:plugins [[lein-ring "0.8.10"]]
:ring {:handler framework.handler/app}
:profiles
{:dev {:dependencies [[javax.servlet/servlet-api "2.5"]
[ring-mock "0.1.5"]]}}
:resource-path "resources/")
handle.clj:
(ns ...)
(defroutes app-routes
(GET "/" []
(view/inject (ses/newSid) "login.html"))
(route/resources "/")
(route/not-found "Not Found lalala"))
(def app
(wrap-cookies (handler/site app-routes)))
injectJson.clj (basically put the json object into the html file's header, cuz another person's filling out the page and making them learn clojure is abit much)
(ns...))
(defn inject [json file2Returned]
(let [ file (str "resources/public/" file2Returned)
content (slurp file)
where (+ 6 (.indexOf content "<head>"))
newContent (str (.substring content 0 where) json
(.substring content where))]
newContent))
When I do lein ring uberwar, it gives this .war file with no static resources in it, and won't work even if I put it in manually. What did I do wrong here?
Thanks.