I am trying to catch the Notification from the JBoss Server in a Servlet. I want to 
know when JBoss is completely initialized and started (I am using 3.2.3 and tomcat). 

Sometimes I can add the listener and sometimes I cannot. Sometimes it says the Server 
is not registered but how can this be when I always see the Server startup 
notification in the logs:

>From the JBoss logs, here is where the Server would send the notification:

10:23:11,094 INFO  [Server] JBoss (MX MicroKernel) [3.2.3 (build: CVSTag=JBoss_3_2_3 
date=200311301445)] Started in 42s:33ms 

Here is an example of when it could not add the listener
Mar 25, 2004 10:14:49
FINEST: Problem initializing JBoss startup Listener jboss.system:type=Server is not 
registered.

Here is an example of the same code successfully adding the listener
Mar 25, 2004 10:23:09 AM 
INFO: Finished initializing JBoss startup Listener
Mar 25, 2004 10:23:11 AMINFO: Received JBoss initialized 
notification=javax.management.Notification[source=jboss.system:type=Server,
type=org.jboss.system.server.started,sequenceNumber=1,timeStamp=1080238991094,
message=null,userData=42033]

This is how I add the listener in a Servlet:

import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.management.MBeanServerNotification;
import javax.management.Notification;
import javax.management.NotificationFilterSupport;
import javax.management.NotificationListener;
import javax.management.ObjectName;
import org.jboss.system.server.Server;

<STUFF DELETED>

            server = (MBeanServer)
                MBeanServerFactory.findMBeanServer(null).iterator().next();

            listener = new MyNotificationListener();

            object = new ObjectName("jboss.system:type=Server");

            filter = new NotificationFilterSupport();
            filter.enableType(Server.START_NOTIFICATION_TYPE);

            try {
                // if you wanted to find out about register/unregister, use
                //new ObjectName("JMImplementation:type=MBeanServerDelegate"),
                // we are interested in the start/stop of jboss only, use
                // "jboss.system:type=Server"
                server.addNotificationListener(
                    object, listener, filter, null);

                // listener set to true when Jboss Server notification received
                JBossStarted = false;
                logger.log(java.util.logging.Level.INFO,
                           "Finished initializing JBoss startup Listener");
            }
            catch (Exception listenerProblem) {
                logger.log(java.util.logging.Level.FINEST,
                           "Problem initializing JBoss startup Listener" +
                listenerProblem.getMessage());
            }

<a 
href="http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3827460#3827460";>View 
the original post</a>

<a 
href="http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3827460>Reply 
to the post</a>


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to