Joplin: No method in multimethod 'migrate-db' for dispatch value: :sql

216 views
Skip to first unread message

Hildeberto Mendonça

unread,
Mar 21, 2015, 5:38:18 AM3/21/15
to clo...@googlegroups.com
Hello,

I'm trying to use Joplin for database migration in the project javaee-utility-belt (despite the name, it's written in Clojure ;-) The way I found to start programming in Clojure at work: https://github.com/htmfilho/javaee-utility-belt), but I'm getting the following exception:

#<CompilerException java.lang.IllegalArgumentException: No method in multimethod 'migrate-db' for dispatch value: :sql, compiling:(jub/core.clj:5:16)>

I've added joplin.core in my dependencies:

  :dependencies [[org.clojure/clojure "1.6.0" ]
                 [org.clojure/java.jdbc "0.3.6" ]
                 [mysql/mysql-connector-java "5.1.25"]
                 [joplin.core "0.2.9" ]]

I'm trying to call Joplin from code to run the migration automatically at every execution. For that, I wrote datasource.clj as follows:

(ns jub.datasource
  (:require [clojure.java.jdbc :as jdbc]
            [joplin.core       :as joplin]))

(def mysql-db {:subprotocol "mysql"
               :subname     "//localhost:3306/jub"
               :user        "jub_user"
               :password    "psswd"})

(def joplin-target {:db {:type :sql, :url (str "jdbc:mysql:" (get mysql-db :subname)
                                               "?user="      (get mysql-db :user)
                                               "&password="  (get mysql-db :password))}
                    :migrator "resources/migrators/sql"})

(defn migrate-mysql-db []
  (joplin/migrate-db joplin-target))

Then, I'm calling migrate-mysql-db from core.clj, as follows:

(ns jub.core
  (:require [jub.log-file      :refer :all]
               [jub.datasource    :refer (migrate-mysql-db)])
  (:gen-class))

(migrate-mysql-db)

When I start the repl (lein repl) the function (migrate-mysql-db) is called and the exception above is produced.


Can anybody help me with this issue? Thanks in advance!

--
Hildeberto Mendonça

Daniel Kersten

unread,
Mar 21, 2015, 6:40:34 AM3/21/15
to clo...@googlegroups.com
Make sure you require the sql migrations in your jub.datasources source file. This is probably it since jub.datasources cannot find the correct defmethod for migrate-db. Also make sure the migrations are on the classpath.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hildeberto Mendonça

unread,
Mar 21, 2015, 4:55:20 PM3/21/15
to clo...@googlegroups.com
Hi Daniel, thanks for your feedback.

On Sat, Mar 21, 2015 at 11:40 AM, Daniel Kersten <dker...@gmail.com> wrote:
Make sure you require the sql migrations in your jub.datasources source file. This is probably it since jub.datasources cannot find the correct defmethod for migrate-db. Also make sure the migrations are on the classpath.

Could you be more specific about that? The readme file says that I have to load the joplin.core namespace (done) and also the namespaces of the database plugins, but it doesn't say a word about these plugins. I've tried to refer the namespaces joplin.jdbc.database and joplin.sql.database, but the error persists.

Thanks a lot

Hildeberto Mendonça

unread,
Mar 23, 2015, 2:22:44 AM3/23/15
to clo...@googlegroups.com
joplin.jdbc.database works fine. Thanks for the tip.
--
Hildeberto Mendonça, Ph.D
Blog: http://www.hildeberto.com
Community: http://www.cejug.net
Twitter: https://twitter.com/htmfilho
Reply all
Reply to author
Forward
0 new messages