1

我正在尝试让 clojure-solr-0.2.0 与 solr4 一起使用(trunk nightly build)。我收到以下异常:

Caused by: java.lang.RuntimeException: Invalid version or the data in not in 'javabin' format
at org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:99)
at org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:39)
at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:466)
at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:243)
at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:89)

我假设这是因为 clojure-solr 正在使用来自 solr3 代码库的某个版本的 solrj 库,并且 javabin 格式在版本之间发生了变化。

有什么简单的方法可以让它工作吗?

编辑:

我从项目的 lib 文件夹中删除了 solrj,并将其替换为lib/apache-solr-solrj-4.0-2012-05-15_08-20-37.jar. 我希望这会起作用,因为在运行时(应该)在类路径上找到相同的类(传递依赖项只在运行以获取依赖项时才需要lein deps(或者我推断)。结果是在运行:

Caused by: java.lang.ClassNotFoundException:    org.apache.solr.client.solrj.impl.CommonsHttpSolrServer
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at clojure_solr$eval1423$loading__4414__auto____1424.invoke(clojure_solr.clj:1)
at clojure_solr$eval1423.invoke(clojure_solr.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:5424)
... 95 more

问题是CommonsHttpSolrServer罐子中不再存在:

$ jar tf lib/apache-solr-solrj-4.0-2012-05-15_08-20-37.jar |grep Http
org/apache/solr/client/solrj/impl/HttpSolrServer$1.class
org/apache/solr/client/solrj/impl/HttpSolrServer$2.class
org/apache/solr/client/solrj/impl/HttpSolrServer$3.class
org/apache/solr/client/solrj/impl/HttpSolrServer$DeflateDecompressingEntity.class
org/apache/solr/client/solrj/impl/HttpSolrServer$GzipDecompressingEntity.class
org/apache/solr/client/solrj/impl/HttpSolrServer$UseCompressionRequestInterceptor.class
org/apache/solr/client/solrj/impl/HttpSolrServer$UseCompressionResponseInterceptor.class
org/apache/solr/client/solrj/impl/HttpSolrServer.class
org/apache/solr/client/solrj/impl/LBHttpSolrServer$1.class
org/apache/solr/client/solrj/impl/LBHttpSolrServer$Req.class
org/apache/solr/client/solrj/impl/LBHttpSolrServer$Rsp.class
org/apache/solr/client/solrj/impl/LBHttpSolrServer$ServerWrapper.class
org/apache/solr/client/solrj/impl/LBHttpSolrServer.class
$ jar tf lib/apache-solr-solrj-4.0-2012-05-15_08-20-37.jar |grep CommonsHttp
$
4

1 回答 1

1

您很可能需要自己构建 clojure-solr 并修复它以使用最新的 solr4。这实际上并不难。

  • 从github 项目中克隆它
  • 安装
  • 将其作为依赖项添加到您的主项目中
  • 破解并重复。
于 2012-05-18T21:46:23.357 回答