Revision: 12838
Author: jean.deruelle
Date: Fri Jul  9 06:07:43 2010
Log: Update Issue 1601

Don't thrown exception for Tomcat, ust log it as a warning
http://code.google.com/p/mobicents/source/detail?r=12838

Modified:
/trunk/servers/jain-sip-ha/jboss-4/src/main/java/org/mobicents/ha/javax/sip/SipStackImpl.java

=======================================
--- /trunk/servers/jain-sip-ha/jboss-4/src/main/java/org/mobicents/ha/javax/sip/SipStackImpl.java Tue Jul 6 07:42:45 2010 +++ /trunk/servers/jain-sip-ha/jboss-4/src/main/java/org/mobicents/ha/javax/sip/SipStackImpl.java Fri Jul 9 06:07:43 2010
@@ -25,6 +25,7 @@

 import java.util.Properties;

+import javax.management.InstanceNotFoundException;
 import javax.management.MBeanServer;
 import javax.management.MBeanServerFactory;
 import javax.management.Notification;
@@ -88,16 +89,20 @@
                try {
                        oname = new ObjectName(mBeanName);
                        if (getMBeanServer() != null && 
!getMBeanServer().isRegistered(oname)) {
-                               getMBeanServer().registerMBean(this, oname);
-                               
if(getStackLogger().isLoggingEnabled(StackLogger.TRACE_INFO)) {
- getStackLogger().logInfo("Adding notification listener for logging mbean \"" + LOG4J_SERVICE_MBEAN_NAME + "\" to server " + getMBeanServer());
-                               }
- getMBeanServer().addNotificationListener(new ObjectName(LOG4J_SERVICE_MBEAN_NAME), this, null, null);
+                               getMBeanServer().registerMBean(this, oname);
                        }
                } catch (Exception e) {
getStackLogger().logError("Could not register the stack as an MBean under the following name", e); throw new SipException("Could not register the stack as an MBean under the following name " + mBeanName + ", cause: " + e.getMessage(), e);
                }
+               try {
+                       
if(getStackLogger().isLoggingEnabled(StackLogger.TRACE_INFO)) {
+ getStackLogger().logInfo("Adding notification listener for logging mbean \"" + LOG4J_SERVICE_MBEAN_NAME + "\" to server " + getMBeanServer());
+                       }
+ getMBeanServer().addNotificationListener(new ObjectName(LOG4J_SERVICE_MBEAN_NAME), this, null, null);
+               } catch (Exception e) {
+ getStackLogger().logWarning("Could not register the stack as a Notification Listener of " + LOG4J_SERVICE_MBEAN_NAME + " runtime changes to log4j.xml won't affect SIP Stack Logging");
+               }
        }

        @Override

Reply via email to