ERROR:
15-11-2022 19:11:28.382 || ERROR || com.sixdee.rom.core.api.ProductOrderApiDelegate_v2 || 1724 || Other info Log || null || FF94E1DE53EE830BB36E10273DBF1D38 || NA || NA || Error occured:
org.hibernate.search.util.common.SearchException: HSEARCH700112: Invalid object class for projection: com.sixdee.rom.core.projections.ProductOrderProjection. Make sure that this class is mapped correctly, either through annotations (@ProjectionConstructor) or programmatic mapping. If it is, make sure the class is included in a Jandex index made available to Hibernate Search.
at org.hibernate.search.mapper.pojo.search.definition.impl.PojoSearchQueryElementRegistry.composite(PojoSearchQueryElementRegistry.java:32) ~[hibernate-search-mapper-pojo-base-6.2.0.Alpha1.jar!/:6.2.0.Alpha1]
at org.hibernate.search.engine.search.projection.dsl.impl.CompositeProjectionInnerStepImpl.as(CompositeProjectionInnerStepImpl.java:50) ~[hibernate-search-engine-6.2.0.Alpha1.jar!/:6.2.0.Alpha1]
at org.hibernate.search.backend.elasticsearch.search.query.dsl.impl.ElasticsearchSearchQuerySelectStepImpl.select(ElasticsearchSearchQuerySelectStepImpl.java:67) ~[hibernate-search-backend-elasticsearch-6.2.0.Alpha1.jar!/:6.2.0.Alpha1]
After facing above issue referred below 2 links
Referred links:
Now getting error as:
15-11-2022 19:39:05.721 || INFO || org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformInitiator || 52 || || || || || || HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
15-11-2022 19:39:05.838 || INFO || com.sixdee.rom.core.config.HibernateSearchMappingConfigurer || 24 || || || || || || class uri: file:/D:/SMARTFREN/Smart-philli/rom-core-svc/target/classes/
2022-11-15 19:39:05,871 main ERROR Unable to delete file D:\usr\local\tomcat\logs\SpringBoot2App\rom-CoreAapplicationLogs.log: java.nio.file.FileSystemException D:\usr\local\tomcat\logs\SpringBoot2App\rom-CoreAapplicationLogs.log: The process cannot access the file because it is being used by another process
15-11-2022 19:39:05.839 || INFO || com.sixdee.rom.core.config.HibernateSearchMappingConfigurer || 26 || || || || || || class uri ssp: /D:/SMARTFREN/Smart-philli/rom-core-svc/target/classes/
Error starting ApplicationContext. To display the conditions report re-run your application with âdebugâ enabled.
15-11-2022 19:39:06.884 || ERROR || org.springframework.boot.SpringApplication || 843 || || || || || || Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name âentityManagerFactoryâ defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is java.lang.StringIndexOutOfBoundsException: begin 3, end -1, length 55
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.10.jar:5.3.10]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.10.jar:5.3.10]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.10.jar:5.3.10]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) [spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) [spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) [spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) [spring-boot-2.5.5.jar:2.5.5]
at com.sixdee.rom.core.RomCoreSmartphilApplication.main(RomCoreSmartphilApplication.java:39) [classes/:?]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is java.lang.StringIndexOutOfBoundsException: begin 3, end -1, length 55
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:421) ~[spring-orm-5.3.10.jar:5.3.10]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-5.3.10.jar:5.3.10]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.10.jar:5.3.10]
⌠16 more
Caused by: java.lang.StringIndexOutOfBoundsException: begin 3, end -1, length 55
CODE:
Property file â spring.jpa.properties.hibernate.search.mapping.configurer=searchMappingConfigurer
@Component(âsearchMappingConfigurerâ)
public class HibernateSearchMappingConfigurer implements HibernateOrmSearchMappingConfigurer {
Logger logger = LoggerFactory.getLogger(HibernateSearchMappingConfigurer.class);
@Override
public void configure(HibernateOrmMappingConfigurationContext context) {
// Workaround for https://hibernate.atlassian.net/browse/HSEARCH-4724
// => Hibernate Search doesn't seem to find the Jandex index in the fat JAR.
try {
var classesUri = getClass().getProtectionDomain().getCodeSource().getLocation().toURI();
logger.info("class uri: "+classesUri);
var ssp = classesUri.getSchemeSpecificPart();
logger.info("class uri ssp: "+ssp);
var jarpath = Path.of(ssp.substring(ssp.indexOf(":") + 1, ssp.indexOf("!")));
context.annotationMapping().add(JandexUtils.readIndex(jarpath).get());
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
}
Projection class:
public class ProductOrderProjection implements Serializable{
private static final long serialVersionUID = 1L;
private String id;
private String href;
private OffsetDateTime cancellationDate;
private String cancellationReason;
private String category;
private OffsetDateTime completionDate;
private String description;
private OffsetDateTime expectedCompletionDate;
private String externalId;
private String notificationContact;
private OffsetDateTime orderDate;
private String priority;
private OffsetDateTime requestedCompletionDate;
private OffsetDateTime requestedStartDate;
private ProductOrderStateType state;
private List<ProductOrderItemProjection> productOrderItem;
private List<RelatedPartyProjection> relatedParty;
private List<ProductOrderBlueprintMappingProjection> productOrderBlueprintMapping;
private AdditionalInfoProjection addInfo;
@ProjectionConstructor
public ProductOrderProjection(String id, String href, OffsetDateTime cancellationDate, String cancellationReason,
String category, OffsetDateTime completionDate, String description, OffsetDateTime expectedCompletionDate,
String externalId, String notificationContact, OffsetDateTime orderDate, String priority,
OffsetDateTime requestedCompletionDate, OffsetDateTime requestedStartDate, ProductOrderStateType state,
List<ProductOrderItemProjection> productOrderItem, List<RelatedPartyProjection> relatedParty,
List<ProductOrderBlueprintMappingProjection> productOrderBlueprintMapping,
AdditionalInfoProjection addInfo) {
super();
this.id = id;
this.href = href;
this.cancellationDate = cancellationDate;
this.cancellationReason = cancellationReason;
this.category = category;
this.completionDate = completionDate;
this.description = description;
this.expectedCompletionDate = expectedCompletionDate;
this.externalId = externalId;
this.notificationContact = notificationContact;
this.orderDate = orderDate;
this.priority = priority;
this.requestedCompletionDate = requestedCompletionDate;
this.requestedStartDate = requestedStartDate;
this.state = state;
this.productOrderItem = productOrderItem;
this.relatedParty = relatedParty;
this.productOrderBlueprintMapping = productOrderBlueprintMapping;
this.addInfo = addInfo;
}
}
Hi team please help me on this.