使用 Spring MVC 的 Hibernate 搜索
Hibernate Search with Spring MVC
我正在尝试将 Hibernate Search 与现有的 Spring MVC 应用程序集成,我在其中使用了 hibernate ORM 与数据库进行通信。
当我在 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 search的版本冲突
但是我想不出正确的组合。
如果有人对此有任何想法,请告诉我。
它是现有的 Hibernate Search issue。您可以在评论中找到可能的解决方案。
Hibernate
搜索导致此问题 Hibernate Core 4.3.0.
Hibernate
解决了大部分兼容性问题,您可以在 GIT Hub project.[=14= 查看更多详细信息]
如果您想使用 Hibernate ORM 版本 4。3.x,支持它的 Hibernate Search 的最后一个稳定版本是 Hibernate Search 版本 5.3。0.Final
您不能随意混合依赖项的任何组合:我们在自述文件、下载页面、Migration Guides,当然还有参考文档中记录了兼容范围。
我正在尝试将 Hibernate Search 与现有的 Spring MVC 应用程序集成,我在其中使用了 hibernate ORM 与数据库进行通信。
当我在 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 search的版本冲突
但是我想不出正确的组合。
如果有人对此有任何想法,请告诉我。
它是现有的 Hibernate Search issue。您可以在评论中找到可能的解决方案。
Hibernate
搜索导致此问题 Hibernate Core 4.3.0.
Hibernate
解决了大部分兼容性问题,您可以在 GIT Hub project.[=14= 查看更多详细信息]
如果您想使用 Hibernate ORM 版本 4。3.x,支持它的 Hibernate Search 的最后一个稳定版本是 Hibernate Search 版本 5.3。0.Final
您不能随意混合依赖项的任何组合:我们在自述文件、下载页面、Migration Guides,当然还有参考文档中记录了兼容范围。