0

Using gfsh I have started a locator on my PC. How do I connect to this locator using spring-data-gemfire.

Here is the my locator

gfsh>start locator --name=locator1

Locator in /Users/adas/locator1 on 10.1.51.200[10334] as locator1 is currently online

Now I have the following class to connect to this locator

@ClientCacheApplication(locators = {
        @ClientCacheApplication.Locator(host = "10.1.51.200", port = 10334)
})
@EnableEntityDefinedRegions(basePackageClasses = Person.class,
        clientRegionShortcut = ClientRegionShortcut.LOCAL)
@EnableGemfireRepositories
public class GemfiretestApplication {
    public static void main(String[] args) {
        SpringApplication.run(GemfiretestApplication.class, args);
    }

On compiling I get the following error

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gemfireCache': FactoryBean threw exception on object creation; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:178)
bostonjava
  • 624
  • 1
  • 9
  • 20
  • Can you share the actual versions of `spring-data-gemfire` and `gemfire` being used **and** the full stack trace showing last *Caused By* statement?. – Juan Ramos May 03 '19 at 09:12
  • BTW: is your question related to https://community.pivotal.io/s/question/0D50e00005foWPsCAM/springboot-2pivotal-data-gemfire-application-issues?. – Juan Ramos May 03 '19 at 10:52

1 Answers1

1

Given the INCREDIBLY limited information provided (partial stacktrace, no versions, no maven/gradle build files) I could only venture a guess at your problem. I think @juanramos has the correct idea.

I'm testing with:

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-releasetrain</artifactId>
    <version>Lovelave-SR6</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

AND

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
    <version>2.1.4.RELEASE</version>
</dependency>

Without the full stack trace I believe that I see your error. If then add the following exclusion, this problem disappears.

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
    <version>2.1.4.RELEASE</version>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
        </exclusion>
    </exclusions>
</dependency>

If this does not solve your problem, please forward your complete stacktrace... or maybe the last "Caused by:...." statement and/or list of your dependencies.

Udo
  • 63
  • 6