jacekschae / learn-reitit-course-files

🎦 Learn Reitit course files for building Cheffy REST API
https://www.learnreitit.com
38 stars 16 forks source link

How to run uberjar locally #7

Closed harryvederci closed 2 years ago

harryvederci commented 3 years ago

Hi!

I'd like to be able to deploy not only to Heroku. I think that would mean I'd have to run the content of the Procfile its web: line directly from the commandline:

java $JVM_OPTS -cp target/cheffy.jar clojure.main -m cheffy.server "resources/config.edn"

(Note: I don't have the JVM_OPTS environment variable set to anything, so it's actually as if I left out $JVM_OPTS from that command.)

The result is the following:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Execution error (NumberFormatException) at java.lang.Integer/parseInt (Integer.java:542).
null

Full report at:
/tmp/clojure-2801422806662434574.edn

The full report (/tmp/clojure-2801422806662434574.edn) contains the following:

{:clojure.main/message
 "Execution error (NumberFormatException) at java.lang.Integer/parseInt (Integer.java:542).\nnull\n",
 :clojure.main/triage
 {:clojure.error/class java.lang.NumberFormatException,
  :clojure.error/line 542,
  :clojure.error/cause "null",
  :clojure.error/symbol java.lang.Integer/parseInt,
  :clojure.error/source "Integer.java",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type java.lang.NumberFormatException,
    :message "null",
    :at [java.lang.Integer parseInt "Integer.java" 542]}],
  :trace
  [[java.lang.Integer parseInt "Integer.java" 542]
   [java.lang.Integer parseInt "Integer.java" 615]
   [cheffy.server$fn__13099 invokeStatic "server.clj" 17]
   [cheffy.server$fn__13099 invoke "server.clj" 15]
   [clojure.lang.MultiFn invoke "MultiFn.java" 234]
   [integrant.core$prep$fn__13011 invoke "core.cljc" 421]
   [clojure.lang.PersistentArrayMap
    kvreduce
    "PersistentArrayMap.java"
    377]
   [clojure.core$fn__8437 invokeStatic "core.clj" 6845]
   [clojure.core$fn__8437 invoke "core.clj" 6830]
   [clojure.core.protocols$fn__8167$G__8162__8176
    invoke
    "protocols.clj"
    175]
   [clojure.core$reduce_kv invokeStatic "core.clj" 6856]
   [clojure.core$reduce_kv invoke "core.clj" 6847]
   [integrant.core$prep invokeStatic "core.cljc" 421]
   [integrant.core$prep invoke "core.cljc" 412]
   [integrant.core$prep invokeStatic "core.cljc" 417]
   [integrant.core$prep invoke "core.cljc" 412]
   [cheffy.server$_main invokeStatic "server.clj" 60]
   [cheffy.server$_main invoke "server.clj" 57]
   [clojure.lang.AFn applyToHelper "AFn.java" 154]
   [clojure.lang.AFn applyTo "AFn.java" 144]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.core$apply invokeStatic "core.clj" 665]
   [clojure.main$main_opt invokeStatic "main.clj" 514]
   [clojure.main$main_opt invoke "main.clj" 510]
   [clojure.main$main invokeStatic "main.clj" 664]
   [clojure.main$main doInvoke "main.clj" 616]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.main main "main.java" 40]],
  :cause "null"}}

Any idea what I'm doing wrong?

PS: The above was executed on the complete increments directory.

jacekschae commented 3 years ago

If you would be interested in running it through docker you could try this setup: https://gist.github.com/jacekschae/91fa70fa216274ef7dbd2d56366c4fed#gistcomment-3586232

If you would like an uberjar you could use lein uberjar command that will create your artefact in /target repository. Then of course you will have to setup you DB connection strings in the prod env.

Sorry for my late reply, hope it helps.

jacekschae commented 2 years ago

Resolved. Feel free to re-open this issue or open a new one if there are more things I could help with.