Unable to resolve name [org.apache.ignite.cache.hi

2019-08-24 04:01发布

问题:

I have a JHipster project with a microservice and a gateway. Both were generated through JHipster. Application deployed in Docker using docker-compose. I am trying to implement Hibernate 2nd level cache for the microservice with Apache Ignite. For this, I used maven dependencies in pom.xml based on Apache Ignite official documentation. When I run the project I get the following error

Unable to resolve name [org.apache.ignite.cache.hibernate.HibernateRegionFactory] as strategy [org.hibernate.cache.spi.RegionFactory

selectStrategyImplementor() method definition as follows

@Override
    @SuppressWarnings("unchecked")
    public <T> Class<? extends T> selectStrategyImplementor(Class<T> strategy, String name) {
        final Map<String,Class> namedStrategyImplementorMap = namedStrategyImplementorByStrategyMap.get( strategy );
        if ( namedStrategyImplementorMap != null ) {
            final Class registered = namedStrategyImplementorMap.get( name );
            if ( registered != null ) {
                return (Class<T>) registered;
            }
        }

        try {
            return classLoaderService.classForName( name );
        }
        catch (ClassLoadingException e) {
            throw new StrategySelectionException(
                    "Unable to resolve name [" + name + "] as strategy [" + strategy.getName() + "]"
            );
        }
    }

Code uploaded to github.

Invocation of destroy method failed on bean with name 'scopedTarget.eurekaClient': org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'eurekaInstanceConfigBean': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
projects-app_1       | 2018-03-01 18:06:14.485 ERROR 7 --- [           main] o.s.boot.SpringApplication               : Application startup failed
projects-app_1       | 
projects-app_1       | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.cache.spi.RegionFactory]
projects-app_1       |  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
projects-app_1       |  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
projects-app_1       |  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
projects-app_1       |  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
projects-app_1       |  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
projects-app_1       |  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
projects-app_1       |  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
projects-app_1       |  at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080)
projects-app_1       |  at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857)
projects-app_1       |  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
projects-app_1       |  at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
projects-app_1       |  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
projects-app_1       |  at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
projects-app_1       |  at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
projects-app_1       |  at com.projects.ProjectsApp.main(ProjectsApp.java:68)
projects-app_1       |  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
projects-app_1       |  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
projects-app_1       |  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
projects-app_1       |  at java.lang.reflect.Method.invoke(Method.java:498)
projects-app_1       |  at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
projects-app_1       |  at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
projects-app_1       |  at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
projects-app_1       |  at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59)
projects-app_1       | Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.cache.spi.RegionFactory]
projects-app_1       |  at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:264)
projects-app_1       |  at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:228)
projects-app_1       |  at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
projects-app_1       |  at org.hibernate.boot.internal.MetadataBuilderImpl$MetadataBuildingOptionsImpl.<init>(MetadataBuilderImpl.java:663)
projects-app_1       |  at org.hibernate.boot.internal.MetadataBuilderImpl.<init>(MetadataBuilderImpl.java:127)
projects-app_1       |  at org.hibernate.boot.MetadataSources.getMetadataBuilder(MetadataSources.java:135)
projects-app_1       |  at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:214)
projects-app_1       |  at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:163)
projects-app_1       |  at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:54)
projects-app_1       |  at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:360)
projects-app_1       |  at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:382)
projects-app_1       |  at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:371)
projects-app_1       |  at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:336)
projects-app_1       |  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
projects-app_1       |  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
projects-app_1       |  ... 22 common frames omitted
projects-app_1       | Caused by: org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.apache.ignite.cache.hibernate.HibernateRegionFactory] as strategy [org.hibernate.cache.spi.RegionFactory]
projects-app_1       |  at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:113)
projects-app_1       |  at org.hibernate.cache.internal.RegionFactoryInitiator.resolveRegionFactory(RegionFactoryInitiator.java:99)
projects-app_1       |  at org.hibernate.cache.internal.RegionFactoryInitiator.initiateService(RegionFactoryInitiator.java:67)
projects-app_1       |  at org.hibernate.cache.internal.RegionFactoryInitiator.initiateService(RegionFactoryInitiator.java:28)
projects-app_1       |  at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88)
projects-app_1       |  at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:254)