1 Reply Latest reply on Feb 2, 2004 11:27 PM by ivelin.ivanov

    How to deploy servlets with dependency on a siglenton in a c

    naveen123

      Question : How do I deploy my application such that
      the servlets contain a dependency clause on the
      MBean which is a singleton

      Problem explanation:
      My application is deployed as sar - namely ste.sar which
      declares few JMS queues and a MBean with declaration as follows


      jboss.mq.destination:service=Topic,name=parentConnection
      jboss.ejb:service=EJBDeployer
      jboss:service=Naming
      appstream/ste


      This sar also contains a ste.war. There a 3 servlets defined in this war that depend on the above mentioned MBean deployed and running.

      Now I am trying to device a failover/backup mechanism
      by deploying in a clustered environement similar to the
      Singleton Service pattern described in the article on clustering.
      http://www.onjava.com/pub/a/onjava/2003/08/20/jboss_clustering.html

      I want this "MBean and the servlets" to be controlled by HASingletonController such that it is active on one and only one instance of JBoss and "dormant" on the backup JBoss in the clustered environment, What more do I add to this declaration???


      jboss:service=DefaultPartition
      appstream.ste:service=StreamletEngine
      appstream.ste:service=StreamletEngine
      create
      stop


      The MBean behaves perfectly as a singleton and is active on one JBoss
      The servlets which reference the MBean JNDIName appstream/ste fails to start with this error
      13:50:01,417 INFO [Engine] StandardWrapper[/ste:invoker]: Loading container servlet invoker
      13:50:02,018 ERROR [STDERR] javax.naming.NameNotFoundException: appstream not bound
      13:50:02,018 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
      13:50:02,028 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)

      Goal is not to achieve HTTP Session clustering and load balancing but just a secondary backup server which re-initializes and start when the Master goes down.

      naveen

        • 1. Re: How to deploy servlets with dependency on a siglenton in
          ivelin.ivanov

          One way to deploy a web application that depends on an MBean is to wrap the war with as sar, that declares a dependent mbean.

          I am not sure where the JNDI exception is coming from, but I would like to make sure that you understand that MBeans are not automatically bound in JNDI. MBeans have a different namespace on the MBeans server that is independent of JNDI.

          Ivelin