0 Replies Latest reply on Dec 27, 2005 12:09 AM by haribaasha

    jndi lookup, returns only local ejb in clustered environment

    haribaasha

      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:org.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>