0 Replies Latest reply on Oct 31, 2008 5:50 PM by Pras Po

    How to configure JMSAppender in JBoss?

    Pras Po Newbie

      Hello All,

      I'm trying to configure JMSAppender in JBoss 4.2.3
      I modified the root jboss-log4j.xml (at server/default/conf) to enable the appender.

       <appender name="TESTLOGGINGJMS" class="org.apache.log4j.net.JMSAppender">
       <param name="Threshold" value="ERROR"/>
       <param name="ProviderURL" value="localhost" />
       <param name="InitialContextFactoryName" value="org.jnp.interfaces.NamingContextFactory" />
       <param name="URLPkgPrefixes" value="org.jboss.naming rg.jnp.interfaces" />
       <param name="TopicConnectionFactoryBindingName" value="TopicConnectionFactory"/>
       <param name="TopicBindingName" value="topic/loggingTopic"/>

      I add my own logger to the same file as
       <logger name="com.prpo" additivity="false">
       <appender-ref ref="TESTLOGGINGJMS" />

      When I start the jboss server, looks like the server is waiting for the topic to be created.
      And throws an exception saying

       14:26:34,627 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:jboss-log4j.xml
       log4j:ERROR Error while activating options for appender named [TESTLOGGINGJMS].
       javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]]

      This is because the JMS topic is not created yet. I create the topic via a -service.xml file using MBeans.

      How can I delay initializing the log4j appender until the topic is created?