I'm in the process of upgrading some oldish code, and I'm encountering some 
compatibility problems with the loggers required by various libraries.

See the *appendix* below for my project.clj, which loads a number of 
libraries and to which I've recently added statements like this:

         [com.hp.hpl.jena/jena "2.6.4"
          :exclusions [org.slf4j/slf4j-log4j12
                   org.slf4j/slf4j-api
                   ]
          ]

I added these exclusions to turn off this error:

java.lang.NoSuchMethodError: 
org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V


Which I gather from reading things like this:

<http://stackoverflow.com/questions/3519978/logging-framework-incompatibility>

- stem from incompatible logging libraries.

Excluding these dependencies  seems to turn off this error, but now when I 
try load my code, I'm getting this error:

org.slf4j.LoggerFactory
  [Thrown class java.lang.ClassNotFoundException]

See the appendix for a stack trace.

I'm including org.clojure/tools.logging in the project.clj, but it's not 
clear to me how to keep the logger associated with my 'jena' library happy 
without re-introducing my compatibility error.

Up to this point, my logging has 'just worked', so I guess this is an 
opportunity to learn about this stuff. Is there a good way to deal with the 
fact that different supporting libraries will use different logging regimes?

Thanks for any help.


* appendix *

(defproject MyProject "1.0.0-SNAPSHOT"

  :jvm-opts ["-Xmx8g" "-XX:+HeapDumpOnOutOfMemoryError" "-XX:+UseSerialGC"]


  :dependencies [[org.clojure/clojure "1.3.0"]
         [org.clojure/math.numeric-tower "0.0.1"]
         [org.clojure/tools.trace "0.7.1"]
         [org.clojure/tools.logging "0.2.3"]
         [org.clojure/algo.generic "0.1.0"]
         [clojure-csv "1.3.2"] 
         ;;statistics...
         [incanter/incanter-core "1.3.0-SNAPSHOT"] 
         [incanter/incanter-charts "1.3.0-SNAPSHOT"]
         [incanter/incanter-processing "1.3.0-SNAPSHOT"]

         ;;web
         [compojure "1.1.1"]
         [hiccup "1.0.0"]
         [ring "1.1.1"]

         ;;jena ...
         [com.hp.hpl.jena/jena "2.6.4"
          :exclusions [org.slf4j/slf4j-log4j12
                   org.slf4j/slf4j-api
                   ]
          ]
         ;;TDB 
         [com.hp.hpl.jena/arq "2.8.8"
          :exclusions [org.slf4j/slf4j-api]
          ]
         [com.hp.hpl.jena/iri "0.8"]
         [com.ibm.icu/icu4j "3.4.4"]
         [com.hp.hpl.jena/tdb "0.8.10"
          :exclusions [org.slf4j/slf4j-api]
          ]
         ;;lucene
         [org.apache.lucene/lucene-core "2.3.1"]
          ]
  :dev-dependencies [
               [swank-clojure "1.3.2" 
                :exclusions [org.clojure/clojure]]
             [lein-autodoc "0.9.0"]
               
               ]
 
)

-- stack trace:

org.slf4j.LoggerFactory
  [Thrown class java.lang.ClassNotFoundException]
Backtrace:
  0: java.net.URLClassLoader$1.run(URLClassLoader.java:217)
  1: java.security.AccessController.doPrivileged(Native Method)
  2: java.net.URLClassLoader.findClass(URLClassLoader.java:205)
  3: java.lang.ClassLoader.loadClass(ClassLoader.java:321)
  4: sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
  5: java.lang.ClassLoader.loadClass(ClassLoader.java:266)
  6: com.hp.hpl.jena.util.Metadata.<clinit>(Metadata.java:26)
  7: com.hp.hpl.jena.JenaRuntime.<clinit>(JenaRuntime.java:25)
  8: 
com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl.<clinit>(RDFReaderFImpl.java:85)
  9: com.hp.hpl.jena.rdf.model.impl.ModelCom.<clinit>(ModelCom.java:42)



-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to