4 Replies Latest reply on Apr 24, 2006 8:05 PM by bobfinkle

    Remote accessibilty of MEJB

    ivrajesh

      Hi,

      To access the MEJB there is standard code said in the JSR77 specification. This speaks more about getting an MEJB (ejb) remote
      instance and accesing it.

      Now assume that i want to access the MEJB from a remote location that means the client is in different JVM and also the client is
      not a application in that application server. How can i achieve this?.

      Please your help is greatly appreciated.

      Thanks,
      Rajesh I.V

        • 1. Re: Remote accessibilty of MEJB
          mclaugs

          if I am understanding your question, you are asking how do I access the MEJB from a remote machine?

          you have to setup the InitialContext like you would for any accessing any EJB from a remote machine. this is described in the documentation.

          After you get the InitialContext you need to do a jndi lookup for the "ejb/mgmt/MEJB"

          for this to work you need to make sure that the jboss-jsr77-client.jar is in your classpath, it has the remote and home interfaces for the MEJB. This file is in the client directory of the distribution.

          • 2. Re: Remote accessibilty of MEJB
            ivrajesh

            Hi,

            I didn't find any jar by name jboss-jsr77-client.jar in JBoss_3_0_4.If i deploy a client application in the server and could successfully
            invoke mejb.

            My concern is, to access the mejb from a different JVM (client which is not an application in the appserver). The following is the
            piece of code i used in my client application.

            Properties props = new Properties();
            props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
            props.setProperty("java.naming.provider.url","localhost:1099");
            props.setProperty("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
            Context ctx = new InitialContext(props);
            NamingEnumeration enu = ctx.listBindings("ejb");
            while(enu.hasMoreElements()){
            System.out.println(" The element is : "+enu.nextElement().toString());
            }
            Object objref = ctx.lookup("ejb/mgmt/MEJB");
            ManagementHome home = (ManagementHome)PortableRemoteObject.narrow(objref,ManagementHome.class);
            Management mejb = home.create();
            String domain = mejb.getDefaultDomain();
            Set names = mejb.queryNames(new ObjectName("*:*"),null);

            I have set almost all the jars in the classpath of my client and i couldn't not invoke mejb.
            I get the following error

            javax.naming.CommunicationException. Root exception is java.io.InvalidClassException:
            org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy; Local class not compatible: stream classdesc
            serialVersionUID=-3713605626489646730 local class serialVersionUID=4948756606502181321

            Please suggest is there any ways to do it or am going wrong anywhere.

            Thanks for all your support.

            Rajesh I.V


            • 3. Re: Remote accessibilty of MEJB
              ivrajesh

              Hi,

              I didn't find any jar by name jboss-jsr77-client.jar in JBoss_3_0_4.If i deploy a client application in the server and could successfully
              invoke mejb.

              My concern is, to access the mejb from a different JVM (client which is not an application in the appserver). The following is the
              piece of code i used in my client application.

              Properties props = new Properties();
              props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
              props.setProperty("java.naming.provider.url","localhost:1099");
              props.setProperty("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
              Context ctx = new InitialContext(props);
              NamingEnumeration enu = ctx.listBindings("ejb");
              while(enu.hasMoreElements()){
              System.out.println(" The element is : "+enu.nextElement().toString());
              }
              Object objref = ctx.lookup("ejb/mgmt/MEJB");
              ManagementHome home = (ManagementHome)PortableRemoteObject.narrow(objref,ManagementHome.class);
              Management mejb = home.create();
              String domain = mejb.getDefaultDomain();
              Set names = mejb.queryNames(new ObjectName("*:*"),null);

              I have set almost all the jars in the classpath of my client and i couldn't not invoke mejb.
              I get the following error

              javax.naming.CommunicationException. Root exception is java.io.InvalidClassException:
              org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy; Local class not compatible: stream classdesc
              serialVersionUID=-3713605626489646730 local class serialVersionUID=4948756606502181321

              Please suggest is there any ways to do it or am going wrong anywhere.

              Thanks for all your support.

              Rajesh I.V

              • 4. Re: Remote accessibilty of MEJB
                bobfinkle

                I have had the same problem in trying to use MEJB. I finally found the missing information at http://wiki.jboss.org/wiki/Wiki.jsp?page=JSR7ManagementEJB. I'm not sure why no one has posted the fix sooner. In any case, its very simple. The MEJB is not deployed by default. You have to copy docs/examples/jmx/ejb-management.jar to your jboss-4.0.4.CR2\server\default\deploy (for jboss 4.0.4). After doing this I had not trouble doing a lookup on "ejb/mgmt/MEBJ".