我正在尝试将Hibernate Search与现有的Spring MVC应用程序集成,我使用hibernate ORM与Database进行通信。
当我在pom.xml中添加Hibernate Search依赖项时,它会抛出以下错误。
[com/poc/configuration/HibernateConfiguration.class]:
Invocation of init method failed; nested exception is
java.lang.NoClassDefFoundError: org/hibernate/service/spi/BasicServiceInitiator.
这是我的pom.xml文件。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.wex.poc</groupId>
<artifactId>spring-security</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>spring-security Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<springframework.version>4.2.4.RELEASE</springframework.version>
<springsecurity.version>4.0.3.RELEASE</springsecurity.version>
<hibernate.version>4.3.11.Final</hibernate.version>
<hibernate.search.version>4.4.0.Final</hibernate.search.version>
<jstl.version>1.2</jstl.version>
</properties>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-engine</artifactId>
<version>${hibernate.search.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<version>{hibernate.search.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.3-1100-jdbc41</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${springframework.version}</version>
</dependency>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${springsecurity.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${springsecurity.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${springsecurity.version}</version>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
</dependencies>
<build>
<finalName>spring-security</finalName>
</build>
我知道这是因为hibernate和hibernate搜索之间存在版本冲突。
但我无法找出正确的组合。
如果有人对此有所了解,请告诉我。
答案 0 :(得分:0)
现有的Hibernate Search issue。您可以在评论中找到可靠的解决方案。
答案 1 :(得分:0)
Hibernate
搜索导致此问题,Hibernate Core 4.3.0.
Hibernate
解决了大多数兼容性问题,您可以在GIT Hub project查看更多详细信息。
答案 2 :(得分:0)
如果你想使用Hibernate ORM版本4.3.x,支持Hibernate Search的最后一个稳定版本是Hibernate Search版本5.3.0.Final
您无法自由混合任何依赖项组合:我们在自述文件,下载页面,Migration Guides以及参考文档中记录兼容范围。