This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-12
Channels
- # aleph (10)
- # beginners (62)
- # boot (12)
- # cider (97)
- # cljs-dev (171)
- # clojars (1)
- # clojure (224)
- # clojure-italy (4)
- # clojure-nl (2)
- # clojure-russia (1)
- # clojure-spec (41)
- # clojure-uk (68)
- # clojured (7)
- # clojurescript (115)
- # community-development (4)
- # cursive (2)
- # data-science (1)
- # datomic (18)
- # duct (40)
- # emacs (1)
- # events (1)
- # fulcro (148)
- # funcool (2)
- # graphql (2)
- # immutant (3)
- # jobs (3)
- # keechma (1)
- # luminus (2)
- # numerical-computing (1)
- # off-topic (19)
- # om (6)
- # parinfer (10)
- # pedestal (15)
- # precept (86)
- # reagent (12)
- # ring (3)
- # ring-swagger (2)
- # shadow-cljs (42)
- # spacemacs (19)
- # specter (17)
- # sql (11)
- # tools-deps (78)
- # unrepl (62)
- # vim (28)
@weavejester I got this error when trying to use mysql ClassNotFoundException com.mysql.cj.core.log.duct.logger.timbre.TimbreLogger@59869ae java.net.URLClassLoader.findClass (URLClassLoader.java:381)
I started with the lein template with +sqlite, then added [mysql/mysql-connector-java "5.1.45"]
then :duct.module/sql {:database-url "jdbc:
am I missing something?
I tried [mysql/mysql-connector-java "8.0.8-dmr"]
, too, but still the same error
@myguidingstar What does the module produce? If you (prep)
and then run (:duct.database.sql/hikaricp config)
, what do you get?
wait a minute 🙂
{:jdbc-url "jdbc:
I still have :duct.module/logging {}
in my config.edn
That seems fine… What’s the stacktrace for the error you received?
What version of the duct/database.sql.hikaricp library are you using?
:dependencies [[org.clojure/clojure "1.9.0"]
[duct/core "0.6.2"]
[duct/module.logging "0.3.1"]
[duct/module.web "0.6.4"]
[duct/module.ataraxy "0.2.0"]
[duct/module.sql "0.4.2"]
;;[mysql/mysql-connector-java "5.1.45"]
[mysql/mysql-connector-java "8.0.8-dmr"]
;;[org.xerial/sqlite-jdbc "3.21.0.1"]
]
Try redefining the init-key
method for hikaricp
at the REPL, and see if that solves the problem:
(defmethod ig/init-key :duct.database.sql/hikaricp [_ {:keys [logger] :as options}]
(sql/->Boundary {:datasource (-> (hikari-cp/make-datasource (dissoc options :logger))
(cond-> logger (wrap-logger logger)))}))
It might be that the HikariCP wrapper is passing along the :logger
key to the MySQL JDBC adapter somehow.
what is sql
ns alias?
Oh, it’s duct.database.sql
and hikari-cp?
(:require [integrant.core :as ig]
[duct.database.sql :as sql]
[duct.logger :as log]
[hikari-cp.core :as hikari-cp])
unbalanced parens somewhere...
Oh, at the end of (dissoc options :logger)
. Let me edit the message to fix it.
wrap-logger not found
Change it to: #'duct.database.sql.hikaricp/wrap-logger
Essentially we’re just replacing this function: https://github.com/duct-framework/database.sql.hikaricp/blob/master/src/duct/database/sql/hikaricp.clj#L40
okay, I can (q "SELECT 2")
now
so what's the problem?
It’s a combination of this line: https://github.com/duct-framework/database.sql.hikaricp/blob/master/src/duct/database/sql/hikaricp.clj#L40
And this line: https://github.com/tomekw/hikari-cp/blob/master/src/hikari_cp/core.clj#L242
The :logger
key is being added as a datasource property
The solution is to add that extra dissoc
to the duct/database.sql.hikaricp
library
so is it a conflict of using the same keyword?
Well, it’s that MySQL has a datasource property called “logger”, while the other databases I’ve tested on don’t. I didn’t realise that the hikari-cp wrapper would pass the extra option through.
I’ll fix it in a little while.
ah, I see
great, thank you so much
Duct is the best dev experience I've had
btw, I'm about to release a library to query sql using datomic pull syntax called walkable https://github.com/walkable-server/walkable
Duct plays an important role in my dev process
thank you so much 🙂