java.lang.ClassCastException: org.jboss.mq.SpyTopic
Hey all,
I've been struggling with JBoss queues over the past few days, and I think I'm almost there, but now I'm getting a new exception.
Properties env =new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
env.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
env.put(Context.PROVIDER_URL,"jnp://<remote ip address>:1099");
topicName =new String("<Topic Name>");
System.out.println("Topic name is " + topicName);
// Create a JNDI API InitialContext object if none exists
try{
jndiContext =new InitialContext(env);
}catch (NamingException e){
System.out.println("Could not create JNDI API " +
"context: " + e.toString());
System.exit(1);
}
try{
topicConnectionFactory = (TopicConnectionFactory)
jndiContext.lookup("topic/<Topic Name>");
topic = (Topic) jndiContext.lookup(topicName);
}catch (NamingException e){
System.out.println("JNDI API lookup failed: " +
e.toString());
System.exit(1);
}
The exception being thrown is:
Exception in thread "main" java.lang.ClassCastException: org.jboss.mq.SpyTopic
at SimpleTopicReceiver.main(SimpleTopicReceiver.java:43)
I haven't found much help online on this issue. Any help would be appreciated. The line throwing the exception is:
topicConnectionFactory = (TopicConnectionFactory)
jndiContext.lookup("topic/<Topic Name>");
Thanks

