This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-16
Channels
- # aws-lambda (3)
- # beginners (20)
- # boot (201)
- # cljs-dev (45)
- # cljsrn (9)
- # clojars (19)
- # clojure (141)
- # clojure-china (2)
- # clojure-dev (11)
- # clojure-greece (6)
- # clojure-italy (1)
- # clojure-new-zealand (1)
- # clojure-romania (1)
- # clojure-russia (55)
- # clojure-spec (58)
- # clojure-taiwan (1)
- # clojure-uk (97)
- # clojure-ukraine (40)
- # clojurescript (77)
- # core-async (5)
- # core-typed (1)
- # cursive (35)
- # datomic (9)
- # jobs (2)
- # jobs-rus (25)
- # juxt (8)
- # lein-figwheel (14)
- # luminus (24)
- # mount (16)
- # off-topic (56)
- # om (36)
- # onyx (22)
- # pedestal (3)
- # perun (14)
- # re-frame (111)
- # reagent (5)
- # remote-jobs (6)
- # ring-swagger (3)
- # slack-help (1)
- # specter (17)
- # unrepl (12)
- # untangled (56)
i started a new luminus template project and added one sql function and set up my db urls so that everything's working with the db connection itself but i'm getting a CompilerException java.lang.IllegalArgumentException: db-spec mount.core.DerefableState@5759e7ca is missing a required parameter, compiling:(checker.clj:26:34)
when i try to compile or run a repl when i try to access that db function from a second namespace. if i run mount.core/start
in that second namespace, it works for the repl and with lein run but lein uberjar fails and it seems like that is unnecessary as mount.core/start
is called from the function that starts the app. if i remove the call to the db function in that second namespace, it works fine. i also tried requiring this second namespace in the core namespace that starts the app but that didn't seem to have any effect. any ideas?
@lucian303 can you share some code? you only need a single (mount/start)
for everything to work.
In case of an uberjar, usually, a (mount/start)
is called from within a -main
method in "xyz" namespace. In order for it to work, that "xyz" namespace should (:require [...])
namespaces with states. It does not need to require all of them, as it would find them transitively: i.e. if you require just a namespace a
that in turn requires a namespace b
, a
is all you need.
@tolitius i set up a repo here to demonstrate the problem: https://github.com/lucian303/luminus-test ... the only changes i made from lein new luminus testing +swagger +service +mysql
are to add the db urls to profiles.clj, my own db function to the sql file and a call to that function in the testing.routes.services
namespace to show the problem. i can only start the repl / server if the call to mount in testing.routes.services is there, but that doesn't help the uberjar which throws an exception cause the db is not started. also, as u say, that should be unnecessary since start is called in the testing.core ns ...
this line: https://github.com/lucian303/luminus-test/blob/master/src/clj/testing/routes/services.clj#L10 calls into a db
before the app ( with all its resources ) is started
I also noticed you did not setup db properties:
(!) read config from file: ".lein-env", but it is empty
Exception one of :jdbc-url, :adapter, :datasource, or :datasource-classname is required to initialize the connection! conman.core/make-config (core.clj:56)
as to mount, you can certainly call (db/get-term-names)
in REPL or within a function after the initial call to (mount/start)
I believe in #luminus this is where the app is started: https://github.com/lucian303/luminus-test/blob/master/src/clj/testing/core.clj#L45
@tolitius i updated the code slightly to make the call inside a function (which is how my real code is) but the problem is the same. the repl will not start when i reference anything from the db because the db isn't started by mount