weavejester / compojure

A concise routing library for Ring/Clojure
Eclipse Public License 1.0
4.07k stars 259 forks source link

Build fails on clout route compile #122

Closed AlBaker closed 9 years ago

AlBaker commented 9 years ago

Tried upgrading an app with compojure 1.1.6 to 1.2.0 and 'lein ring server' fails with:

Caused by: java.lang.NoSuchMethodError: clout.core.CompiledRoute.<init>(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
    at clout.core$route_compile.invoke(core.clj:95)
    at clout.core$route_compile.invoke(core.clj:85)
    at ring.middleware.refresh__init.load(Unknown Source)
    at ring.middleware.refresh__init.<clinit>(Unknown Source)

Tried adding the cloud 2.0 dependency directly, made sure all lein/ring stuff was up to date - no dice.

Anything I'm missing?

weavejester commented 9 years ago

This is commonly caused by a dependency overriding Compojure's Clout dependency. I believe older versions of lib-noir had a older clout dependency, which can override Compojure's dependency if Leiningen resolves in lib-noir's favour. Try checking lein deps :tree.

weavejester commented 9 years ago

Another possibility is that you have an AOT-compiled Clout class file from a broken dependency somewhere on your classpath.

weavejester commented 9 years ago

Finally, you may want to try lein clean. Sometimes your target directory gets files that cause breakages like this. Clean or remove the target directory and the problem might go away.

AlBaker commented 9 years ago

Yeah, it looks like the change in deps doesn't cause a clean. Lean clean got the old reference out.

Thanks!

leblowl commented 9 years ago

I also received this error while using boot-clj/boot & packaging my app as an uberjar. It looks like unpacking one of my dependencies overwrites my compiled clout files. Problem is described here as well: http://stackoverflow.com/questions/31129470/java-lang-illegalargumentexception-no-implementation-of-method-route-matches/31569119#31569119.

Excluding compiled clout files in my uberjar task solves the problem.