1 Reply Latest reply on Nov 30, 2006 4:34 PM by K A

    How to access an EJB (3.0) in Jboss from a Client in WebSphe

    Frank Hrouda Newbie

      I want to access a simple EJB (3.0 SLSB), which is deployed in JBoss 4.
      Client is a Web-Application, that runs under WebSphere ApplicationServer V5 which uses JDK 1.3.

      Can anyone give me some hints ?

      Or is it no problem ?? (generating stubs, Annotations, ....)

      Thx.

        • 1. Re: How to access an EJB (3.0) in Jboss from a Client in Web
          K A Newbie

          Hi,

          You need something like this;

          Properties p = new Properties( );
          //Specify the JNDI properties specific to the vendor.
          p.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
          p.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
          p.put("java.naming.provider.url","jboss_host_name");
          Context ctx = new InitialContext(p);
          
          Object ref = context.lookup("path_to_ejb_in_jndi");
          BeanRemoteInterface bean = (BeanRemoteInterface)
           PortableRemoteObject.narrow(ref,BeanRemoteInterface.class);


          And you will need the remote interface on your classpath and the jboss client lib.

          /klejs