1 Reply Latest reply on Nov 8, 2012 8:09 AM by jaikiran

    Accessing an EJB in Jboss 5 from client on Jboss 7

    felipenova

      I have an application on JBoss 7 which accesses an ejb that is in Jboss 5 and did everything told to do:

      -I have created a module with all the libs directory "client" and also the file module.xml.

      -I have created a module with the. Client jar file and my Ejb module.xml the dependency on previous module.

      -In my application on file jboss-deployment-structure.xml put the dependency module with my previous EJB client and part of exclusions I put the module org.picketbox.

      - My lookup was this:

       

      Object retorno = null;
              ClassLoader previousTCCL = Thread.currentThread().getContextClassLoader();
              ClassLoader classLoader = ClienteGesticServiceRemote.getClassLoader();
              Thread.currentThread().setContextClassLoader(classLoader);
              try {
                Properties env = new Properties();
                env.put(Context.PROVIDER_URL,"jnp://10.0.20.142:1099");
                  // Invoke the service
      
               //Verify all the ctx list
                  Context ctx = new InitialContext(env);
                  NamingEnumeration<?> namingEnum = ctx.list(""); 
                  System.out.println("@!@!@! BEGIN");
                  while(namingEnum.hasMoreElements()){   
                    Object obj = namingEnum.nextElement();   
                    System.out.println(obj);   
                  }  
                  System.out.println("@!@!@! END");
      
                  retorno = (Object) ctx.lookup("clienteGesticService");
                               
              } catch(Exception  e){
                  e.printStackTrace();
                
              } finally{
                 Thread.currentThread().setContextClassLoader(previousTCCL);
      
              }
      

       

      But it returns me NamedNotFoundException, but there in Jboss 5 I use @ RemoteBindings named clienteGesticService.
      From 5 to Jboss he works with that name but not the Jboss 7.
      In the code that has put a part that I see who's in context and apparently only shows me the respect of my Jboss 7 spot and not the remote Jboss 5.
      I need it urgently who can help me I thank you.