0 Replies Latest reply on Aug 8, 2005 11:49 AM by windy 009

    Problem accessing EJB in Cluster Environment

    windy 009 Newbie

      Hi all,

      I'm developing a cluster environment in JBoss 4.0.2 and I'm getting the ClassCastException in my Servlet while doing the lookup and the code used for the lookup process is given below.

      Properties p = new Properties();
      p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
      Context context = new InitialContext(p);
      ExampleSLHome exampleSLHome = (ExampleSLHome) context.lookup("ExampleSLHome");
      System.out.println("ExampleSLHome ::: " + exampleSLHome);
      System.out.println("ExampleSLHome Class ::: " + exampleSLHome.getClass());

      the debug statement above is printing as
      ExampleSLHome ::: ExampleSLHomeHome
      ExampleSLHome Class ::: $Proxy12

      For your information I have modified these file to setup a cluster environment
      1) Database Configuration
      a) login-config.xml
      b) standardjaws.xml
      c) standardjbosscmp-jdbc.xml
      d) oracle-ds.xml

      2) Cluster Configuration
      a) cluster-examples-service.xml
      b) server.xml
      c) farm-service.xml

      3) application specific properties
      a) jboss.xml
      <session>
       <ejb-name>ExampleSLBean</ejb-name>
       <jndi-name>ExampleSLHome</jndi-name>
       <clustered>true</clustered>
      </session>
      


      And the same code is woking is a non clustered environment.
      Do I need to make any other configuration for JBoss Clustering.

      I'm not able to find the root cause of the problem.

      Please help me.

      Thank you