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

Ask Your Question

"Magic" environment variable XAP_LOOKUP_LOCATORS sometimes overrides explicit configuration?


We have configured a client connection to space programmatically:

this.urlSpaceConfigurer = new UrlSpaceConfigurer("jini://host_1.my.domain.com:49150/*/my-space");
this.urlSpaceConfigurer.securityConfig(new SecurityConfig("myUser", "myPassword"));
final IJSpace space = this.urlSpaceConfigurer.space();

The client was started on a UNIX host where in .bashrc the following environment variable was defined:

export XAP_LOOKUP_LOCATORS=host_2.my.domain.com:49150,host_3.my.domain.com:49150

This variable was not explicitly passed to the client Java process using some "-D" property, but it was defined in the UNIX environment.

There are two different space instances: one is registered with LUS on host_1, the other is registered with LUS on host_2 and host_3.

We have observed that the client randomly connects on startup either to one or to another space. This implies that XAP_LOOKUP_LOCATORS is used as a "magic" environment variable which may overwrite explicit configuration. It looks completely random which URL will be used on each connection attempt: sometimes the client connects using an explicitly provided URL, sometimes using a URL from XAP_LOOKUP_LOCATORS.

Is this a bug or a feature?

If this is a feature, please highlight it in the documentation, because this looks very surprising. Especially surprising is a random choice of the URL to connect: I would expect that either explicitly provided URL always has a priority, or a "magic" environment variable always has a priority.

asked 2017-06-09 09:04:55 -0500

Alexey Serdyuk gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-06-09 09:13:02 -0500

shay hassidim gravatar image
edit flag offensive delete link more


Could you please explain why the choice is random? I can't see it from the source code you have pointed to.

Alexey Serdyuk gravatar imageAlexey Serdyuk ( 2017-06-09 09:19:29 -0500 )edit

AFAIK - The LUSs listed as part of the XAP_LOOKUP_LOCATORS are accessed in parallel. The first one respond will be used to bootstrap the proxy.

answered 2017-06-09 09:29:06 -0500

shay hassidim gravatar image
edit flag offensive delete link more


I assume the same applies to the XML-based Spring configuration, right? So if in my Spring config I write:

<bean id="mySpace" class="org.openspaces.core.space.UrlSpaceFactoryBean"> <property name="url" value="jini://host_1:49150/*/my-space"/> <property name="lookupGroups" value="MY_LOOKUP_GROUP"/> </bean>

... but there is an environment variable "XAP_LOOKUP_LOCATORS=host_2.my.domain.com:49150,host_3.my.domain.com:49150", than the client may connect to a LUS on host_1, or host_2, or host_3, choosen randomly?

Alexey Serdyuk gravatar imageAlexey Serdyuk ( 2017-06-09 09:34:46 -0500 )edit

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


Asked: 2017-06-09 09:04:55 -0500

Seen: 32 times

Last updated: Jun 09