Aditya Yagnik

+ Follow
since Mar 29, 2010
Aditya likes ...
Eclipse IDE Java
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Aditya Yagnik

Hey Wong,

Adding to Stephan's very clear explanation, using older version of Collection syntax will work - even if you insert different types of objects. However, it is very likely to throw ClassCastException(occurs at runtime and will break your application) when you try to retreive the objects from collection.

Also, since Generics are implemented by type erasure in java, check for <Type> is done only at compile time and types are erased post compilation. Therefore, bytecode(please compare .class files) generated will be exactly same in case of parameterized and non-parameterized collection.

Slightly off the topic, I would recommend you read other uses of Generics if not already - HolderClasses.

Please let us know if you have any questions.

Best regards,
Hey Divya,

I have been studying form Kathy Sierra and Bert Bates book - (Sun Certified Programmer for Java 6 study guide) and have found it extremely useful.

Best regards,
Dear All,

Please can somebody recommend books for Oracle WebLogic Server 10g Developer (1Z0-109) certification. I have tried googling it - however, have not found much help.

Many thanks,
Hey Preethi,

I am unable to understand your requirement. If you want a JTable in a format please can you upload a pictorial representation of the table and I might be able to help you with that.

Best regards,
12 years ago
Hey Reena,

I am not sure what format do you want to see output. However, if its just matter of converting string to double you can use parseDouble method in Double class as below.

Best regards,
12 years ago
Thanks Prabhakar. I have managed to create a topic. Next task is to configure chainsaw to read the log.

Dear Members,

I am trying to put a logging mechanism in place using commons logging and log4j. I have managed to configure for Console and FileAppender. However, I am having difficulty in making JMSAppender work on my local box. Please find below log4j properties file and test code.

Log4j properties:

log4j.appender.JMSAPPENDER =
log4j.appender.JMSAPPENDER.Threshold = DEBUG
log4j.appender.JMSAPPENDER.InitialContextFactoryName = org.apache.activemq.jndi.ActiveMQInitialContextFactory
log4j.appender.JMSAPPENDER.ProviderURL = tcp://localhost:61616
log4j.appender.JMSAPPENDER.TopicBindingName = logTopic
log4j.appender.JMSAPPENDER.TopicConnectionFactoryBindingName = ConnectionFactory

JAVA Class:

package test;
import javax.jms.Connection;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.Session;

import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.command.ActiveMQObjectMessage;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.spi.LoggingEvent;

public class Log4jJMSAppenderExample implements MessageListener {

private static final Log logger = LogFactory.getLog("Log4jJMSAppenderExample.class");
public Log4jJMSAppenderExample() throws Exception {

// create a logTopic topic consumer
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616");
Connection conn = factory.createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageConsumer consumer = sess.createConsumer(sess.createTopic("logTopic"));
consumer.setMessageListener((MessageListener) this);

// log a message"Test log");

// clean up

public static void main(String[] args) throws Exception {
new Log4jJMSAppenderExample();

public void onMessage(Message message) {
try {
// receive log event in your consumer
LoggingEvent event = (LoggingEvent)((ActiveMQObjectMessage)message).getObject();
System.out.println("Received log [" + event.getLevel() + "]: "+ event.getMessage());
} catch (Exception e) {


I am getting below errors. Please can somebody help.

log4j:ERROR Error while activating options for appender named [JMSAPPENDER].
javax.jms.JMSException: Wire format negotiation timeout: peer did not send his wire format.
at org.apache.activemq.util.JMSExceptionSupport.create(
at org.apache.activemq.ActiveMQConnection.syncSendPacket(
at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(
at org.apache.activemq.ActiveMQConnection.createSession(
at org.apache.activemq.ActiveMQConnection.createTopicSession(
at Source)
at org.apache.log4j.config.PropertySetter.activate(
at org.apache.log4j.config.PropertySetter.setProperties(
at org.apache.log4j.config.PropertySetter.setProperties(
at org.apache.log4j.PropertyConfigurator.parseAppender(
at org.apache.log4j.PropertyConfigurator.parseCategory(
at org.apache.log4j.PropertyConfigurator.configureRootCategory(
at org.apache.log4j.PropertyConfigurator.doConfigure(
at org.apache.log4j.PropertyConfigurator.doConfigure(
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(
at org.apache.log4j.LogManager.<clinit>(
at org.apache.log4j.Logger.getLogger(
at org.apache.commons.logging.impl.Log4JLogger.getLogger(
at org.apache.commons.logging.impl.Log4JLogger.<init>(
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
at java.lang.reflect.Constructor.newInstance(
at org.apache.commons.logging.impl.LogFactoryImpl.createLogFromClass(
at org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(
at org.apache.commons.logging.LogFactory.getLog(
at test.Log4jJMSAppenderExample.<clinit>(
Caused by: Wire format negotiation timeout: peer did not send his wire format.
at org.apache.activemq.transport.WireFormatNegotiator.oneway(
at org.apache.activemq.transport.MutexTransport.oneway(
at org.apache.activemq.transport.ResponseCorrelator.asyncRequest(
at org.apache.activemq.transport.ResponseCorrelator.request(
at org.apache.activemq.ActiveMQConnection.syncSendPacket(
... 27 more