9 Replies Latest reply on Aug 17, 2002 12:57 PM by adrian.brock

    how does EJB not on JBoss connect to remoteMBean Server?

    bounz

      i use RMIConnectorImpl in ejb to connect remote mbean server within an Agent

      This is my Agent with a mbean server:
      MBeanServer lServer = MBeanServerFactory.createMBeanServer();
      ObjectName lNamingName = new ObjectName(lServer.getDefaultDomain(), "service", "naming");

      org.jboss.naming.NamingService na = new NamingService();
      lServer.registerMBean(na,lNamingName);
      na.setPort(1002);
      lServer.invoke(lNamingName, "create", new Object[0], new String[0]);
      lServer.invoke(lNamingName, "start", new Object[0], new String[0]);
      ObjectName lConnectorName = new ObjectName(lServer.getDefaultDomain(), "service", "RMIAdaptor");
      lServer.createMBean ("org.jboss.jmx.adaptor.rmi.
      RMIAdaptorService", lConnectorName);
      lServer.invoke(lConnectorName, "create", new Object[0], new String[0]);
      lServer.invoke(lConnectorName, "start", new Object[0], new String[0]);


      This is my ejb's ejbCreate() code:

      InitialContext ctx = null;
      Properties env = new Properties();
      env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
      int serverPort = 1002;
      env.setProperty("java.naming.provider.url", "BOUNZ:"+serverPort);
      env.setProperty("java.naming.factory.url.pkgs", "org.jnp.interfaces");

      ctx = new InitialContext(env);
      java.util.Hashtable lProperties = ctx.getEnvironment();
      RMIAdaptor mRemoteAdaptor = (RMIAdaptor)ctx.lookup("jmx:" + "BOUNZ" + ":rmi");
      lConnector = new RMIConnectorImpl (mRemoteAdaptor");

      the above is work fine when one client connect to remote mbean server , but have error when one ejb connect to remote mbean server

      the error on the sun RI j2ee server
      java.security.AccessControlException: access denied (java.net.SocketPermission l
      ocalhost:1024- listen,resolve)
      at java.security.AccessControlContext.checkPermission(AccessControlConte
      xt.java:270)
      at java.security.AccessController.checkPermission(AccessController.java:
      401)
      at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
      at java.lang.SecurityManager.checkListen(SecurityManager.java:1128)
      at java.net.DatagramSocket.bind(DatagramSocket.java:326)
      at java.net.DatagramSocket.(DatagramSocket.java:129)
      at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:91
      5)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1006)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:441)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:434)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at com.ccl.oam.management.agent.ejbConnector.createRMS(ejbConnector.java
      :86)
      at org.jboss.management.mejb.ManagementBean.ejbCreate(ManagementBean.jav
      a:351)
      at org.jboss.management.mejb.ManagementBean_RemoteHomeImpl.create(Manage
      mentBean_RemoteHomeImpl.java:23)
      at org.jboss.management.mejb._ManagementBean_RemoteHomeImpl_Tie._invoke(
      Unknown Source)
      at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(Ge
      nericPOAServerSC.java:520)
      at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(Gen
      ericPOAServerSC.java:210)
      at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAS
      erverSC.java:112)
      at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:255)
      at com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProces
      sor.java:84)
      at com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadP
      ool.java:99)
      createNew!!!!!!!!!!!!!!!!!
      !!! Could not get MBeanInfo object for !!!
      java.lang.NullPointerException
      at com.ccl.oam.management.agent.ejbConnector.createNew(ejbConnector.java
      :148)
      at com.ccl.oam.management.agent.ejbConnector.wantDO(ejbConnector.java:59
      )
      at org.jboss.management.mejb.ManagementBean.ejbCreate(ManagementBean.jav
      a:352)
      at org.jboss.management.mejb.ManagementBean_RemoteHomeImpl.create(Manage
      mentBean_RemoteHomeImpl.java:23)
      at org.jboss.management.mejb._ManagementBean_RemoteHomeImpl_Tie._invoke(
      Unknown Source)
      at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(Ge
      nericPOAServerSC.java:520)
      at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(Gen
      ericPOAServerSC.java:210)
      at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAS
      erverSC.java:112)
      at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:255)
      at com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProces
      sor.java:84)
      at com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadP
      ool.java:99)

        • 1. Re: how does EJB not on JBoss connect to remoteMBean Server?

          Looks like Sun's RI won't let your ejb connect to a
          port < 1024

          Regards,
          Adrian

          • 2. Re: how does EJB not on JBoss connect to remoteMBean Server?
            bounz

            sorry i post wrong error msg.
            this is new

            error:i can get RMI connector,but i cannt use....this RMI connector..

            RMIClientConnectorImpl.start(), got remote connector: org.jboss.jmx.adaptor.rmi.
            RMIAdaptorImpl_Stub[RemoteStub [ref: [endpoint:[140.96.83.171:1506](remote),objI
            D:[3ecfff:efa661597c:-8000, 1]]]]

            listServices!!!!!!!!!!!!!!!!!
            java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
            java.io.InvalidClassException: javax.management.ObjectInstance; local cl
            ass incompatible: stream classdesc serialVersionUID = 642577654802594935, local
            class serialVersionUID = -4099952623687795850
            at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:164)
            at org.jboss.jmx.adaptor.rmi.RMIAdaptorImpl_Stub.queryMBeans(Unknown Sou

            • 3. Re: how does EJB not on JBoss connect to remoteMBean Server?

              Agh,

              Sorry this is my fault.

              The current release of JBossMX is not serialization
              compatible with Sun's JMX implementation. :-(
              Sun didn't release the information until the 1.1
              spec a couple of months ago.

              I've fixed this in my own CVS tree, but I haven't
              finished testing it (got side-tracked onto other work).

              I'll commit this to HEAD this weekend when I've got
              some time. Backporting to 3.0/3.2 won't be until the
              next release.

              If you have control over the jmx implementation on the
              other side, you could always change it to use
              jboss-jmx.jar

              Post it as a bug on sourceforge if you like.

              Regards,
              Adrian

              • 4. Re: how does EJB not on JBoss connect to remoteMBean Server?
                bounz

                thx u very very much, but i still cannt understand what's u mean about "The current release of JBossMX is not serialization compatible with Sun's JMX implementation"

                because both my MBean server and ejb on sun RI code were implemented by JBoss3.0RC's jboss-jmx.jar package not sun RI's jmx package,should i implement my code whih JBossMX's jboss-jmx.jar in cvs tree) ??
                OR i must run my mbean server and ejb on JBoss j2ee server not sun j2ee RI server?

                sorry for my boring questions and poor english,i am new to JBoss ,even dont know about what is cvs' tree,but i will try and post my test result .

                • 5. Re: how does EJB not on JBoss connect to remoteMBean Server?
                  bounz

                  the error which i discussed above happened because i want put the jboss-jsr77.jar on sun j2ee RI,i always failed to query MBeans on the remote mbeans server by ManagementBean,but it's strange that i can mejb.getMBeanCount.....,i go into the ManagementBean.ejbcreate code , i cannt jndi lookup "java:comp/env/Server-Name"in order to get a local Mbean on sun j2ee ri ,because MBeanServer cannt serialize......the other way,i create remote mbeanserver and bind the RMIAdaptorImpl with "jmx:localhost:rmi",i hope ManagementBean 's ejbcreate method can call the adaptorimpl....but i fail.....too..

                  NOW I change to sun j2ee RI with the newest JMX package release, and still fail whe mejb.queryMBean(null,null)
                  because Mismatched serialization UIDs too....

                  mbean server side:
                  sun j2ee RI with MBean server implemented by sun's jmx package

                  client management application side code :
                  InitialContext ic = new InitialContext();
                  Object objref = ic.lookup(System.getProperty("mejb.name", "ejb/mgmt/MEJB"));
                  ManagementHome home = (ManagementHome)PortableRemoteObject.narrow(objref, javax.management.j2ee.ManagementHome.class);
                  MEJB mejb = (MEJB)home.create();
                  System.out.println("mejb count!!"+mejb.getMBeanCount());
                  mejb.queryMBeans(null, null)



                  the error msg on client terminal:
                  mejb count!!31
                  mejb query error-->
                  Exception in thread "main" org.omg.CORBA.MARSHAL: Unable to read value from unde
                  rlying bridge : Mismatched serialization UIDs : Source (Rep. IDRMI:javax.managem
                  ent.ObjectInstance:4F96C8C0875BA686:08EAE4F8F71CBC77) = 08EAE4F8F71CBC77 whereas
                  Target (Rep. ID RMI:javax.management.ObjectInstance:53831E4DA248932A:C71A0ACFAD
                  287B76) = C71A0ACFAD287B76 vmcid: SUN minor code: 211 completed: Maybe
                  at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.read_value(CDRInput
                  Stream_1_0.java:947)
                  at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.read_abstract_inter
                  face(CDRInputStream_1_0.java:853)
                  at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.read_abstract_inter
                  face(CDRInputStream_1_0.java:845)
                  at com.sun.corba.ee.internal.iiop.CDRInputStream.read_abstract_interface
                  (CDRInputStream.java:312)
                  at com.sun.corba.se.internal.io.IIOPInputStream.readObjectDelegate(IIOPI
                  nputStream.java:228)
                  at com.sun.corba.se.internal.io.IIOPInputStream.readObjectOverride(IIOPI
                  nputStream.java:381)
                  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:316)
                  at java.util.HashSet.readObject(HashSet.java:272)
                  at com.sun.corba.se.internal.io.IIOPInputStream.readObject(Native Method
                  )
                  at com.sun.corba.se.internal.io.IIOPInputStream.invokeObjectReader(IIOPI
                  nputStream.java:1298)
                  at com.sun.corba.se.internal.io.IIOPInputStream.inputObject(IIOPInputStr

                  • 6. Re: how does EJB not on JBoss connect to remoteMBean Server?

                    What he's saying is you can't mix different JMX implementations because the Sun guys did not define a common serialization format for 1.0 version.

                    -- Juha

                    • 7. Re: how does EJB not on JBoss connect to remoteMBean Server?
                      bounz

                      why cannt see the reply msg of this subject by juha on Aug 14, 2002 11:02 PM ?? delete?

                      • 8. Re: how does EJB not on JBoss connect to remoteMBean Server?
                        bounz

                        test

                        • 9. Re: how does EJB not on JBoss connect to remoteMBean Server?

                          The serialization changes have been commited onto
                          branches Branch_3_2 and HEAD

                          Regards,
                          Adrian