# Problems switching to Muuntaja from Ring

**URL:** https://clojureverse.org/t/problems-switching-to-muuntaja-from-ring/5347
**Category:** Troubleshooting
**Created:** [January 10, 2020, 8:29pm UTC](https://clojureverse.org/t/problems-switching-to-muuntaja-from-ring/5347 "2020-01-10T20:29:46Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Webdev\_Tory](https://clojureverse.org/user_avatar/clojureverse.org/webdev_tory/32/3781_2.png) [@Webdev\_Tory](https://clojureverse.org/u/Webdev_Tory)
#### Post date: [January 10, 2020, 8:29pm UTC](https://clojureverse.org/t/problems-switching-to-muuntaja-from-ring/5347/1 "2020-01-10T20:29:46Z")

</div>

I was hoping for Muuntaja to be a simple drop-in replacement for ring.middleware wrap-formats, but it has been a week of running my head into apparent dependency errors. Even when I trace through `lein deps :tree` to remove dependencies with old versions of jsonista, my errors don’t seem to go away. Here’s the error:

> error in process sentinel: Could not start nREPL server: Exception in thread “main” java.lang.ExceptionInInitializerError at clojure.main.(main.java:20)
> 
> Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/exc/InputCoercionException, compiling:(jsonista/core.clj:79:38)

In the new-project case in which I can actually get the repl to start, shortly after I try to evaluate my Muuntaja buffers I start getting “no REPL connected” errors.

```clojure
(ns hmeg.middleware
  (:require [muuntaja.middleware :refer [wrap-format wrap-params]]))
;; ... other stuff ...
(defn wrap-formats [handler]
  (let [wrapped (-> handler wrap-params wrap-format)]
    (fn [request]
      ((if (:websocket? request) handler wrapped) request))))

;;;;;;;;;;;;;;;;;;
(ns hmeg.handler
  (:require [compojure.core :refer [routes wrap-routes]]
	    [hmeg.layout :refer [error-page]]
	    [hmeg.routes.home :refer [home-routes]]
	    [hmeg.routes.admin :as admin]
	    [compojure.route :as route]
	    [ring.util.http-response :as response]
	    [ring.middleware.format-params :as mformat]
	    [hmeg.env :refer [defaults]]
	    [mount.core :as mount]
	    [hmeg.middleware :as middleware]))

(defn app-routes []
  (routes
   (-> #'home-routes
       (wrap-routes middleware/wrap-formats))
   (-> #'admin/routes
       (wrap-routes middleware/wrap-formats))
   (route/not-found
    (:body
     (error-page {:status 404
		  :title "page not found"})))))

(defn app [] (middleware/wrap-base (app-routes)))

```

Any ideas?

---

<div class="post-metadata">

### Author: ![mvarela](https://clojureverse.org/user_avatar/clojureverse.org/mvarela/32/1478_2.png) [@mvarela](https://clojureverse.org/u/mvarela)
#### Post date: [January 10, 2020, 9:40pm UTC](https://clojureverse.org/t/problems-switching-to-muuntaja-from-ring/5347/2 "2020-01-10T21:40:45Z")

</div>

This might be related to some other dep bringing in Jackson before Jsonista (which is used by Muuntaja) does. @Miikka had a thread about issues with this some weeks ago. You could maybe try to “move up” Muuntaja in your deps list, and see if that helps (also, you might want to check if different versions are used with @alexmiller 's graph tool for tools.deps) .

---

<div class="post-metadata">

### Author: ![Webdev\_Tory](https://clojureverse.org/user_avatar/clojureverse.org/webdev_tory/32/3781_2.png) [@Webdev\_Tory](https://clojureverse.org/u/Webdev_Tory)
#### Post date: [January 11, 2020, 3:28am UTC](https://clojureverse.org/t/problems-switching-to-muuntaja-from-ring/5347/3 "2020-01-11T03:28:28Z")

</div>

Does the order of the dependency list actually matter?

---

<div class="post-metadata">

### Author: ![mvarela](https://clojureverse.org/user_avatar/clojureverse.org/mvarela/32/1478_2.png) [@mvarela](https://clojureverse.org/u/mvarela)
#### Post date: [January 11, 2020, 9:40am UTC](https://clojureverse.org/t/problems-switching-to-muuntaja-from-ring/5347/4 "2020-01-11T09:40:28Z")

</div>

Yes, it does. @alexmiller talked quite a bit [about this](https://www.youtube.com/watch?v=7CM7Ef-dPWQ&list=PLZdCLR02grLqSy15ALLAZDU6LGpAJDrAQ&index=28) in the Conj.

---

<div class="post-metadata">

### Author: ![ikitommi](https://clojureverse.org/user_avatar/clojureverse.org/ikitommi/32/5797_2.png) [@ikitommi](https://clojureverse.org/u/ikitommi)
#### Post date: [January 11, 2020, 2:55pm UTC](https://clojureverse.org/t/problems-switching-to-muuntaja-from-ring/5347/5 "2020-01-11T14:55:49Z")

</div>

Related discussion: [Depending on the right versions of Jackson libraries](https://v2.clojureverse.org/t/depending-on-the-right-versions-of-jackson-libraries/5111)

---

<div class="post-metadata">

### Author: ![Miikka](https://clojureverse.org/user_avatar/clojureverse.org/miikka/32/358_2.png) [@Miikka](https://clojureverse.org/u/Miikka)
#### Post date: [January 11, 2020, 3:22pm UTC](https://clojureverse.org/t/problems-switching-to-muuntaja-from-ring/5347/6 "2020-01-11T15:22:52Z")

</div>

Yes, the problem is most likely a mismatch in the versions of `jackson-core` and `jackson-databind`. I wrote [a FAQ](https://github.com/metosin/jsonista/blob/master/docs/faq.md#why-am-i-getting-a-noclassdeffounderror) for jsonista about this. Basically the solution is to ensure that you have the same versions for both the Jackson libraries in your dependencies:

```clojure
[com.fasterxml.jackson.core/jackson-core "2.10.2"]
[com.fasterxml.jackson.core/jackson-databind "2.10.2"]

```

---

<div class="post-metadata">

### Author: ![system](https://clojureverse.org/uploads/default/original/2X/5/51079bf9e4b7d9466242c06cf1e43b9f8bd6da14.png) [@system](https://clojureverse.org/u/system)
#### Post date: [July 12, 2020, 3:22am UTC](https://clojureverse.org/t/problems-switching-to-muuntaja-from-ring/5347/7 "2020-07-12T03:22:52Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
