0

我使用 jpa 从 Play 访问 PG。我还需要访问 MongoDB。一旦我将 mongo 依赖项添加到相关的 pom.xml 中,我就会得到运行时异常,例如:

[INFO] --- play2-maven-plugin:1.0.0-beta5:run (default-cli) @ API ---
[INFO] Launching Play! server
 [play] Listening for transport dt_socket at address: 1045
 [play] [warn] o.h.e.j.c.i.DriverManagerConnectionProviderImpl - HHH000402: Using Hibernate built-in connection pool (not for production use!)
 [play] java.lang.AbstractMethodError
 [play]     at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:278)
 [play]     at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)
 [play]     at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:802)
 [play]     at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:58)
 [play]     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
 [play]     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)

虽然我有这些依赖项,但它可以工作:

  <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>5.0.2.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>5.0.2.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-search</artifactId>
        <version>5.0.1.Final</version>
    </dependency>

一旦我添加了这些,它就会带来运行时异常:

    <dependency>
        <groupId>org.hibernate.ogm</groupId>
        <artifactId>hibernate-ogm-core</artifactId>
        <version>5.0.2.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate.ogm</groupId>
        <artifactId>hibernate-ogm-mongodb</artifactId>
        <version>5.0.2.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate.ogm</groupId>
        <artifactId>hibernate-ogm-infinispan</artifactId>
        <version>5.0.2.Final</version>
    </dependency>
4

1 回答 1

0

通过向 pom.xml 添加更多依赖项解决了该问题:

    <dependency>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
        <version>1.6.1</version>
    </dependency>
    <dependency>
        <groupId>xml-apis</groupId>
        <artifactId>xml-apis</artifactId>
        <version>1.4.01</version>
    </dependency>
   <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-search</artifactId>
        <version>5.5.5.Final</version>
    </dependency>
于 2016-10-30T13:25:39.973 回答