Fork me on GitHub
Mario C.01:01:35

If I run lein with-profile clj deps the task runs fine. (I see no output so I am assuming it worked). Now if I run lein with-profile clj -U deps then I get an exception. I believe the key parts in the stack trace are java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.JavaType.isReferenceType()Z and java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.ClientConfiguration . After some googling around I believe it has to do with the fasterxml.jackson.core/jackson-core library. As the s3-wagon-private uses it as well as cheshire . Running lein with-profile clj deps :tree Shows that there is a dependency issue with it. I took an aggressive approach and excluded the jackson from s3 library. [s3-wagon-private "1.3.3" :exclusions [commons-logging com.fasterxml.jackson.core/jackson-core]] and added the latest version of the jackson 4's to my dependencies.

[com.fasterxml.jackson.core/jackson-core "2.10.0"]
[com.fasterxml.jackson.dataformat/jackson-dataformat-smile "2.10.0"]
[com.fasterxml.jackson.dataformat/jackson-dataformat-cbor "2.10.0"]
[com.fasterxml.jackson.core/jackson-databind "2.10.0"]
But this still results with the same error.

Mario C.01:01:05

If I run lein with-profile clj deps :tree I dont see the jackson library causing dependency issues and I see that I am using the latest version.

Mario C.01:01:43

Also this works fine with my lein version of 2.9.1 but when I downgrade to 2.7.1 this issue occurs. Anybody have any idea what could be the cause?


If it works with lein 2.9.1, can't you just use that and not worry about 2.7.1?


(also, try lein clean and see if that helps -- sometimes lein ends up with stale dependencies/classes and that breaks stuff)

Mario C.01:01:04

Well locally I could do that but our jenkins server uses 2.7.1. Ive submitted a request for an upgrade but in the meantime i'd like to test some stuff in stg

Mario C.01:01:33

One thing I have noticed is that the jackson libraries are not in my .m2 folder Which explains why even if I add them to my dependencies I get classNotFound errors


Have you compared the tree output locally vs on the ci machine?

Mario C.01:01:07

If I remove them from the exclusion then I just get nosuchmethod error

Mario C.01:01:38

I dont have access to the ci machine


Time to start interviewing simple_smile


What is your local lein setup like? Do you have a user profile?

Mario C.02:01:04

No I dont have a user profile


A big difference between those versions of lein is nrepl contrib 0.2.12 and nrepl 0.6.0


It could very well be some lein thing, but my immediate guess is something either locally or on the ci machine is monkeying with dependencies in some way

Mario C.02:01:34

Is it possible that lein isnt pulling the jackson libraries?

Mario C.02:01:49

Why aren't they in my .m2 folder?


I think you would better off excluding the aws sdk dep, and pulling in a newer version of that

Mario C.02:01:41

I tried that earlier and it pulled a giant bucket of dependencies.


What makes you say the Jackson jars aren't in your m2?


If they weren't in your m2, they wouldn't be on the class path, and the error would be a missing Jackson class, not a missing method on a Jackson class

Mario C.02:01:02

If I take look inside, I dont see anything relating to jackson

Mario C.02:01:44

And thats what I am saying. If I explicitly add the jackson libraries to my dependencies and exclude them from the others then the errors I get are class not found


How are you looking inside?

Mario C.02:01:38

If I let cheshire or the s3-wagon dependencies bring in the jackson libraries then I get the no such method errors

Mario C.02:01:05

I just ls the .m2/repository


They would be in com


under fasterxml inside that


Your have to dig deeper


But it doesn't really matter


Because the error you are getting indicates that Jackson is on the classpath

Mario C.02:01:25

You're right. They were under com


So you looking around in m2 doesn't provide more information over the error message


What is the issue with updating the aws sdk dep?


The error looks like something is causing you to use a version of Jackson that is too new for the aws sdk version


@mario.cordova.862 You added 2.10.0 in your project.clj -- try using 2.6.6 instead.


The issue you linked says that the problem is that 2.5.5 is being brought in and the AWS stuff needs 2.6.6

Mario C.02:01:16

@hiredman There is no issue but I kept getting the same error. But let me try again with more patience. Gonna try using 2.6.6 and see if that does it

Mario C.02:01:00

Getting class def not found

Mario C.02:01:18

Here is my output for lein with-profile clj deps :plugin-tree

Mario C.02:01:23

Possibly confusing dependencies found:
[migratus-lein "0.5.7"] -> [org.clojure/clojure "1.8.0"]
[migratus-lein "0.5.7"] -> [migratus "1.0.6"] -> [org.clojure/clojure "1.9.0"]

Consider using these exclusions:
[migratus-lein "0.5.7" :exclusions [org.clojure/clojure]]

[s3-wagon-private "1.3.3" :exclusions [commons-logging]] -> [com.fasterxml.jackson.core/jackson-core "2.9.9"]
[s3-wagon-private "1.3.3" :exclusions [commons-logging]] -> [com.fasterxml.jackson.core/jackson-databind ""] -> [com.fasterxml.jackson.core/jackson-core "2.9.10"]

Consider using these exclusions:
[s3-wagon-private "1.3.3" :exclusions [commons-logging com.fasterxml.jackson.core/jackson-core]]

 [lein-environ "1.1.0"]
 [lein-immutant "2.1.0"]
   [org.clojure/tools.cli "0.3.1" :exclusions [[org.clojure/clojure]]]
   [org.immutant/deploy-tools "2.1.0" :exclusions [[org.clojure/clojure] [leiningen-core]]]
     [version-clj "0.1.2"]
   [org.immutant/fntest "2.0.10" :exclusions [[org.clojure/clojure]]]
     [backtick "0.1.0"]
     [bultitude "0.2.6"]
       [org.tcrawley/dynapath "0.2.3"]
     [jboss-as-management "0.4.4"]
       [clj-http-lite "0.3.0" :exclusions [[org.clojure/clojure]]]
         [slingshot "0.12.1"]
       [org.clojure/data.json "0.2.1" :exclusions [[org.clojure/clojure]]]
     [org.clojure/tools.nrepl "0.2.3"]
 [lein-ring "0.12.0"]
   [leinjacker "0.4.2"]
     [org.clojure/core.contracts "0.0.1"]
       [org.clojure/core.unify "0.5.3"]
   [org.clojure/data.xml "0.0.8"]
 [migratus-lein "0.5.7"]
   [migratus "1.0.6"]
     [org.clojure/java.jdbc "0.7.4"]
     [org.clojure/tools.logging "0.4.0"]
   [org.clojure/clojure "1.8.0"]
 [s3-wagon-private "1.3.3" :exclusions [[commons-logging]]]
   [com.amazonaws/aws-java-sdk-s3 "1.11.580" :exclusions [[com.fasterxml.jackson.core/jackson-core] [com.fasterxml.jackson.core/jackson-databind]]]
     [com.amazonaws/aws-java-sdk-core "1.11.580"]
       [com.fasterxml.jackson.dataformat/jackson-dataformat-cbor "2.6.7"]
       [joda-time "2.8.1"]
       [org.apache.httpcomponents/httpclient "4.5.5"]
         [commons-codec "1.10"]
         [org.apache.httpcomponents/httpcore "4.4.9"]
       [ "1.0.2"]
     [com.amazonaws/aws-java-sdk-kms "1.11.580"]
     [com.amazonaws/jmespath-java "1.11.580"]
   [com.amazonaws/aws-java-sdk-sts "1.11.580"]
   [com.fasterxml.jackson.core/jackson-core "2.9.9"]
   [com.fasterxml.jackson.core/jackson-databind ""]
     [com.fasterxml.jackson.core/jackson-annotations "2.9.10"]
   [ "4.8.0.RELEASE" :exclusions [[com.amazonaws/aws-java-sdk]]]
     [ch.qos.logback/logback-classic "1.0.12"]
       [ch.qos.logback/logback-core "1.0.12"]
     [org.slf4j/jcl-over-slf4j "1.7.5"]
     [org.slf4j/slf4j-api "1.7.5"]


can you post the exact error message? and are you positive you shouldn't be using with-profile +clj (note the +)

Mario C.02:01:28

Here is the output for lein with-profile clj deps :tree

Mario C.02:01:43

[migratus-lein "0.5.7"] -> [org.clojure/clojure "1.8.0"]
[migratus-lein "0.5.7"] -> [migratus "1.0.6"] -> [org.clojure/clojure "1.9.0"]

Consider using these exclusions:
[migratus-lein "0.5.7" :exclusions [org.clojure/clojure]]

[s3-wagon-private "1.3.3" :exclusions [commons-logging]] -> [com.fasterxml.jackson.core/jackson-core "2.9.9"]
[s3-wagon-private "1.3.3" :exclusions [commons-logging]] -> [com.fasterxml.jackson.core/jackson-databind ""] -> [com.fasterxml.jackson.core/jackson-core "2.9.10"]

Consider using these exclusions:
[s3-wagon-private "1.3.3" :exclusions [commons-logging com.fasterxml.jackson.core/jackson-core]]

Possibly confusing dependencies found:
[org.clojure/clojure "1.8.0"]
[yleisradio/new-reliquary "1.1.0"] -> [org.clojure/clojure "1.9.0"]
[migratus "1.0.6"] -> [org.clojure/clojure "1.9.0"]

Consider using these exclusions:
[yleisradio/new-reliquary "1.1.0" :exclusions [org.clojure/clojure]]
[migratus "1.0.6" :exclusions [org.clojure/clojure]]

[pnmacmodel "0.3.21"] -> [org.clojure/core.memoize "0.5.6"]
[org.clojure/core.async "0.4.500"] -> [org.clojure/tools.analyzer.jvm "0.7.2"] -> [org.clojure/core.memoize "0.5.9"]

Consider using these exclusions:
[org.clojure/core.async "0.4.500" :exclusions [org.clojure/core.memoize]]

[compojure "1.4.0"] -> [ring/ring-core "1.4.0"]
[org.immutant/web "2.1.9"] -> [ring/ring-core "1.6.0"]

Consider using these exclusions:
[org.immutant/web "2.1.9" :exclusions [ring/ring-core]]

[compojure "1.4.0"] -> [ring/ring-codec "1.0.0"]
[org.immutant/web "2.1.9"] -> [ring/ring-core "1.6.0"] -> [ring/ring-codec "1.0.1"]

Consider using these exclusions:
[org.immutant/web "2.1.9" :exclusions [ring/ring-codec]]

[pnmacmodel "0.3.21"] -> [com.taoensso/nippy "2.5.2"] -> [org.tukaani/xz "1.4"]
[me.raynes/fs "1.4.6"] -> [org.apache.commons/commons-compress "1.8"] -> [org.tukaani/xz "1.5"]

Consider using these exclusions:
[me.raynes/fs "1.4.6" :exclusions [org.tukaani/xz]]

[pnmacmodel "0.3.21"] -> [org.clojure/core.memoize "0.5.6"] -> [org.clojure/core.cache "0.6.3"]
[org.clojure/core.async "0.4.500"] -> [org.clojure/tools.analyzer.jvm "0.7.2"] -> [org.clojure/core.memoize "0.5.9"] -> [org.clojure/core.cache "0.6.5"]

Consider using these exclusions:
[org.clojure/core.async "0.4.500" :exclusions [org.clojure/core.cache]]

[compojure "1.4.0"] -> [ring/ring-core "1.4.0"] -> [commons-fileupload "1.3.1"]
[org.immutant/web "2.1.9"] -> [ring/ring-core "1.6.0"] -> [commons-fileupload "1.3.2"]

Consider using these exclusions:
[org.immutant/web "2.1.9" :exclusions [commons-fileupload]]

[pnmacmodel "0.3.21"] -> [org.clojure/core.memoize "0.5.6"] -> [org.clojure/core.cache "0.6.3"] -> [org.clojure/data.priority-map "0.0.2"]
[org.clojure/core.async "0.4.500"] -> [org.clojure/tools.analyzer.jvm "0.7.2"] -> [org.clojure/core.memoize "0.5.9"] -> [org.clojure/core.cache "0.6.5"] -> [org.clojure/data.priority-map "0.0.7"]

Consider using these exclusions:
[org.clojure/core.async "0.4.500" :exclusions [org.clojure/data.priority-map]]

 [cheshire "5.5.0"]
   [com.fasterxml.jackson.core/jackson-core "2.5.3"]
   [com.fasterxml.jackson.dataformat/jackson-dataformat-cbor "2.5.3"]
   [com.fasterxml.jackson.dataformat/jackson-dataformat-smile "2.5.3"]
   [tigris "0.1.1"]
 [clj-http "3.7.0"]
   [commons-io "2.5" :exclusions [[org.clojure/clojure]]]
   [org.apache.httpcomponents/httpasyncclient "4.1.3" :exclusions [[org.clojure/clojure]]]
     [org.apache.httpcomponents/httpcore-nio "4.4.6"]
   [org.apache.httpcomponents/httpclient "4.5.3" :exclusions [[org.clojure/clojure]]]
     [commons-logging "1.2"]
   [org.apache.httpcomponents/httpcore "4.4.6" :exclusions [[org.clojure/clojure]]]
   [org.apache.httpcomponents/httpmime "4.5.3" :exclusions [[org.clojure/clojure]]]
   [potemkin "0.4.3" :exclusions [[org.clojure/clojure]]]
     [clj-tuple "0.2.2"]
     [riddley "0.1.12"]
   [slingshot "0.12.2" :exclusions [[org.clojure/clojure]]]
 [clj-time "0.15.0"]
   [joda-time "2.10"]
 [clojure.jdbc/clojure.jdbc-c3p0 "0.3.2"]
   [com.mchange/c3p0 "0.9.5-pre9"]
     [com.mchange/mchange-commons-java "0.2.8"]
 [com.taoensso/timbre "4.10.0"]
   [com.taoensso/encore "2.91.0"]
     [com.taoensso/truss "1.5.0"]
   [io.aviso/pretty "0.1.33"]
 [compojure "1.4.0"]
   [clout "2.1.2"]
     [instaparse "1.4.0" :exclusions [[org.clojure/clojure]]]
   [medley "0.6.0"]
   [org.clojure/tools.macro "0.1.5"]
   [ring/ring-codec "1.0.0"]
   [ring/ring-core "1.4.0"]
     [commons-fileupload "1.3.1"]
     [crypto-equality "1.0.0"]
     [crypto-random "1.2.0"]
 [diff-match-patch-clj "1.0.0-20111019.122151-1"]
 [environ "1.0.0"]
 [hiccup "1.0.5"]
 [liberator "0.13"]
   [org.clojure/data.csv "0.1.2"]
 [me.raynes/fs "1.4.6"]
   [org.apache.commons/commons-compress "1.8"]
 [migratus "1.0.6"]
   [org.clojure/tools.logging "0.4.0"]
 [net.sourceforge.jtds/jtds "1.3.1"]
 [org.clojure/clojure "1.8.0"]
 [org.clojure/core.async "0.4.500"]
   [org.clojure/tools.analyzer.jvm "0.7.2"]
     [org.clojure/tools.analyzer "0.6.9"]
     [org.clojure/tools.reader "1.0.0-beta4"]
     [org.ow2.asm/asm-all "4.2"]
 [org.clojure/core.match "0.3.0"]
 [org.clojure/java.jdbc "0.7.6"]
 [org.immutant/web "2.1.9"]
   [org.immutant/core "2.1.9"]
     [org.clojure/java.classpath "0.2.3"]
   [org.projectodd.wunderboss/wunderboss-clojure "0.13.1"]
   [org.projectodd.wunderboss/wunderboss-web-undertow "0.13.1"]
     [io.undertow/undertow-core "1.4.14.Final"]
       [org.jboss.xnio/xnio-api "3.3.6.Final"]
       [org.jboss.xnio/xnio-nio "3.3.6.Final" :scope "runtime"]
     [io.undertow/undertow-servlet "1.4.14.Final"]
       [org.jboss.spec.javax.annotation/jboss-annotations-api_1.2_spec "1.0.0.Final"]
     [io.undertow/undertow-websockets-jsr "1.4.14.Final"]
     [org.projectodd.wunderboss/wunderboss-core "0.13.1"]
       [ch.qos.logback/logback-classic "1.1.3"]
         [ch.qos.logback/logback-core "1.1.3"]
         [org.slf4j/slf4j-api "1.7.7"]
       [org.jboss.logging/jboss-logging "3.2.1.Final"]
     [org.projectodd.wunderboss/wunderboss-web "0.13.1"]
       [org.jboss.spec.javax.servlet/jboss-servlet-api_3.1_spec "1.0.0.Final"]
       [org.jboss.spec.javax.websocket/jboss-websocket-api_1.1_spec "1.1.0.Final"]
 [org.postgresql/postgresql "42.2.2"]
 [pnmacmodel "0.3.21"]
   [adt "0.1.5"]
   [clojureutils "0.1.4"]
   [com.novemberain/monger "3.1.0"]
     [clojurewerkz/support "1.1.0"]
       [ "18.0"]
     [org.mongodb/mongodb-driver "3.3.0"]
       [org.mongodb/bson "3.3.0"]
       [org.mongodb/mongodb-driver-core "3.3.0"]
   [com.taoensso/nippy "2.5.2"]
     [org.iq80.snappy/snappy "0.3"]
     [org.tukaani/xz "1.4"]
   [commons-codec "1.11"]
   [http-kit "2.1.6"]
   [jfree/jfreechart "1.0.13"]
     [jfree/jcommon "1.0.16"]
   [org.apache.poi/poi "3.9"]
   [org.clojars.tnoda/simple-crypto "0.1.0"]
   [org.clojure/core.logic "0.8.3"]
   [org.clojure/core.memoize "0.5.6"]
     [org.clojure/core.cache "0.6.3"]
       [org.clojure/data.priority-map "0.0.2"]
   [org.clojure/data.json "0.2.3"]
   [org.clojure/math.combinatorics "0.0.4"]
   [org.clojure/tools.nrepl "0.2.3"]
   [org.clojure/tools.trace "0.7.6"]
   [seesaw "1.4.2" :exclusions [[org.clojure/clojure]]]
     [com.jgoodies/forms "1.2.1"]
     [com.miglayout/miglayout "3.7.4"]
     [j18n "1.0.1"]
     [org.fife.ui/rsyntaxtextarea "2.0.3"]
     [org.swinglabs.swingx/swingx-core "1.6.3"]
       [org.swinglabs.swingx/swingx-action "1.6.3"]
       [org.swinglabs.swingx/swingx-autocomplete "1.6.3"]
         [org.swinglabs.swingx/swingx-common "1.6.3"]
       [org.swinglabs.swingx/swingx-painters "1.6.3"]
       [org.swinglabs.swingx/swingx-plaf "1.6.3"]
   [zweikopf "0.1.0"]
     [org.jruby/jruby-complete "1.7.1"]
 [ring-cors "0.1.8"]
 [ring-server "0.4.0"]
   [ring-refresh "0.1.2"]
     [watchtower "0.1.1"]
   [ring "1.3.2"]
     [ring/ring-devel "1.3.2"]
       [clj-stacktrace "0.2.7"]
       [ns-tracker "0.2.2"]
         [org.clojure/tools.namespace "0.2.4"]
     [ring/ring-jetty-adapter "1.3.2"]
       [org.eclipse.jetty/jetty-server "7.6.13.v20130916"]
         [org.eclipse.jetty.orbit/javax.servlet "2.5.0.v201103041518"]
         [org.eclipse.jetty/jetty-continuation "7.6.13.v20130916"]
         [org.eclipse.jetty/jetty-http "7.6.13.v20130916"]
           [org.eclipse.jetty/jetty-io "7.6.13.v20130916"]
             [org.eclipse.jetty/jetty-util "7.6.13.v20130916"]
     [ring/ring-servlet "1.3.2"]
 [ring/ring-json "0.3.1"]
 [wardrobe "0.1.4"]
   [pandect "0.5.3"]
     [org.bouncycastle/bcprov-jdk15on "1.52" :exclusions [[org.clojure/clojure]]]
 [yleisradio/new-reliquary "1.1.0"]
   [ "4.0.0"]

Mario C.02:01:05

❯ lein with-profile clj -U deps
Exception in thread "pool-3-thread-1" Exception in thread "pool-4-thread-1" Exception in thread "pool-1-thread-3" java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.JavaType.isReferenceType()Z
	at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(
	at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(
	at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(
	at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(
	at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(
	at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(
	at com.fasterxml.jackson.databind.ObjectMapper._findRootDeserializer(
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(
	at com.amazonaws.internal.config.InternalConfig.loadfrom(
	at com.amazonaws.internal.config.InternalConfig.load(
	at com.amazonaws.internal.config.InternalConfig$Factory.<clinit>(
	at com.amazonaws.util.VersionInfoUtils.userAgent(
	at com.amazonaws.util.VersionInfoUtils.initializeUserAgent(
	at com.amazonaws.util.VersionInfoUtils.getUserAgent(
	at com.amazonaws.ClientConfiguration.<clinit>(
	at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.connectWagon(
	at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.pollWagon(
	at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$
	at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$
Exception in thread "pool-1-thread-2" java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.ClientConfiguration
	at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.connectWagon(
	at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.pollWagon(
	at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$
	at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$


> it's LINE-ing-en wow i've been saying it wrong


@mario.cordova.862 Looks like the problem is AWS is getting an incompatible version of Jackson because it's being brought in by other dependencies.


Cheshire is bringing in an old version. s3-wagon-private seems to be bringing in 2.9.9. You also have a broad spread of different versions of Ring coming in (not relevant to this problem, but something you probably should try to fix as well).

Mario C.02:01:49

@seancorfield Right, so my thinking was. Exclude all the jacksons from the s3-wagon/cheshire library and explicitly list the jacksons on my dependencies list

Mario C.02:01:17

This results in class def not found issues


You'll need to add :exclusions on all those Jackson libs to everything that tries to bring it in, then add top-level dependencies directly on Jackson and try different versions to see if you can find one that works.


You need to be very methodical here -- stop trying to run the program until you've verified via lein deps :tree that you are getting exactly the Jackson versions you think.

Mario C.02:01:10

lein deps :tree is showing that I am pulling in the versions I am listing but still getting the same java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper


Right, once you've established that you can completely control the version of Jackson that you're trying to use, you can experiment with older and newer versions to see if there is any combination that works.

Mario C.03:01:33

If a dependency that I use pulls in another dependency because it needs it. And I tell it to exclude that dependency. If I add that dependency to my project will that dependency be able to find it? If that makes sense


> You'll need to add :exclusions on all those Jackson libs to everything that tries to bring it in, then add top-level dependencies directly on Jackson and try different versions to see if you can find one that works.


when you put it top level, you are dictating which version to use. and then you are going to search for a version of jackson that is compatible with all of your dependencies, provided one exists


Everything from 2.5.3 up to 2.10.0 might be a candidate, unfortunately.


@mario.cordova.862 Is this a project on GitHub by the way? (that we could take a look at and try to help with) Or is it a private project at work?

Mario C.03:01:34

This is a private project at work

Mario C.03:01:56

Apparently the dependencies that plugins use are not the same as the ones listed under the dependencies key.

Mario C.03:01:42

I just added them to the plugins and now I am back to square one. Which is good since at least now the libraries are being used.


Hi, I need to learn how to use Integrant, but I cant find any tutorials or examples on how to use it and the wasn’t enought to help me understand how to apply it. Can anyone point me in the right direction for a tutorial or examples to try on the REPL?


Ah, yes, Leiningen's plugins stuff can cause all sorts of chaos too in terms of dependencies @mario.cordova.862 -- that's why when folks try to help, one of the first questions is often "What plugins do you have declared and what's in your ~/.lein/profiles.clj file?" 🙂

Mario C.17:01:47

I dont think I have anything in my ~/.lein/profiles.clj but I just decided to downgrade the s3 dependency for now. Ops will upgrade the lein version on the jenkins server. Just really wish I could have got it working 😭


@orlandomr27 Have you looked at Component? You might find that to be a simpler starting point. Once you understand Component, Integrant may be easier to understand.


I was avoiding component thinking it was too different, but I'm going to follow your advice! Thanks

Brandon Olivier04:01:17

I'm having a weird situation where clojure.core functions aren't defined properly in my ns. Anybody had something similar happen?

Brandon Olivier04:01:58

For instance (I'm running through Calva), whenever I evaluate (range 10) I get an error that range isn't defined, but (clojure.core/range 10) evaluates just fine


I have not used Calva, but if you use a plain old REPL, that can happen if you switch into a namespace in a way that does not "refer" to the clojure.core namespace. Let me remind myself what way that is...


If you are in a regular Clojure REPL, and type (ns bar) to create the namespace bar , then the prompt changes to bar to indicate you are now in that namespace. Part of the default behavior of the ns macro is to refer to all clojure.core functions by default, unless you add a special option to prevent that (not normally useful to do that)

Brandon Olivier04:01:59

This situation's a bit unusual. I'm writing in a cljs file, but it's configured with lein and shadow-cljs


That happens whether or not namespace bar exists before you typed (ns bar) . However, if bar did not exist, and you type (in-ns 'bar) , you still create and change into that namespace, but in a way that does not refer to clojure.core, and then functions like range are not accessible without extra steps.


OK, everything I just described is what happens in a Clojure/Java REPL. I can try it in a Node-based ClojureScript REPL, but not sure if that will help explain what is happening in your situation

Brandon Olivier04:01:27

Based on that info, my guess is that Calva is using in-ns to switch namespaces, but since the command is called from a cljs file, it's not able to make that switch properly and the fns aren't defined


In a Node-based ClojureScript REPL, I do not see that behavior when creating and switching into a new namespace using in-ns

Brandon Olivier04:01:49

I'm going to try and get it working in Cider, which I'm more comfortable with


@brandon149 There's a #calva-dev channel where folks might be able to give you more detailed information about how that editor/integration behaves.

t-hanks 4

My experience with a number of editors is that might happen if you try to evaluate a single form in a file, without attempt to load that file first, or without evaluating the ns form at the top of that file.

Brandon Olivier05:01:36

I was at least partially right. It wasn't configured to run as a cljs repl, so it was getting messed up

Brandon Olivier05:01:58

I worked through some of the shadow-cljs/lein docs and now everything runs smoothly.


Hi. Can anyone recommend a good intro book to modern java, for someone learning clojure? Context: experienced python and JavaScript, comfortable with lisps and clojure syntax, finding that building real systems I need to write more java (eg: google api libraries) and while I can read java of course I’d like to do a bit of practice writing some stuff in java so I can be more effective in writing interop from clojure.


Bruce Eckel's Thinking in Java is good, but the last one came out in 2006, so don't know how modern it will be. I programmed in Java for 6 years professionally and I used to refer to Google's coding best practices a lot. You'll be surprised how much stress they put on immutable types and immutable collections.


I would also recommend Effective Java (3rd ed) by Joshua Bloch. He was very involved with a lot of the fundamental Java API stuff. It's a little bit older so doesn't cover the most recent versions of Java, but is still a pretty good foundation reference.


Effective Java is an excellent book but definitely not an "intro" book. It is pretty advanced.


Thanks all


Interestingly I didn't write a single line of java in the past couple of years but did quite a lot java api integration with clojure. But I see that this requires a good understanding of the java runtime and class system.

Eamonn Sullivan09:01:16

Yes, I've had the same issue. I was a C/C++, Python, Javascript (used all three for various parts of the system) in my previous job, and have never really used Java before. So, I'm having a little trouble getting my head around how Java works (Javadoc conventions, etc.). You do need to have at least a basic understanding of all of that to do Java API integration in Clojure.


I have not read it, so do not take this as personal recommendation from me, but reviews for "Effective Java" 3rd ed by Bloch are pretty good on Amazon.


I have read Effective Java cover to cover. It is essentially a collection of best practices and explanation of not so obvious pitfalls. The book is excellent but definitely not for beginners.


Another book definitely worth reading is Java Concurrency in Practice, shortened JCIP although it is more niche. The third book I would recommend for Java mastery is the language agnostic Design Patterns book by GoF.


Is anyone able to point at to some good examples of idiomatic architecture/application structuring in Clojure? I'm at that point where I've read a couple of books and am mostly comfortable with the syntax and core library but would really benefit from seeing how people actually design non-trivial applications in Clojure. I've been looking at Uncle Bobs Spacewar repo which is a nice start but now looking for other examples.


Are vectors in Clojure the same things as a tuple from Erlang?


Thanks @jon920 thats a great resource!


@jon920 I’m not too familiar with Erlang, but my understanding is that tuples are an immutable collection of values, usually with a fairly small number of elements, often used with pattern matching. Clojure vectors are also immutable collections of values, but they can be of any length, and are often used with either destructuring or with sequential operations like map, reduce, filter, etc. So there are some things in common, and some differences.


Hello, I'm writing a small program as an exercise to learn clojure. My program takes a character and classifies it as a vowel, consonant or returns what?. I tested vowel? by giving \a and it returned false. What am I missing? I want vowel? to return true if i give it one of \a \e \i \o \u.

(def vowels (set (map str "aeiou")))

(def consonants (set (map str "bcdfghjklmnpqrstvwxyz")))

(defn vowel? 
  (not (nil? (vowels ch))))

(defn consonant? 
  "This is a predicate for a consonant"
  (not (nil? (consonants ch))))

(defn classify
  "a function to classify characters into vowels and consonants"
    (vowel? ch) :vowel
    (consonant? ch) :consonant
    :else :what?))


(set (map str "aeiou")) returns strings #{"a" "e" "i" "o" "u") and you’re testing a character \a


you can actually use sets as functions in clojure so you can do this:


(def vowel? (set "aeiou")


(def consonant? (set "bcd...")


(vowel? \a) => \a (which is truthy so will work in your classify function)


also useful to know: (not (nil? ,,,)) => (some? ,,,)

Lucas Vassalli14:01:12

(doc rational?)
=> clojure.core/rational?
  Returns true if n is a rational number

(rational? 1.2)
=> false
This is so weird.

Alex Miller (Clojure team)14:01:02

returns true if it's an integer, float, or ratio

Luke Schubert14:01:41

1.2 will be a double correct?

Alex Miller (Clojure team)14:01:43

sorry, specifically bigdecimal

Alex Miller (Clojure team)14:01:17

not sure why float/doubles are not included in that off the top of my head

Alex Miller (Clojure team)14:01:17

might just be an oversight

Lucas Vassalli14:01:55

It's actually implemented as [n] (or (integer? n) (ratio? n) (decimal? n))

Alex Miller (Clojure team)14:01:10

unless that's some principled objection to fixed precision floats that I don't understand

Alex Miller (Clojure team)14:01:23

decimal? checks only for arbitrary precision floating point (bigdecimal)

Lucas Vassalli14:01:25

That seems acceptable but the docstring is slightly incorrect

Alex Miller (Clojure team)14:01:36

float? checks for Float/Double

Alex Miller (Clojure team)14:01:06

integer? checks for all the integer types including biginteger


wouldn't want (rational? Math/PI) to return true

Alex Miller (Clojure team)14:01:12

well as implemented, Math/PI is a rational :)

parens 8
Lucas Vassalli14:01:12

1.2 is rational because you can write it as 12/10

Lucas Vassalli14:01:37

Not sure how simple it is to verify this

Luke Schubert14:01:24

rationalize even has an example clojuredocs using Math/PI

Alex Miller (Clojure team)14:01:24

you would want to special case Double/INFINITY, etc

Lucas Vassalli14:01:26

I didn't even realize rationalize exists. That solves my problem, thanks!

Lucas Vassalli14:01:58

Alex I am reading your book and it is awesome, big thanks to you man

Lucas Vassalli14:01:14

I absolutely love it

Lucas Vassalli14:01:47

Specially how the examples make you actually think

Lucas Vassalli14:01:18

And how everything immediately seems useful

Lucas Vassalli14:01:52

I was reading a haskell book before but didn't feel like this

Lucas Vassalli14:01:40

I really recommend the book Programming Clojure for those reading this.

Pavel Klavík19:01:17

Hi, I am trying to make ring-oauth2 working with FB. I am setting it up like this:

(oauth2/wrap-oauth2 handler
                        {:facebook {:authorize-uri    ""
                                    :access-token-uri ""
                                    :client-id        fb-id
                                    :client-secret    fb-secret
                                    :scopes           ["email"]
                                    :launch-uri       (b/path-for routes/routes :fb/launch)
                                    :redirect-uri     (b/path-for routes/routes :fb/callback)
                                    :landing-uri      (b/path-for routes/routes :fb/resolve)}})))
I am getting redirected to http://localhost:3000/login/fb/callback?code=AQDg8bFWIqHGSUOpwuC0JE__MZlm4jY7morHodW5ZSFL480mrPK1LYm9UQsBzKGaN1_dwMBDEygMrsPsjkKtI4eLlexemYDWMkHs84dHdcX4Ewww_YB3eTAq7enq7A4fwJ4G_bg69ewgGPDhCMs-9Ax_m7F9_dP1ncGN_fnIFsz3yenogqjxZqGnDQcjc7DSUrPzkdT8_mEpY7ryB0rgZjJsSpatWv-ROHN7SxO75qQzhPJ-XFZkGaDPqlRi2ChL5xMpEMTSEi37aj6ef_orxyr_veEr6tkKHJ9_w4eTax0LRWIaT-RnzSLdWqu2eBfm1n7fS-1RODmsTreF7oepp5ZT&amp;state=LMMsbgrnpCkF#_=_ and get the following output there:

Pavel Klavík19:01:17

clojure.lang.ExceptionInfo: clj-http: status 400 {:cached nil, :request-time 213, :repeatable? false, :protocol-version {:name "HTTP", :major 1, :minor 1}, :streaming? true, :http-client #object[org.apache.http.impl.client.InternalHttpClient 0xe150485 "org.apache.http.impl.client.InternalHttpClient@e150485"], :chunked? false, :type :clj-http.client/unexceptional-status, :reason-phrase "Bad Request", :headers {"Content-Type" "application/json", "Access-Control-Allow-Origin" "*", "Content-Length" "131", "Alt-Svc" "h3-24=\":443\"; ma=3600", "X-FB-Debug" "feSevDFTF8dSnJw5OHrOs4Ni+HWomFy/mVE4iXEFT5Q6n21oTbKYzVXonVKna0vMr20t4fnkC9rCjW4fwBkImA==", "facebook-api-version" "v2.11", "Strict-Transport-Security" "max-age=15552000; preload", "WWW-Authenticate" "OAuth \"Facebook Platform\" \"invalid_code\" \"Invalid verification code format.\"", "Connection" "close", "Pragma" "no-cache", "Expires" "Sat, 01 Jan 2000 00:00:00 GMT", "x-fb-rev" "1001607678", "x-fb-trace-id" "E3wvIO4CVyS", "Date" "Wed, 15 Jan 2020 18:47:10 GMT", "x-fb-request-id" "A-mrcz2bch-YlNYKTkVhP--", "Cache-Control" "no-store"}, :orig-content-encoding nil, :status 400, :length 131, :body "{\"error\":{\"message\":\"Invalid verification code format.\",\"type\":\"OAuthException\",\"code\":100,\"fbtrace_id\":\"A-mrcz2bch-YlNYKTkVhP--\"}}", :trace-redirects []}
	at clj_http.client$exceptions_response.invokeStatic(client.clj:245)
	at clj_http.client$exceptions_response.invoke(client.clj:236)
	at clj_http.client$wrap_exceptions$fn__41203.invoke(client.clj:254)
	at clj_http.client$wrap_accept$fn__41449.invoke(client.clj:737)
	at clj_http.client$wrap_accept_encoding$fn__41456.invoke(client.clj:759)
	at clj_http.client$wrap_content_type$fn__41443.invoke(client.clj:720)
	at clj_http.client$wrap_form_params$fn__41552.invoke(client.clj:961)
	at clj_http.client$wrap_nested_params$fn__41573.invoke(client.clj:995)
	at clj_http.client$wrap_flatten_nested_params$fn__41582.invoke(client.clj:1019)
	at clj_http.client$wrap_method$fn__41510.invoke(client.clj:895)
	at clj_http.cookies$wrap_cookies$fn__40490.invoke(cookies.clj:131)
	at clj_http.links$wrap_links$fn__40978.invoke(links.clj:63)
	at clj_http.client$wrap_unknown_host$fn__41590.invoke(client.clj:1048)
	at clj_http.client$request_STAR_.invokeStatic(client.clj:1176)
	at clj_http.client$request_STAR_.invoke(client.clj:1169)
	at clj_http.client$post.invokeStatic(client.clj:1194)
	at clj_http.client$post.doInvoke(client.clj:1190)
	at clojure.lang.RestFn.invoke(
	at ring.middleware.oauth2$get_access_token.invokeStatic(oauth2.clj:65)
	at ring.middleware.oauth2$get_access_token.invoke(oauth2.clj:61)
	at ring.middleware.oauth2$make_redirect_handler$fn__41733.invoke(oauth2.clj:78)
	at ring.middleware.oauth2$wrap_oauth2$fn__41762.invoke(oauth2.clj:101)
	at orgpad.server.handler.core$wrap_html_js_css_no_cache$fn__42062.invoke(core.clj:31)
	at co.deps.ring_etag_middleware$wrap_file_etag$fn__42002.invoke(ring_etag_middleware.clj:95)
	at ring.middleware.not_modified$wrap_not_modified$fn__39952.invoke(not_modified.clj:53)
	at ring.middleware.gzip$wrap_gzip$fn__42053.invoke(gzip.clj:100)
	at bidi.ring$eval41815$fn__41816.invoke(ring.cljc:25)
	at bidi.ring$eval41794$fn__41795$G__41785__41804.invoke(ring.cljc:16)
	at bidi.ring$make_handler$fn__41824.invoke(ring.cljc:43)
	at clojure.lang.Var.invoke(
	at aleph.http.server$handle_request$fn__16142$f__2135__auto____16143.invoke(server.clj:158)
	at io.aleph.dirigiste.Executor$Worker$
	at manifold.executor$thread_factory$reify__2017$f__2018.invoke(executor.clj:44)
	at Source)
What am I doing wrong? I am getting "OAuth \"Facebook Platform\" \"invalid_code\" \"Invalid verification code format.\""

Pavel Klavík21:01:13

Solved, had a wrong order of middleware ...