1 Reply Latest reply on Jun 18, 2009 1:53 PM by Peter Johnson

    Need Help with JMSAppender and Jboss.

    Ind Kon Newbie

      This is my question, I have the following setup in the jboss-log4j.xml on a Jboss server:

      appender name="JMS" class="org.apache.log4j.net.JMSAppender"
      errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"
      param name="InitialContextFactoryName" value="org.jnp.interfaces.NamingContextFactory"
      param name="URLPkgPrefixes" value="org.jboss.naming"
      param name="ProviderURL" value="jnp://myhost.mydomain.com:1099"
      param name="Threshold" value="DEBUG"
      param name="TopicConnectionFactoryBindingName" value="ConnectionFactory"
      param name="TopicBindingName" value="topic/testTopic"

      Now, when I bring up this jboss server, the myhost.mydomain.com does not have to be up necessarily. There are times where it could be down. However, if this myhost.mydomain.com is down, then my jboss server will fail to deploy correctly reporting a " javax.naming.CommunicationException: Failed to connect to server myhost.mydomain.com:1099[Root exception is java.net.ConnectException: Connection refused]]

      How can I make it so that when my jboss server is starting up, and when it comes accross the JMS entry above in the jboss-log4j, it ignores it until that server myhost.mydomain.com:1099 is up? Any ideas?

      Thank you very much.

        • 1. Re: Need Help with JMSAppender and Jboss.
          Peter Johnson Master

          Log4j will attempt to establish the JMS appender as soon as the Log4j system is initialized, and as far as I know there is no way to tell Log4j to ignore an appender that is not yet available.

          However, JBoss AS periodically re-reads the jboss-log4j.xml file and if it sees changes it resets the Log4j system. So later, when you notice that the JMS system is running, you could at that point "touch" the jboss-log4j.xml file and the JMS appender should be established on the next Log4j reset.