创建Neo4j SessionFactory时发生异常

时间:2019-05-13 13:25:51

标签: java neo4j graph-databases sessionfactory

我正在尝试使用org.neo4j.ogm.session.SessionFactory连接到neo4j数据库。但是要遵循以下例外条件,

  

io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   抛出多个类型异常:   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:java / util / concurrent / Flow $ Publisher,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:java / util / concurrent / Flow $ Subscriber,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:   java / util / concurrent / Flow $ Subscription,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:junit / framework / ComparisonFailure,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:kotlin / jvm / functions / Function0,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:   kotlin / jvm / internal / markers / KMappedMarker,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:   org / apache / logging / log4j / spi / ExtendedLoggerWrapper,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:org / apache / tools / ant / DefaultLogger,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:   org / apache / tools / ant / input / InputHandler,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:org / conscrypt / AllocatedBuffer,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:org / conscrypt / BufferAllocator,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:org / conscrypt / HandshakeListener,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:   org / eclipse / jetty / alpn / ALPN $ ClientProvider,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:   org / eclipse / jetty / alpn / ALPN $ ServerProvider,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:   org / eclipse / jetty / npn / NextProtoNego $ ClientProvider,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:   org / eclipse / jetty / npn / NextProtoNego $ ServerProvider,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:org / jboss / marshalling / ByteInput,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:org / jboss / marshalling / ByteOutput,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:   org / neo4j / driver / internal / shaded / io / netty / internal / tcnative / CertificateRequestedCallback,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:   org / neo4j / driver / internal / shaded / io / netty / internal / tcnative / CertificateVerifier,   io.github.lukehutch.fastclasspathscanner.MatchProcessorException:   java.lang.NoClassDefFoundError:   org / neo4j / driver / internal / shaded / io / netty / internal / tcnative / SniHostNameMatcher。   要查看个别异常,请致电   MatchProcessorException#getExceptions()或调用   FastClasspathScanner#scan()之前的FastClasspathScanner#verbose()。在   io.github.lukehutch.fastclasspathscanner.MatchProcessorException.newInstance(MatchProcessorException.java:82)     在   io.github.lukehutch.fastclasspathscanner.scanner.ScanSpec.callMatchProcessors(ScanSpec.java:583)     在   io.github.lukehutch.fastclasspathscanner.FastClasspathScanner.scan(FastClasspathScanner.java:1411)     在   io.github.lukehutch.fastclasspathscanner.FastClasspathScanner.scan(FastClasspathScanner.java:1472)     在   io.github.lukehutch.fastclasspathscanner.FastClasspathScanner.scan(FastClasspathScanner.java:1495)     在org.neo4j.ogm.metadata.DomainInfo.create(DomainInfo.java:54)处   org.neo4j.ogm.metadata.MetaData。(MetaData.java:42)在   org.neo4j.ogm.session.SessionFactory。(SessionFactory.java:80)     在NeoConnect.main(NeoConnect.java:24)线程“ main”中的异常   NeoConnect.main(NeoConnect.java:33)处的java.lang.NullPointerException

     

以退出代码1完成的过程

这似乎是一个缺少的jar错误,但我找不到它。我在classpath中有以下jar。

  

commons-codec-1.10.jar commons-lang3-3.4.jar   fast-classpath-scanner-2.7.4.jar杰克逊注释2.7.0.jar   jackson-core-2.7.1.jar jackson-databind-2.7.1.jar   neo4j-java-driver-2.0.0-alpha01.jar neo4j-ogm-api-3.0.1.jar   neo4j-ogm-core-3.0.1.jar react-streams-1.0.2.jar   slf4j-api-1.7.21.jar

以下是我的代码,

import java.util.Collection;
import org.neo4j.ogm.config.Configuration;
import org.neo4j.ogm.session.Session;
import org.neo4j.ogm.session.SessionFactory;

public class NeoConnect {
    private final static Configuration configuration = new Configuration.Builder()
            .uri("bolt://localhost:7687")
            .credentials("neo4j", "neo1234")
            .build();// provide configuration as seen before

    public static void main( String... args ) throws Exception
    {
        Session session =null;
        try {
            SessionFactory sessionFactory = new SessionFactory(configuration); //getting exception at this line
            session = sessionFactory.openSession();
            Collection<Customer> records=session.loadAll(Customer.class,10);
        } catch (Exception e){
            e.printStackTrace();
        }finally {
            session.clear();
        }
    }


}

非常感谢您的帮助。

0 个答案:

没有答案