This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jndi lookup, returns only local ejb in clustered environment  RSS feed

 
Hari Sundharesan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i have 3 nodes in a cluster, when i have the EJB in all 3 nodes (including the one with the webservice) and then clustering doesnt happen. all requests are routed to the ejb present in the same node as the webservice ???

node 1 - web service(wsr) & ejb
node 2 - ejb
node 3 - ejb

all requests sent to ejb in node1 itself, nothing sent to node 2 and 3

there shud be some configuration i shud add in jboss.xml or somewhere to forbid this??? i have around 6 services like this and it wud require lot of machines if webservice and ejb cant be deployed in the same node..

the 3 nodes are 10.1.30.57,10.1.30.61,10.1.30.62..

lookup code:

Hashtable _jndiProperties = new hashtable();
_jndiProperties.put( Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory" );

_jndiProperties.put( Context.PROVIDER_URL, "10.1.30.57:7070" );
_jndiProperties.put( Context.URL_PKG_PREFIXES,"org.jboss.naming rg.jnp.interfaces" );
Context context = new InitialContext( _jndiProperties );
Object objref = context.lookup( "UserObjectsEJB" );
NBUserObjectServiceHome userObjectHome = ( NBUserObjectServiceHome )PortableRemoteObject.narrow( objref, NBUserObjectServiceHome.class );
NBUserObjectServiceRemote userObjectRemoteInterface = userObjectHome.create();
_responseString = userObjectRemoteInterface.serviceRequest( userId_, requestString_ );

System.out.println ( "NBWUserObjectService.serviceRequestEJB() The Response is :: " + _responseString );

return _responseString;

jboss.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">

<enterprise-beans>

<ejb-name>UserObjectServiceEJB</ejb-name>
<jndi-name>UserObjectsEJB</jndi-name>
true

</enterprise-beans>
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have JBoss experience but from the lookup code

_jndiProperties.put( Context.PROVIDER_URL, "10.1.30.57:7070" );

you are trying to do the lookup from a particular node rather than from the cluster. Check jboss doc for clusterwide lookup.

In case of WebLogic you can give multiple ip's in the PROVIDER_URL parameter and again lot of other factor decides the load balancing (eg:- server affinity).
 
Hari Sundharesan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
case 1:
node 1: webservive
node2 : ejb
node3 : ejb
when i send in a stream of requests (say 100) even though the context url is pointing to node 2 , the requests are clustered between node 2 and 3 and responses are recd from both nodes.

case 2:
node 1: webservive and ejb
node2 : ejb
node3 : ejb
in this case is where the problem arises.all requests ares sent to the ejb in node 1 itself..dunno why this is happening ???
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do check the document for server affinity. Application server can decide to use the EJB's in node1 to avoid RMI calls and other performance issue. Though I am not sure if this is applicable to JBoss.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!