duct-framework / duct

Server-side application framework for Clojure
MIT License
1.13k stars 51 forks source link

No method in multimethod 'jdbc-uri' for dispatch value: :jdbc #29

Closed stig closed 8 years ago

stig commented 8 years ago

I just got the above error from lein after creating a new duct project:

Compiling ClojureScript...
Exception in thread "main" java.lang.ExceptionInInitializerError
    at clojure.main.<clinit>(main.java:20)
Caused by: java.lang.IllegalArgumentException: No method in multimethod 'jdbc-uri' for dispatch value: :jdbc, compiling:(config.clj:10:17)
    at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3628)
    at clojure.lang.Compiler$MapExpr.eval(Compiler.java:3000)
    at clojure.lang.Compiler$MapExpr.eval(Compiler.java:3000)
    at clojure.lang.Compiler$DefExpr.eval(Compiler.java:439)
    at clojure.lang.Compiler.eval(Compiler.java:6787)
    at clojure.lang.Compiler.load(Compiler.java:7227)
    at clojure.lang.RT.loadResourceScript(RT.java:371)
    at clojure.lang.RT.loadResourceScript(RT.java:362)
    at clojure.lang.RT.load(RT.java:446)
    at clojure.lang.RT.load(RT.java:412)
    at clojure.core$load$fn__5448.invoke(core.clj:5866)
    at clojure.core$load.doInvoke(core.clj:5865)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5671)
    at clojure.core$load_lib$fn__5397.invoke(core.clj:5711)
    at clojure.core$load_lib.doInvoke(core.clj:5710)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:632)
    at clojure.core$load_libs.doInvoke(core.clj:5749)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:632)
    at clojure.core$require.doInvoke(core.clj:5832)
    at clojure.lang.RestFn.invoke(RestFn.java:1289)
    at user$eval3$loading__5340__auto____4.invoke(user.clj:1)
    at user$eval3.invoke(user.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6782)
    at clojure.lang.Compiler.eval(Compiler.java:6771)
    at clojure.lang.Compiler.load(Compiler.java:7227)
    at clojure.lang.RT.loadResourceScript(RT.java:371)
    at clojure.lang.RT.loadResourceScript(RT.java:358)
    at clojure.lang.RT.maybeLoadResourceScript(RT.java:354)
    at clojure.lang.RT.doInit(RT.java:468)
    at clojure.lang.RT.<clinit>(RT.java:330)
    ... 1 more
Caused by: java.lang.IllegalArgumentException: No method in multimethod 'jdbc-uri' for dispatch value: :jdbc
    at clojure.lang.MultiFn.getFn(MultiFn.java:156)
    at clojure.lang.MultiFn.invoke(MultiFn.java:229)
    at futfutfut.config$fn__20658.invoke(config.clj:10)
    at clojure.lang.AFn.applyToHelper(AFn.java:152)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3623)
    ... 33 more

The steps to reproduce are:

λ ~/play/ lein new duct futfutfut +site +example +ragtime +cljs +heroku +sqlite       
Generating a new Duct project named futfutfut...
Run 'lein setup' in the project directory to create local config files.
λ ~/play/ cd futfutfut 
λ ~/play/futfutfut/ lein setup
Creating file dev/local.clj
Creating file profiles.clj
λ ~/play/futfutfut/ lein run

My Versions:

λ ~/play/futfutfut/ lein --version
Leiningen 2.5.3 on Java 1.8.0_45 Java HotSpot(TM) 64-Bit Server VM

λ ~/play/futfutfut/ sw_vers 
ProductName:    Mac OS X
ProductVersion: 10.11.2
BuildVersion:   15C50

Generated project.clj

(defproject futfutfut "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :min-lein-version "2.0.0"
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [org.clojure/clojurescript "1.7.170"]
                 [com.stuartsierra/component "0.3.0"]
                 [compojure "1.4.0"]
                 [duct "0.5.6"]
                 [environ "1.0.1"]
                 [hanami "0.1.0"]
                 [meta-merge "0.1.1"]
                 [ring "1.4.0"]
                 [ring/ring-defaults "0.1.5"]
                 [ring-jetty-component "0.3.0"]
                 [ring-webjars "0.1.1"]
                 [org.slf4j/slf4j-nop "1.7.12"]
                 [org.webjars/normalize.css "3.0.2"]
                 [duct/hikaricp-component "0.1.0"]
                 [org.xerial/sqlite-jdbc "3.8.11.2"]
                 [duct/ragtime-component "0.1.2"]]
  :plugins [[lein-environ "1.0.1"]
            [lein-gen "0.2.2"]
            [lein-cljsbuild "1.1.1"]]
  :generators [[duct/generators "0.5.6"]]
  :duct {:ns-prefix futfutfut}
  :main ^:skip-aot futfutfut.main
  :uberjar-name "futfutfut-standalone.jar"
  :target-path "target/%s/"
  :resource-paths ["resources" "target/cljsbuild"]
  :prep-tasks [["javac"] ["cljsbuild" "once"] ["compile"]]
  :cljsbuild
  {:builds
   {:main {:jar true
           :source-paths ["src"]
           :compiler {:output-to "target/cljsbuild/futfutfut/public/js/main.js"
                      :optimizations :advanced}}}}
  :aliases {"gen"   ["generate"]
            "setup" ["do" ["generate" "locals"]]
            "deploy" ["do"
                      ["vcs" "assert-committed"]
                      ["vcs" "push" "heroku" "master"]]}
  :profiles
  {:dev  [:project/dev  :profiles/dev]
   :test [:project/test :profiles/test]
   :repl {:resource-paths ^:replace ["resources" "target/figwheel"]
          :prep-tasks     ^:replace [["javac"] ["compile"]]}
   :uberjar {:aot :all}
   :profiles/dev  {}
   :profiles/test {}
   :project/dev   {:dependencies [[reloaded.repl "0.2.1"]
                                  [org.clojure/tools.namespace "0.2.11"]
                                  [org.clojure/tools.nrepl "0.2.12"]
                                  [eftest "0.1.0"]
                                  [kerodon "0.7.0"]
                                  [com.cemerick/piggieback "0.2.1"]
                                  [duct/figwheel-component "0.3.1"]
                                  [figwheel "0.5.0-1"]]
                   :source-paths ["dev"]
                   :repl-options {:init-ns user
                                  :nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}
                   :env {:port 3000}}
   :project/test  {}})

I hope this report is useful. Please let me know if I've missed out any useful information. I'll attempt to track down the issue myself, but my attempts so far have been unsuccessful.

PS: I get the same error when trying to start the project in CIDER. (Version: CIDER 0.10.0snapshot (package: 20151028.758))

weavejester commented 8 years ago

Duct uses Hanami to convert a Heroku database URL to a JDBC one, and Hanami doesn't have a binding for SQLite databases. In general you don't want to use SQLite with Heroku anyway, because Heroku uses an ephemeral filesystem that's cleared periodically.

stig commented 8 years ago

Oh, thanks, that makes sense--I didn't think of that. I'm just getting started and thought I'd just use sqlite for a few tests. I'll bite the bullet and swap to Postgresql, or just drop +heroku for now :-)