Built-in Neo4j SPI Class (lucene PostingsFormat) Error

I included Neo4j 3.0.1 in a Java 8 application, but I ran into SPI issues.

Running from IntelliJ gives the correct results as expected, but as soon as I create the artifact in the JAR, run it and try to write to Neo4j, I get the following exception:

Caused by: org.neo4j.kernel.impl.store.UnderlyingStorageException: java.lang.IllegalArgumentException: An SPI class of type org.apache.lucene.codecs.PostingsFormat with name 'BlockTreeOrds' does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath. The current classpath supports the following names: [Lucene50] at org.neo4j.kernel.impl.transaction.command.LabelUpdateWork.apply(LabelUpdateWork.java:62) at org.neo4j.kernel.impl.transaction.command.LabelUpdateWork.apply(LabelUpdateWork.java:33) at org.neo4j.concurrent.WorkSync.doSynchronizedWork(WorkSync.java:121) at org.neo4j.concurrent.WorkSync.apply(WorkSync.java:90) at org.neo4j.kernel.impl.transaction.command.IndexBatchTransactionApplier.close(IndexBatchTransactionApplier.java:105) at org.neo4j.kernel.impl.api.BatchTransactionApplierFacade.close(BatchTransactionApplierFacade.java:70) at org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine.apply(RecordStorageEngine.java:336) at org.neo4j.kernel.impl.api.TransactionRepresentationCommitProcess.applyToStore(TransactionRepresentationCommitProcess.java:78) ... 25 more 

There seems to be no exception starting with Neo4j, so I assume some dependencies are not resolved using the Maven build.

My pom.xml file has the following:

 <dependency> <groupId>com.sparkjava</groupId> <artifactId>spark-core</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>org.neo4j</groupId> <artifactId>neo4j</artifactId> <version>3.0.1</version> <type>pom</type> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.7.21</version> </dependency> <dependency> <groupId>org.apache.lucene</groupId> <artifactId>lucene-codecs</artifactId> <version>5.5.0</version> </dependency> <dependency> <groupId>org.neo4j</groupId> <artifactId>neo4j-slf4j</artifactId> <version>3.0.0-M02</version> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.6.2</version> </dependency> <dependency> <groupId>com.github.jknack</groupId> <artifactId>handlebars</artifactId> <version>4.0.5</version> </dependency> <dependency> <groupId>com.opencsv</groupId> <artifactId>opencsv</artifactId> <version>3.7</version> </dependency> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>1.10</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>${jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>${jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>${jackson.version}</version> </dependency> 

How to solve this problem?

UPDATE:

I re-created this problem with a really simple empty project, the source can be found here if you want to run it at your end: https://github.com/SeanNieuwoudt/neo4j-spi

+5
source share
3 answers

I took your project and completed it in my eclipse. I do not have problems. Following are the console logs after startup:

[Thread-0] INFO org.eclipse.jetty.util.log - Record with initialization @ 473ms [Thread-0] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - == The spark ignited ... [Thread-0] INFO spark. embeddedserver.jetty.EmbeddedJettyServer β†’> Listen 0.0.0.0:8080 [Thread-0] INFO org.eclipse.jetty.server.Server - jetty-9.3.6.v20151106 [Thread-0] INFO org.eclipse.jetty.server. ServerConnector - started by ServerConnector @ 5aa07ed2 {HTTP / 1.1, [http / 1.1]} {0.0.0.0:8080} [Thread-0] INFO org.eclipse.jetty.server.Server - started @ 772ms

On access - http: // localhost: 8080 /

I got the output printed as "Hello World"

Sequence of steps:

1) I downloaded your project from your github url 2) Imported as maven projects pointing to java 8 3) Maven installation was successful 3) Ran main class 4) I saw the output in the browser.

Am I missing any steps to replicate an actual problem?

Or something related to your maven. You can check your maven dependencies after running maven install to see if the expected banks are loaded.

Good luck.

+1
source

Try adding the following dependency:

 <dependency> <groupId>org.apache.lucene</groupId> <artifactId>lucene-backward-codecs</artifactId> <version>5.5.0</version> </dependency> 
0
source

All Articles