0

Is it possible to register more than one @OnServer Function Interface? When we enable more than one Function with @OnServer for Client side proxy, the server fails to start with below error.

Cannot resolve reference to bean 'org.springframework.data.gemfire.function.execution.GemfireOnServerFunctionTemplate#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.data.gemfire.function.execution.GemfireOnServerFunctionTemplate#0': Cannot resolve reference to bean 'gemfireCache' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gemfireCache': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: A connection to a distributed system already exists in this VM. It has the following configuration:

The gemfire functions are placed in a package and below is added to the appContext for component-scanning.

<gfe-data:function-executions base-package="com.test.data.gemfire"/>

Is there a standard practice to register only 1 OnServer function (which sounds too restrictive)? Any pointers would be helpful.

Jebuselwyn Martin
  • 543
  • 1
  • 5
  • 18

1 Answers1

0

Is it possible to register more than one @OnServer Function Interface?

Yes; absolutely!

When we enable more than one Function with @OnServer for Client side proxy, the server fails to start with below error.

This a confused statement. By server, I assume you mean the application, GemFire cache client JVM process. @OnServer annotations are only applicable on a client and cannot be used on a "GemFire Server" (as in a peer cache member of the distributed system).

java.lang.IllegalStateException: A connection to a distributed system already exists in this VM. It has the following configuration:

This is a very old problem (and Exception caused by SDG) indicating that you are using an older version (i.e. < 1.7.0.RELEASE).

A similar problem was cited in SGF-414 when using SSL between the client and server, with an initial fix released in 1.6.2.RELEASE along with 1.7 RC1.

Unfortunately, however, this did not solve the entire problem, so additional work was again performed for the SDG 1.8 RC1 release in SGF-416 as well as SGF-468.

Needless to say, this was a very complicated problem caused by GemFire's Distributed System configuration validation checks and the ability to configure the ClientCache and Pool as separate beans (i.e. by the presence of both <gfe:client-cache> and <gfe:pool> elements in a XML config file) in a Spring context, where proper coordination is required.

So my recommendation to you is, upgrade to the latest Spring Data GemFire release, which is 1.8.3.RELEASE. Also, the latest 1.7.5.RELEASE should work, though I am not entirely certain. You can an always find the latest information on Spring Data GemFire's project page.

If you have additional questions or need help, let me know.

Thanks, John

John Blum
  • 7,381
  • 1
  • 20
  • 30