A NullPointerException coming from deep in JMS would only be appropriate if the one of the parameters to the Context.lookup was null when it was documented that it should not be null.

I'd use a different value for the TopicConnectionFactoryBindingName.it looks like your JMS impl may have problems with a empty string as a name.

On Feb 12, 2009, at 6:20 AM, Sylvester <[email protected]> wrote:

Hi,
I've been trying to use Log4j with ActiveMQ. I have ActiveMQ running on my system. To setup log4j I use:

JMSAppender appender= new JMSAppender();
      appender.setName("JMSAppender");
      appender.setTopicBindingName("topic");
appender.setTopicConnectionFactoryBindingName(""); //not sure what is supposed to go here
      appender.setLayout(patternLayout);
appender. setInitialContextFactoryName( "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); //is this right? appender.setURLPkgPrefixes(""); //not sure about this one either
      appender.setProviderURL( "tcp://localhost:61616");
      appender.activateOptions();


The appender.activateOptions(); line gives me:

log4j:ERROR Error while activating options for appender named [JMSAppender].
java.lang.NullPointerException
  at javax.naming.InitialContext.getURLScheme(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
  at javax.naming.InitialContext.lookup(Unknown Source)
  at org.apache.log4j.net.JMSAppender.lookup(Unknown Source)
  at org.apache.log4j.net.JMSAppender.activateOptions(Unknown Source)
  at com.Main.main(Main.java:83)

How do I fix this?

Thanks,
Sylvester

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to