Thanks for the responses.

I checked the versions. I was playing around with spring-data-geode as
well, maybe that might have had a different version. now I created a
separate project with just geode core 1.7 dependency and the version
problem seems to be gone away.

Now, when I use a Cache like earlier, I connect to the server but get the
following error which is aligned with Udo's comment.

Exception in thread "main"
org.apache.geode.cache.execute.FunctionException: The cache was not a
client cach

So I changed the Cache to a ClientCache and this time I get the following
error.

Code:

ClientCache cache = new ClientCacheFactory()
                .addPoolLocator("localhost", 10334)
                .set("log-level", "WARN")
                .create();

Error :
Exception in thread "main" java.lang.UnsupportedOperationException:
operation is not supported on a client cache
at
org.apache.geode.internal.cache.GemFireCacheImpl.throwIfClient(GemFireCacheImpl.java:5354)
at
org.apache.geode.internal.cache.GemFireCacheImpl.createRegionFactory(GemFireCacheImpl.java:4629)
at
com.mmodal.Geode.CreateRegionFunction.createRegionAttributesMetadataRegion(CreateRegionFunction.java:74)
at
com.mmodal.Geode.CreateRegionFunction.<init>(CreateRegionFunction.java:24)

Also, When I tried using PoolManager.find("DEFAULT") for the onServers(), I
get the below error.

Exception in thread "main"
org.apache.geode.cache.execute.FunctionException: Pool instance  passed is
null
at
org.apache.geode.cache.execute.internal.FunctionServiceManager.onServers(FunctionServiceManager.java:167)
at
org.apache.geode.cache.execute.FunctionService.onServers(FunctionService.java:95)
at Main.main(Main.java:31)

Marcus






On Tue, Oct 30, 2018 at 4:45 PM Udo Kohlmeyer <u...@apache.org> wrote:

> From the exception, it seems that you are not using the same version of
> Geode. Could you look into that...
>
> Also, when creating a client, you use "ClientCacheFactory" and define a
> pool pointing at the locators.
> https://geode.apache.org/docs/guide/16/topologies_and_comm/cs_configuration/client_server_example_configurations.html
>
> ClientCache c = new ClientCacheFactory().addPoolLocator(host, port).create();
>
> FunctionService.onServers(PoolManager.find("DEFAULT")).execute("FunctionName").getResult()
>  //I think the default pool created is called "DEFAULT".
>
> That should hopefully connect to your servers, where the functions have
> been deployed, invoke the function and return the result back to the client.
>
> --Udo
>
> On 10/30/18 13:13, Marcus Dushshantha Chandradasa wrote:
>
> Hi All,
>
> I am trying to figure out how to programmatically create Regions on a
> Geode Cluster. I followed below links but without any success.
>
>
> https://geode.apache.org/docs/guide/16/developing/region_options/dynamic_region_creation.html
>
> https://stackoverflow.com/questions/50833166/cannot-create-region-dynamically-from-client-in-geode/50850584
>
> So far, I have the CreateRegionFunction and CreateRegionCacheListener copied
> and JARed them together. I am referig them in my client as well as added to
> the classpath for Geode Cluster. Below is my client code. I am receiving
> the below error when I try to execute. Any help would be really
> appreciated.
>
> Error :
>
> SEVERE: Servlet.service() for servlet [dispatcherServlet] in context with
> path [] threw exception [Request processing failed; nested exception is
> org.apache.geode.SystemConnectException: Rejecting the attempt of a member
> using an older version of the product to join the distributed system] with
> root cause
> org.apache.geode.SystemConnectException: Rejecting the attempt of a member
> using an older version of the product to join the distributed system
> at
> org.apache.geode.distributed.internal.membership.gms.membership.GMSJoinLeave.attemptToJoin(GMSJoinLeave.java:433)
> at
> org.apache.geode.distributed.internal.membership.gms.membership.GMSJoinLeave.join(GMSJoinLeave.java:329)
> at
> org.apache.geode.distributed.internal.membership.gms.mgr.GMSMembershipManager.join(GMSMembershipManager.java:664)
>
>
>
> Cache cache = new CacheFactory()
>         .set( ConfigurationProperties.LOCATORS, 
> "localhost[10334],localhost[10335]")
>         .create();Execution execution = 
> FunctionService.onServers(cache);ArrayList argList = new 
> ArrayList();argList.add("region_new");RegionAttributes attr = new 
> AttributesFactory().create();argList.add(attr);Function function = new 
> CreateRegionFunction();//FunctionService.registerFunction(function);Object 
> result = execution.setArguments(argList).execute(function).getResult();
>
>
>

Reply via email to