[
https://issues.apache.org/jira/browse/AMQ-3764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13290864#comment-13290864
]
Rodrigue Bouleau commented on AMQ-3764:
---------------------------------------
I have the same issue when I want to use the JMSAppender with the failover
option.
I create a small eclipse project (see attachment) with these files:
- Log4jJMSAppenderExample.java
- log4j.xml
- log4j-jms.properties
- jndi.properties
- every jars found in ActiveMQ _lib_ directory
- log4j-1.2.16.jar found in ActiveMQ _lib/optional_ directory
- slf4j-log4j12-1.6.4.jar found in ActiveMQ _lib/optional_ directory
In debug mode, I suspend the two Threads (main & ActiveMQ Task-1).
The main thread is blocked in FailoverTransport
({{FailoverTransport.oneway:524}}).
The ActiveMQ Task-1 is blocked in the TcpTransportFactory during the
instantiation of the Logger ({{Log4jLoggerFactory.getLogger:58}})
{panel:title=Output without failover option|borderStyle=none}
{noformat}
[....]
log4j: Class name: [org.apache.log4j.net.JMSAppender]
log4j: Setting property [initialContextFactoryName] to
[org.apache.activemq.jndi.ActiveMQInitialContextFactory].
log4j: Setting property [providerURL] to [tcp://localhost:61616].
log4j: Setting property [topicBindingName] to [logTopic].
log4j: Setting property [topicConnectionFactoryBindingName] to
[ConnectionFactory].
log4j: Getting initial context.
log4j: Looking up [ConnectionFactory]
log4j: About to create TopicConnection.
log4j: Creating TopicSession, non-transactional, in AUTO_ACKNOWLEDGE mode.
log4j: Looking up topic name [logTopic].
log4j: Creating TopicPublisher.
log4j: Starting TopicConnection.
log4j: Adding appender named [JMS] to category [root].
2012-06-07 08:14:00,935 INFO Log4jJMSAppenderExample - Test log
Received log [INFO]: Test log
{noformat}
{panel}
{panel:title=Output with failover option|borderStyle=none}
{noformat}
[....]
log4j: Class name: [org.apache.log4j.net.JMSAppender]
log4j: Setting property [initialContextFactoryName] to
[org.apache.activemq.jndi.ActiveMQInitialContextFactory].
log4j: Setting property [providerURL] to [failover:tcp://(localhost:61616)].
log4j: Setting property [topicBindingName] to [logTopic].
log4j: Setting property [topicConnectionFactoryBindingName] to
[ConnectionFactory].
log4j: Getting initial context.
log4j: Looking up [ConnectionFactory]
log4j: About to create TopicConnection.
log4j: Creating TopicSession, non-transactional, in AUTO_ACKNOWLEDGE mode.
{noformat}
{panel}
If I remove the jar *slf4j-log4j12-1.6.4.jar* from the classpath, everything
works fine and see the output below:
{panel:title=Output with failover option and without
slf4j-log4j12-1.2.6.4|borderStyle=none}
{noformat}
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further
details.
[....]
log4j: Class name: [org.apache.log4j.net.JMSAppender]
log4j: Setting property [initialContextFactoryName] to
[org.apache.activemq.jndi.ActiveMQInitialContextFactory].
log4j: Setting property [providerURL] to [failover:(tcp://localhost:61616)].
log4j: Setting property [topicBindingName] to [logTopic].
log4j: Setting property [topicConnectionFactoryBindingName] to
[ConnectionFactory].
log4j: Getting initial context.
log4j: Looking up [ConnectionFactory]
log4j: About to create TopicConnection.
log4j: Creating TopicSession, non-transactional, in AUTO_ACKNOWLEDGE mode.
log4j: Looking up topic name [logTopic].
log4j: Creating TopicPublisher.
log4j: Starting TopicConnection.
log4j: Adding appender named [JMS] to category [root].
2012-06-07 08:28:49,467 INFO Log4jJMSAppenderExample - Test log
Received log [INFO]: Test log
{noformat}
{panel}
> JMSAppender cannot connect to activemq using failover
> -----------------------------------------------------
>
> Key: AMQ-3764
> URL: https://issues.apache.org/jira/browse/AMQ-3764
> Project: ActiveMQ
> Issue Type: Bug
> Affects Versions: 5.5.1
> Environment: J2SE 1.5
> activemq-core-5.5.1.jar
> log4j-1.2.14.jar
> geronimo-jms_1.1_spec-1.1.1.jar
> geronimo-j2ee-management_1.1_spec-1.0.1.jar
> slf4j-api-1.5.11.jar
> slf4j-log4j12-1.5.11.jar
> Reporter: LeeDW
>
> Hi All,
> I tried to use Log4jJMSAppenderExample.java and set
> failover:(localhost:61616) property ProvierURL in log4j.properties file.
> But I can not connect to activemq and stop below line.
> log4j: Creating TopicSession, non-transactional, in AUTO_ACKNOWLEDGE mode.
> trace:
> log4j: Parsing appender named "jms".
> log4j: Setting property [initialContextFactoryName] to
> [org.apache.activemq.jndi.ActiveMQInitialContextFactory].
> log4j: Setting property [topicBindingName] to [logTopic].
> log4j: Setting property [topicConnectionFactoryBindingName] to
> [ConnectionFactory].
> log4j: Setting property [providerURL] to [failover:(tcp://localhost:61616)].
> log4j: Getting initial context.
> log4j: Looking up [ConnectionFactory]
> log4j: About to create TopicConnection.
> 2012-03-13 14:28:29,900 DEBUG
> org.apache.activemq.transport.failover.FailoverTransport - Reconnect was
> triggered but transport is not started yet. Wait for start to connect the
> transport.
> 2012-03-13 14:28:30,045 DEBUG
> org.apache.activemq.transport.failover.FailoverTransport - Started.
> 2012-03-13 14:28:30,046 DEBUG
> org.apache.activemq.transport.failover.FailoverTransport - Waking up
> reconnect task
> log4j: Creating TopicSession, non-transactional, in AUTO_ACKNOWLEDGE mode.
> log4j.properties:
> log4j.appender.jms=org.apache.log4j.net.JMSAppender
> log4j.appender.jms.InitialContextFactoryName=org.apache.activemq.jndi.ActiveMQInitialContextFactory
> log4j.appender.jms.ProviderURL=failover:(tcp://localhost:61616)
> log4j.appender.jms.TopicBindingName=logTopic
> log4j.appender.jms.TopicConnectionFactoryBindingName=ConnectionFactory
> Please help and any advise.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira