Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

Multiple SyncProxy Instances

Hello,

I am using m8.

I am confused about how to deal with more than one os-remoting:sync-proxy in a Spring application context file when using <os-remoting:annotation-support/> and @SyncProxy.

The exception I am encountering is:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'No GigaSpaces name given and factory contains several' is defined

The documentation says:

If there are more than one GigaSpace beans defined within the application context, the ID of the giga-space bean needs to be defined on the annotations.

This sounds odd, as you would expect the conflict to occur if there was more than one SyncProxy, not more than one GigaSpace. Logically it seems that @SyncProxy should support a

@SyncProxy(name="<name of="" your="" proxy="" bean="">")

attribute that would take the name of the SyncProxy bean as its value, but it has no such attribute.

Nevertheless, I have tried setting the GigaSpace value:

@SyncProxy(gigaSpace="localSpaceTwoWrite")

but that just changes the exception to:

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spaceTwoWriteBean' defined in file [/home/dan/workspace/TwoPUsClient/TwoPUsClient.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'No GigaSpaces found for name [localSpaceTwoWrite]' is defined

I have worked around this by using setters in my code and reference assignments in my application context file, but I would like to know how to make this work with @SyncProxy.

I am uploading my code, but even a minimal case contains many files, and adjustments have to be made in both the application context file and the bean source code to illustrate the various behaviors. I think it would make sense to begin by understanding whether:

  1. The documentation is correct whent it says to provide a GigaSpace name to @SyncProxy.

  2. This feature (ability to user more than one os-remoting:sync-proxy with <os-remoting:annotation-support/>) has been tested and shown to work with m8.

If you do choose to run the example, note that it takes about 10 seconds to complete because there are configurable sleeps in the two writers that are currently set to 5 seconds each.

Many thanks.

-Dan h4. Attachments

[TwoPUs.jar|/upfiles/13759709379743152.jar]

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=3068]{quote}

asked 2009-05-08 02:28:40 -0500

subuta gravatar image

updated 2013-08-08 09:52:00 -0500

jaissefsfex gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

Hi Dan

There's no issue with having two proxies. The name attribute would not have any use in this case, since it's not a naming conflict.
The problem is related to the fact that each proxy needs an underlying GigaSpace instance (it's space-based remoting after all).
If there's only one such instance in the pu.xml, it used by default.
If there's more than one, you need to specify which one will back the remote proxy.
As for the exception, you specified the name of the of another bean instance and not the GigaSpace instance. It should be:
@SyncProxy(gigaSpace="gigaSpaceTwo")

Also, it's preferable to use ExecutorRemoting, in which case it would look like this:
@ExecutorProxy(gigaSpace="gigaSpaceTwo")

Uri

answered 2009-05-14 07:40:03 -0500

uri gravatar image
edit flag offensive delete link more
0

Hi Uri,

Good stuff. Thanks.

As you know I have already migrated to executor remoting, but I went back and tried what you suggested with sync remoting and it seems to be working fine.

-Dan

answered 2009-05-17 14:49:23 -0500

subuta gravatar image
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2009-05-08 02:28:40 -0500

Seen: 4,623 times

Last updated: May 17 '09