Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does my Clojure import fail?

I'm running Clojure 1.3 with contrib 1.1 in IntelliJ. My program consists of a single line

(use 'clojure.contrib.prxml)

I get the following error upon running

Exception in thread "main" java.lang.RuntimeException: java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V
like image 900
deltanovember Avatar asked Dec 29 '25 06:12

deltanovember


2 Answers

I'm running Clojure 1.3 with contrib 1.1

There's your problem. Clojure and contrib versions are linked against each other, and are not compatible across versions.

Even more, contrib has been split up into lots of smaller libraries as of 1.3, so there is really no version of "monolithic contrib" that you can use with 1.3.

like image 191
amalloy Avatar answered Dec 31 '25 00:12

amalloy


In addition to the answers saying that contrib 1.1 is incompatible with clojure 1.3

Taken from here:

Versions of clojure-contrib are matched to versions of Clojure.

If you are using Clojure 1.0, use clojure-contrib 1.0.

If you are using Clojure 1.1, use clojure-contrib 1.1.

If you are using Clojure 1.2, use clojure-contrib 1.2, or the new modular Contrib libraries.

If you are using Clojure 1.3, use the new modular Contrib libraries.

As of the date of this reply I'm not sure if there is a version of clojure.contrib.prxml that is compatible with clojure-1.3 (Someone please correct me if I'm wrong).

So I would suggest using clojure-1.2.1 and clojure-contrib 1.2.0.

like image 44
edwardsmatt Avatar answered Dec 30 '25 23:12

edwardsmatt