I built a WAR file and deploy to Jetty 9 with these WAR-making and deployment steps, which is an adaptation from Pedestal's suggestions. This process has worked for me in the past, but at present, Jetty will not start the application.
I also cannot find any useful logs. This is my main problem. I have looked in these places:
/var/log/jetty/current
tells me only this:2014-03-29_16:23:24.058:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@181d4997{/,file:/tmp/jetty-0.0.0.0-8080-myapp.war-_-myapp.domain.com-5203978721479585979.dir/webapp/,AVAILABLE,myapp.domain.com}{/opt/myapp/myapp.war}
2014-03-29_16:23:24.14610 2014-03-29 16:23:24.126:INFO:oejs.ServerConnector:main: Started ServerConnector@5cb1d518{HTTP/1.1}{0.0.0.0:8080}
/opt/jetty/logs
- contains no files at all/opt/myapp
- contains myapp.war
but no logsI also tried adding -DDEBUG=true -Dorg.eclipse.jetty.LEVEL=DEBUG
to my Jetty JVM options at start-up, but the extra logging in /var/log/jetty/current
didn't tell me what went wrong with the WAR file launch.
Although logging works in development (e.g. with lein run-dev
), I would not be surprised if I have made some kind of mistake with my logging configuration. I'm using the standard logback.xml provided by the Pedestal service template.
With regards to the underlying application error, I have some guesses there too. It is most likely due to recent changes in the application dependencies (I added Datomic) or connecting to Datomic at start-up.
Here is my my project.clj:
(defproject myapp-service "0.1.0-SNAPSHOT"
:description "A web app"
:url "http://myapp.domain.com"
:dependencies
[[org.clojure/clojure "1.6.0"]
[org.clojure/tools.reader "0.8.3"]
[com.datomic/datomic-pro "0.9.4699"
:exclusions [org.slf4j/slf4j-api org.slf4j/slf4j-nop commons-codec]]
[io.pedestal/pedestal.service "0.2.2"
:exclusions [com.fasterxml.jackson.core/jackson-core]]
[io.pedestal/pedestal.service-tools "0.2.2"
:exclusions [com.fasterxml.jackson.core/jackson-core]]
[enlive/enlive "1.1.5"]
[validata "0.1.5"]]
:repositories
{"my.datomic.com"
{:url "https://my.datomic.com/repo"
:username "email@domain.com"
:password "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}}
:profiles
{:dev
{:source-paths ["dev"]
:dependencies
[[io.pedestal/pedestal.jetty "0.2.2"]]}}
:min-lein-version "2.0.0"
:resource-paths ["config", "resources"]
:aliases
{"run-dev" ["trampoline" "run" "-m" "myapp-service.server/run-dev"]}
:repl-options
{:init-ns user
:init
(try
(use 'io.pedestal.service-tools.dev)
(require 'myapp-service.service)
; HACK: Allow referencing non clojure.core symbols in :init
(eval '(init myapp-service.service/service
#'myapp-service.service/routes))
(catch Throwable t
(println "ERROR: There was a problem loading"
"io.pedestal.service-tools.dev")
(clojure.stacktrace/print-stack-trace t)
(println)))
:welcome (println
"Welcome to pedestal-service!"
"Run (tools-help) to see a list of useful functions.")}
:main ^{:skip-aot true} myapp-service.server)
So, to restate my main question, how do I get logging to work? Everything else will follow from that.
Embarrassingly, my issue was DNS. Logging is fine.