3 Replies Latest reply on Mar 17, 2003 6:30 PM by genman

    MBeans and Jboss3.2RC2 problem - little help?

    jbone


      Just downloaded RC2 and starting up gives me a problem:

      I have an MBean that starts a server socket and waits for connections. In previous versions of jboss it worked ok, but in RC2 the deployment hangs - it runs the start method and doesnt return (to the main deployment).

      I've seen that recent MBeans extend ServiceMBean - is this necessary? My classes worked fine as the following:

      interface SocketServerMBean{
      init()
      start()
      stop()
      destroy()
      }

      class SocketServer implements SocketServerMBean, Serializable {

      //stuff

      start(){
      ServerSocket gets started in here, waits for conns
      }

      //stuff
      }

      but Im thinking that the interface needs to extend ServiceMBean?
      where do I get info on that interface?
      any examples of code?

      thanks

        • 1. Re: MBeans and Jboss3.2RC2 problem - little help?
          jbone


          just changed the interface for ServiceMBean - still having the same problem.

          do i need to implement preRegister?

          • 2. Re: MBeans and Jboss3.2RC2 problem - little help?
            jbone


            I found out that this is caused by the start() method having a ServerSocket.accept() in it. I gather that this will block.

            There have been some posts about how to properly thread the ServerSocket, but I am trying and a little perplexed - I can create the socket, but can't seem to register it with JNDI (it gives me a serialization error)

            I think a bunch of people have done this kind of thing - can any one of them point me in the right direction? I don't want to use a servlet if I don't have to.

            • 3. Re: MBeans and Jboss3.2RC2 problem - little help?
              genman

              You need to create your own thread which handles the accept calls.

              If any of the start/stop methods block, then JBoss can't start/stop correctly.