최대 절전 모드 OGM mongo DB 응용 프로그램에 대한 최대 절전 모드 검색 지원을 추가하려고합니다. fullTextEntityManager.createIndexer(Post.class) .startAndWait();
라인을 사용하여 인덱스를 다시 작성하려고 할 때마다 정기적으로 예외가 발생합니다.Hibernate 인덱스를 구축하는 동안 예외 검색
HSEARCH000058: HSEARCH000116: Unexpected error during MassIndexer operation java.lang.NoSuchMethodError: org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.getIdPropertyName()Ljava/lang/String; at org.hibernate.ogm.massindex.impl.TupleIndexer.idInString(TupleIndexer.java:128) ~[hibernate-ogm-core-5.1.0.Final.jar:5.1.0.Final] at org.hibernate.ogm.massindex.impl.TupleIndexer.createAddLuceneWork(TupleIndexer.java:119) ~[hibernate-ogm-core-5.1.0.Final.jar:5.1.0.Final] at org.hibernate.ogm.massindex.impl.TupleIndexer.index(TupleIndexer.java:109) ~[hibernate-ogm-core-5.1.0.Final.jar:5.1.0.Final] at org.hibernate.ogm.massindex.impl.TupleIndexer.index(TupleIndexer.java:89) ~[hibernate-ogm-core-5.1.0.Final.jar:5.1.0.Final] at org.hibernate.ogm.massindex.impl.TupleIndexer.runInNewTransaction(TupleIndexer.java:216) ~[hibernate-ogm-core-5.1.0.Final.jar:5.1.0.Final] at org.hibernate.ogm.massindex.impl.TupleIndexer.run(TupleIndexer.java:189) ~[hibernate-ogm-core-5.1.0.Final.jar:5.1.0.Final] at org.hibernate.ogm.massindex.impl.OptionallyWrapInJTATransaction.consume(OptionallyWrapInJTATransaction.java:104) ~[hibernate-ogm-core-5.1.0.Final.jar:5.1.0.Final] at org.hibernate.ogm.datastore.mongodb.MongoDBDialect.forEachTuple(MongoDBDialect.java:762) ~[hibernate-ogm-mongodb-5.1.0.Final.jar:5.1.0.Final] at org.hibernate.ogm.dialect.impl.ForwardingGridDialect.forEachTuple(ForwardingGridDialect.java:168) [hibernate-ogm-core-5.1.0.Final.jar:5.1.0.Final] at org.hibernate.ogm.massindex.impl.BatchIndexingWorkspace.run(BatchIndexingWorkspace.java:77) [hibernate-ogm-core-5.1.0.Final.jar:5.1.0.Final] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
나의 구성은 다음과 같습니다. ORM 층에서 POM 파일 :
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.3.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.hibernate.ogm</groupId>
<artifactId>hibernate-ogm-mongodb</artifactId>
<version>5.1.0.Final</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.jboss.jbossts</groupId>
<artifactId>jbossjta</artifactId>
<version>4.16.4.Final</version>
</dependency>
<!--Hibernate search-->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<exclusions>
<exclusion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</exclusion>
</exclusions>
<version>5.5.3.Final</version>
</dependency>
<!-- Infinispan integration -->
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-directory-provider</artifactId>
<version>8.2.4.Final</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
(나는 Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'searchIndexBuilder': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [mvc-dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/tool/schema/spi/DelayedDropRegistry
오류를 제거하는 최대 절전 모드 검색 종속성에서 최대 절전 모드 코어를 제외했다 나는 다양한 버전의 조합을 시도했지만 작동하지 않았다..)
스프링 설정 파일 :
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
<context:component-scan base-package="test.y"/>
<mvc:annotation-driven />
<context:property-placeholder location="classpath:system.properties" ignore-resource-not-found="true"
ignore-unresolvable="true"/>
<!--Common beans-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/pages/"/>
<property name="suffix" value=".jsp"/>
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="ogm-jpa-tutorial" />
</bean>
<bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
<mvc:resources mapping="/css/**" location="/css"/>
<mvc:resources mapping="/js/**" location="/js"/>
<mvc:resources mapping="/fonts/**" location="/fonts"/>
<mvc:resources mapping="/images/**" location="/images"/>
<mvc:resources mapping="/uploads/**" location="/home/yasitha/Pictures/Aurudu-2017/"/>
지속성 XML :
<?xml version="1.0"?>
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd " 버전 ="2.0 ">
<persistence-unit name="ogm-jpa-tutorial" transaction-type="RESOURCE_LOCAL">
<!-- Use Hibernate OGM provider: configuration will be transparent -->
<provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
<class>test.y.model.Post</class>
<properties>
<property name="hibernate.ogm.datastore.provider" value="mongodb" />
<!--<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform" />-->
<property name="hibernate.ogm.datastore.create_database" value="true"/>
<property name="hibernate.ogm.datastore.database" value="blog_db"/>
<property name="hibernate.search.default.directory_provider" value="filesystem"/>
<property name="hibernate.search.default.indexBase" value="/home/yasitha/lucene/indexes"/>
</properties>
</persistence-unit>
모델 클래스 :
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Type(type = "objectid")
private String id;
@Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
@Column(name = "headline")
private String title;
@Column(name = "content")
private String description;
@Column(name = "imgUrl")
private String imgUrl;
최대 절전 모드 OGM으로 삽입 된 레코드에 대한 색인이 생성되었습니다. 그러나 DB의 기존 레코드를 다시 색인화 할 수는 없습니다. 이 문제를 해결할 수있는 제안을 보내 주시면 매우 감사드립니다. :)
고맙습니다. ** 최대 절전 모드 검색 5.6.1. 최종 ** 버전으로 전환하면 문제가 해결되었습니다. 나는 Hibernate OGM BOM에 대해서 결코 알지 못했고 나는 그것을 사용할 것을 고대 할 것이다. 다시 한번 감사드립니다. 너는 나의 하루를 구했다! –