Using Solrj 5.2.1 with Maven -


i created new maven project solrj dependency:

<dependency>     <groupid>org.apache.solr</groupid>     <artifactid>solr-solrj</artifactid>     <version>5.2.1</version> </dependency> 

it compiles correctly if try use solrj code application crushes following exception:

slf4j: failed load class "org.slf4j.impl.staticloggerbinder". slf4j: defaulting no-operation (nop) logger implementation slf4j: see http://www.slf4j.org/codes.html#staticloggerbinder further details. exception in thread "main" java.lang.noclassdeffounderror: org/apache/commons/logging/logfactory     @ org.apache.http.impl.client.closeablehttpclient.<init>(closeablehttpclient.java:58)     @ org.apache.http.impl.client.abstracthttpclient.<init>(abstracthttpclient.java:287)     @ org.apache.http.impl.client.defaulthttpclient.<init>(defaulthttpclient.java:128)     @ org.apache.http.impl.client.systemdefaulthttpclient.<init>(systemdefaulthttpclient.java:116)     @ org.apache.solr.client.solrj.impl.httpclientutil.createclient(httpclientutil.java:117)     @ org.apache.solr.client.solrj.impl.cloudsolrclient.<init>(cloudsolrclient.java:189)     @ main.main(main.java:44)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:497)     @ com.intellij.rt.execution.application.appmain.main(appmain.java:140) caused by: java.lang.classnotfoundexception: org.apache.commons.logging.logfactory     @ java.net.urlclassloader.findclass(urlclassloader.java:381)     @ java.lang.classloader.loadclass(classloader.java:424)     @ sun.misc.launcher$appclassloader.loadclass(launcher.java:331)     @ java.lang.classloader.loadclass(classloader.java:357)     ... 12 more 

solrj depends on 2 generic logging libraries: slf4j , commons logging. each needs kind of real implementation work. adding following dependencies (commons logging slf4j redirection , simple console-based appender) pom.xml resolves issue.

<dependency>     <groupid>org.slf4j</groupid>     <artifactid>jcl-over-slf4j</artifactid>     <version>1.7.7</version>     <scope>runtime</scope> </dependency>  <dependency>     <groupid>org.slf4j</groupid>     <artifactid>slf4j-simple</artifactid>     <version>1.7.7</version> </dependency> 

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -