java.lang.ClassNotFoundException: org.jboss.mq.referenceable
dimagh Jan 13, 2006 9:59 PMHello:
I had posted an earlier message but I have moved beyond that after much headache... Here is my latest problem... Any help would be great.
testTopicException: javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: org.jboss.mq.referenceable.ObjectRefAddr (no security manager: RMI class loader disabled)]
java.lang.NullPointerException
at com.message.TopicSendClient.sendMessage(TopicSendClient.java:62)
at com.message.TopicSendClient.main(TopicSendClient.java:19)
Exception in thread "main"
-----------------------------------------------------------------------------------
Following is my class code
package com.message;
import java.util.Hashtable;
import javax.jms.*;
import javax.naming.*;
// Topic client that sends message on a topic
public class TopicSendClient {
TopicConnection conn = null;
TopicSession session = null;
Topic topic = null;
// Main Method
public static void main(String[] args) {
System.out.println("Starting the topic publisher client");
TopicSendClient client = new TopicSendClient();
client.sendMessage("This is test message sent at: " + System.currentTimeMillis());
try {
client.stop();
} catch (JMSException e) {
System.out.println("Exception: " + e);
}
System.out.println("Stopping the topic publisher client");
System.exit(0);
}
// METHOD setupPubSub
public void setupPubSub() throws JMSException, NamingException {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "hp:1099/");
InitialContext intCtx = new InitialContext(env);
Object obj = intCtx.lookup("ConnectionFactory");
TopicConnectionFactory tcf = (TopicConnectionFactory)obj;
conn = tcf.createTopicConnection();
topic = (Topic)intCtx.lookup("aliTopic");
session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
conn.start();
}
// METHID sendMessage
public void sendMessage(String text) {
System.out.print("Getting ready to send message on topic: aliTopic");
try {
setupPubSub();
} catch (JMSException e) {
System.out.println("Exception: " + e);
} catch (NamingException e) {
System.out.println("Exception: " + e);
}
try {
TopicPublisher topicPub = session.createPublisher(topic);
TextMessage msg = session.createTextMessage(text);
topicPub.publish(msg);
System.out.print("Sent message: " + "'" + msg.getText() + ", " + "on topic: aliTopic");
topicPub.close();
} catch (JMSException e) {
System.out.println("Exception: " + e);
}
System.out.println("Ending the TopicSendClient job!");
}
// METHOD stop
public void stop() throws JMSException {
conn.stop();
session.close();
conn.close();
}
}
------------------------------------------------------------------------------------
Thank you,