@DataJpaTest

In my a12 application, I defined a Jpa-Test (annotated with @DataJpaTest). When I am trying to run the test, I am facing an Exception telling me, there is no Hazalcast-Instance named “A12S”. Does anybody have an idea how to fix ? Prefered solution is disabling all hibernate-caching, but I would be glad to have any solution to get rid of this exception.


@DataJpaTest
@ExtendWith(SpringExtension.class)
class PruefungRepositoryTest {

    @Autowired
    private PruefungRepository pruefungRepository;

    @Test
    void ginsterDataAdded() {
        pruefungRepository.findGinsterDataAddedByPruefungsnummer("123");
    }

}

Hi @bernhard-keen-stream

Since you did not provide any info about your spring properties for dataservices, I just assume the props of data_services_common_cache.properties is activated by default.
To disable all spring caching, I think we can configure it with the following properties, which are derived from the no_cache profile of dataservices. I added no_cache for contentstore as well. Could you please check on this?

spring.cache.type=none
spring.datasources.dataservices.jpa.properties.hibernate.cache.use_second_level_cache=false
spring.datasources.dataservices.jpa.properties.hibernate.cache.use_query_cache=false
spring.datasources.dataservices.jpa.properties.hibernate.cache.region.factory_class=none
spring.datasources.dataservices.jpa.properties.hibernate.cache.hazelcast.instance_name=none

spring.datasources.contentstore.jpa.properties.hibernate.cache.use_second_level_cache=false
spring.datasources.contentstore.jpa.properties.hibernate.cache.use_query_cache=false
spring.datasources.contentstore.jpa.properties.hibernate.cache.region.factory_class=none
spring.datasources.contentstore.jpa.properties.hibernate.cache.hazelcast.instance_name=none

It looks like this has some effect, because Exception, now, is a nother one:
Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named ‘documentModelReadRepository’ is expected to be of type ‘com.mgmtp.a12.dataservices.model.document.persistence.DocumentModelReadRepository’ but was actually of type ‘jdk.proxy3.$Proxy211’
at app//org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1427)
at app//org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337)
at app//org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:910)
at app//org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:788)

A version problem ? A12 verion seems to be 27.1.0

Hi,
My apologies for not noticing your version.
The proper configuration to disable the cache should be

spring.cache.type=none
spring.jpa.properties.hibernate.cache.use_second_level_cache=false
spring.jpa.properties.hibernate.cache.use_query_cache=false
spring.jpa.properties.hibernate.cache.region.factory_class=none
spring.jpa.properties.hibernate.cache.hazelcast.instance_name=none

It still fails and I postponed creating the test. Because I won’t find some time to work on it next time, I marked this post as closed