3 Replies Latest reply on Aug 11, 2005 9:16 AM by anjani_srikanth

    java.lang.IllegalArgumentException: object is not an instanc

    anjani_srikanth

      Hi all,

      I'm working on a clustered environment and my server details are given below
      a) jboss-4.0.2
      b) J2SDK-1.4.2_09

      I have modified the jndi.properties file in all/conf folder and placed the below content in that file
      java.naming.provier.url=112.16.4.72:1100,112.16.6.112:1100

      In my jboss.xml file, I have defined

       <session>
       <ejb-name>ExampleSLBean</ejb-name>
       <jndi-name>ExampleSLHome</jndi-name>
       <clustered>true</clustered>
       </session>
      


      When I access the JNDIView through web-console i can see the Beans are bound to the Global JNDI Namespace.

      And in my servlet i have written below code to lookup up a Stateless Session bean

      Hashtable hashtable = new Hashtable();
      hashtable.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      hashtable.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
      hashtable.put(Context.PROVIDER_URL, "localhost:1100");
      Context context = new InitialContext(hashtable);
      
      Object objectRef = context.lookup("ExampleSLHome");
      System.out.println("objectRef ::: "+objectRef)
      ExampleSLHome home = (ExampleSLHome) PortableRemoteObject.narrow(objectRef, ExampleSLHome.class);
      


      after the context.lookup("ExampleSLHome") statement, I'm getting the error as
      java.lang.IllegalArgumentException: object is not an instance of declaring class.

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

      thanks