1 Reply Latest reply on Dec 20, 2005 11:34 PM by Hari Sundharesan

    EJB clustering help!

    Hari Sundharesan Newbie

      hi
      i have 4 nodes in a cluster, when i deploy my webservice in one of the nodes and the EJB's in the other 3 nodes it seems to be working fine, the load is balanced(i.e when i send 50 requests they are split to the 3 nodes etc) , failover happens fine..

      but when i have the EJB in all 4 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 ???

      first case:

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

      clustering,failover working fine, all requests are sent to node2 and node 3

      second case:
      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..

      lookup code:

      if ( !isValidUser ){
      _responseString = " User Not Authenticated";
      return _responseString;
      }

      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>



      ,
      hari

        • 1. Re: EJB clustering help!
          Hari Sundharesan Newbie

          this method is called jsut be4 the context is created...


          method:
          try{
          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" );
          }catch( Exception exc_ ){
          exc_.printStackTrace();
          }