• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JMS Queue : Log4j Warning

 
Csk Kumar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Im using jboss5.1.0GA as an application server. While sending a JMS message to the queue in linux machine its throwing a warning as pasted below:

java SendJmsEvents
log4j:WARN No appenders could be found for logger (org.jnp.interfaces.TimedSocketFactory).
log4j:WARN Please initialize the log4j system properly.
Connection started
Sending an Event to the StateMachine Event=2
Connection stopped

My program SendJmsEvents is able to send text message to the queue but i need to resolve this warning. Please help me out.


Class file for reference :
SendJmsEvents.java

import java.util.Properties;
import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class SendJmsEvents {
QueueConnection conn;
QueueSession session;
Queue que;

public void setupConnection() throws JMSException, NamingException {
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
properties.put(Context.URL_PKG_PREFIXES,
"org.jboss.namingrg.jnp.interfaces");
properties.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099");
InitialContext iniCtx = new InitialContext(properties);
QueueConnectionFactory qcf = (QueueConnectionFactory) iniCtx
.lookup("ConnectionFactory");

que = (Queue) iniCtx.lookup("MyQueue");

conn = qcf.createQueueConnection();
session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
conn.start();
System.out.println("Connection started");
}

public void stop() throws JMSException {
conn.stop();
session.close();
conn.close();
System.out.println("Connection stopped");
}

public void sendAnEventToQueue(String event) throws JMSException {
QueueSender send = session.createSender(que);
TextMessage tm = session.createTextMessage(event);
System.out.println("Sending an Event to the StateMachine Event="+event);
send.send(tm);
send.close();
}

public static void main(String args[]) throws Exception {
SendJmsEvents sm = new SendJmsEvents();

sm.setupConnection();
sm.sendAnEventToQueue("2");
sm.stop();
}

}
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are missing a log4j.properties (or log4j.xml) from the classpath.
 
Csk Kumar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have already set jboss-log4j.xml to the classpath like below:
export CLASSPATH=$CLASSPATH:$JBOSS_HOME/server/default/conf/jboss-log4j.xml

Am still getting the same warning.

My jboss-log4j.xml configuration looks like this:



Here JMSAppender configuration is present only for Topic, but i am using Queue. Will this cause a problem? and if so please let me know how to configure JMSAppender for Queue.
 
Csk Kumar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Waiting for the response. Please reply.
 
Joe Ess
Bartender
Posts: 9313
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be patient. Everyone on the JavaRanch is a volunteer, answering questions in their free time.
As for your problem, one does not specify file names on the classpath unless they are archives like zip or jar files (see our FAQ, HowToSetTheClasspath).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic