Hi Can anyone help me on this ???? Any directions on this would be extremely helpful ...
Thanks in advance !! On Sun, Oct 11, 2009 at 11:00 PM, Yogesh Rao <yog...@gmail.com> wrote: > Hi, > > I am facing an unusual problem when i try to connect to qpid from within > Log4j. Let me give a overview of what i am trying to do here ... I am > creating my own JMS appender implementation (for some specific reason) and > trying to send the logging message over JMS. This is based on publish > subscribe. I have written sample pub / sub code and it works very well with > qpid. I am trying to move that into JMSAppender and it seems to be throwing > a timeout exception when it tries to createTopicConnection ... > > Below is the code which i have written ... > > public class JMSAppender extends AppenderSkeleton { > > public void activateOptions() { > > try { > > Properties env = new Properties( ); > env.load(new FileInputStream("d:/qpid-config.properties")); > Context jndi = new InitialContext(env); > TopicConnectionFactory topicConnectionFactory = (TopicConnectionFactory) > lookup(jndi, "qpidConnectionFactory"); > Topic topic = (Topic) lookup(jndi, "logTopic"); > if (userName != null) { > > topicConnection = topicConnectionFactory.createTopicConnection(userName, > password); > > } else { > * // here is the problem * > *topicConnection = > topicConnectionFactory.createTopicConnection();* > } > topicSession = > topicConnection.createTopicSession(false,Session.AUTO_ACKNOWLEDGE); > topicPublisher = topicSession.createPublisher(topic); > topicConnection.start(); > jndi.close(); > > } catch (Exception e) { > > e.printStackTrace(); > > } > > > } > > > Below is the exception trace that i get .... > > javax.jms.JMSException: Error creating connection: Timeout waiting for > connection. > at > org.apache.qpid.client.AMQConnectionFactory.createConnection(AMQConnectionFactory.java:325) > at > org.apache.qpid.client.AMQConnectionFactory.createConnection(AMQConnectionFactory.java:296) > at > org.apache.qpid.client.AMQConnectionFactory.createTopicConnection(AMQConnectionFactory.java:348) > at sample.logging.JMSAppender.activateOptions(JMSAppender.java:62) > at > org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:257) > at > org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:285) > at > org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:171) > at > org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:184) > > Do let me know how can i fix the issue... looking at the code i don't see > any problem, strangely this only happens when log4j is trying to connect to > qpid using the appender... could that be a problem ? Please advice... > > Thank you in advance ... > > >