• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ClassCastException with JMS.

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am new to the JMS Concept.
I tried with few example progs from the net for JMS.

When I try to look up, I get the following error.

java.lang.ClassCastException: weblogic.jms.common.DestinationImpl
at icomsMsgQueue.MessageProcessor.initSend(MessageProcessor.java:32)
at icomsMsgQueue.ICOMSMsgQueue.sendMsg(ICOMSMsgQueue.java:51)
at icomsMsgQueue.TestCode.main(TestCode.java:11)


This is the source:

public void initSend(String QCFName, String QName, String user, String pass, boolean transacted)
{
try
{
//qcf.createQueueConnection();
System.out.println("3333+++++33333");
qcf = (QueueConnectionFactory) initProcess(QCFName);
System.out.println("3333-----33333");
q = (Queue) initProcess(QName);
qc = ((user != null) && (pass != null)? qcf.createQueueConnection(user, pass): qcf.createQueueConnection());
qs = qc.createQueueSession(transacted, Session.AUTO_ACKNOWLEDGE);
snd = qs.createSender(q);
System.out.println("qcf:"+qcf+" q:"+q+" qc:"+qc+" qs:"+qs+" snd:"+snd);

qc.start();
}
catch(Exception e)
{
e.printStackTrace();
}
}



public Object initProcess(String name)
{
try
{
Hashtable ht = new Hashtable();
System.out.println("11111");
ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.T3InitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
//ht.put("java.naming.security.principal", "weblogic");
//ht.put("java.naming.security.credentials", "welcome");
Context ctx = new InitialContext(ht);
retLookup = ctx.lookup(name);
ctx.close();
System.out.println("1111++++1111"+retLookup);
}
catch(Exception e)
{
e.printStackTrace();
}
return retLookup;
}



Kindly tell me what I am missing out.
If you need any more info, pls let me know.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also faced similar ClassCastException. It got resolved somehow. I am not sure what I did. You can try adding relevant jars - jms.jar,
jbossall-client.jar [I am using jBoss as JMS provider]

Also, make sure that jndi properties are set properly.



-- Navanee
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Change reference from Queue to Destination
reply
    Bookmark Topic Watch Topic
  • New Topic