Just wondering, is it even possible to lookup a ejb on a specific node in the cluster?
We do this on one node, to look up ejb proxy on another node:
Properties prop = new Properties();
InitialContext ct = new InitialContext(prop);
Object res = ct.lookup(jndiName);
This always returns a proxy for the current node not the remote one. We were hoping, that the scoped.context would serve exactly this purpose?
Is there a known bug with this in 7.2.0.Final?
What you try to do? Lookup a remote EJB inside of an EJB?
A scoped context has several issues, i.e. you need to use *.close() after use otherwise you will run into a connection leak.
Could you describe what you try to achieve?
we want to achieve this:
- "Mark" one node of the cluster as master using a HA SingletonService as described in the cluster-ha-singleton quickstart
- Deploy our former cluster singletons as node singletons
- Use only the node singleton on the "master" by checking on which node the service is running
So this is what we do:
1) have the service running and returning its ip, port and node
2) access it through a regular SLSB via injection
3) ask this SLSB for the master connection (ip/port/node)
4) connect to the desired node singleton on the cluster node returned by our master service
We are struggeling with step 4, which we are trying to solve as described before. The problem is this:
- Cluster with two nodes (A) and (B)
- (B) is started first and running our master service
- (A) wants to access a singleton and acquires the connection information from (B)
- When we construct a InitialContext with this information, the lookup returns a proxy for the singleton on (A)
We tried to disable mod-cluster by setting a simple load provider and by completly removing the subsystem configurations, but had no success.
We also tried multiple variations of properties, but as far as I know, thos that I posted before should be the right ones...
Any hint/link/guide would be awesome,
We now switched to Wildfly 8.2.0 but the behavior is still the same. If anybody sees our error here or has some suggestion, please let me know!