VMware GemFire

 View Only

 Unable to get regions list

saranya m's profile image
saranya m posted Sep 29, 2018 01:19 PM

I can see the regions list in the gfsh command line, but when i execute my java program i see no regions the output. How to solve this issue?

Attachment  View in library
locator.PNG 56 KB
Rajiv CE's profile image
Rajiv CE

Hi Saranya,

 

From the screenshot I can see you are starting a server via gfsh and creating regions via gfsh. In your Test code GemfireTest, you are trying to start a Rest enabled server without any locator, so it would be running as an independent node, you basically you will have two clusters one which you started via gfsh(one locator and one server with regions) and one with only one rest enabled node(without any region) , that is why your test code is not returning any regions.

 

You need to add the property

set("locators", "host[port]")

to make sure that the rest enabled started via test code joins the cluster and then you should be able to view the regions.

 

You can actually enable rest enabled node via gfsh itself using the gfsh start servercommand with the ** --start-rest-api** option, or set the start-dev-rest-api property to true for the server via the ServerLauncher API. This starts an embedded Jetty server and deploys the Developer REST API WAR file on that server. In this case you no need to start your client as a rest enabled server. In this case your gemfire node exposes REST API and you can use any rest client to invoke REST URLs

 

If you see the example class *RestClientApp* mentioned in the docs

http://gemfire.docs.pivotal.io/95/geode/rest_apps/rest_examples.html

is a simple REST client. You no need to spin a rest enabled server to rest APIs.

 

If you need assistance in design/architecutre/performance of in case of critical issue I would recommend you use raise support request to get required assistance.

Jacky Xu's profile image
Jacky Xu

From the locator log, it seems that the locator is not working well. So at first you need to restart the locator at first. while your gemfireTest.java code is try to start a cacheserver by serverlauncher api. It depends on how you start the cluster(such as gfsh command start a locator and run the serverlauncher api from java client), you needs to make sure that the cluster starts correctly then create region or you can define the regions from cache.xml and refers it from java code.