• 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

simple JMS example.

 
Ranch Hand
Posts: 223
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am trying to execute this simple example SimpleQueueSender.java from the tutorial provided at http://java.sun.com/products/jms/tutorial/1_3_1-fcs/doc/client.html#1027210

in this example it is creating empty initial context;

jndiContext = new InitialContext();

with empty InitialContext i got (javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial)


so i have modified it to

Properties prop = new Properties();
prop.setProperty(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
prop.setProperty(Context.PROVIDER_URL, "t3://192.168.3.91:7001");
jndiContext = new InitialContext(prop);



after making this changes and looking up for

queueConnectionFactory = (QueueConnectionFactory) jndiContext.lookup("QueueConnectionFactory"); // here it is returning weblogic.jms.common.DestinationImpl.classs

i am still getting java.lang.ClassCastException


i have configured weblogic 8.1 and created new JMS server and created JMSQueue named 'QueueConnectionFactory' and JNDI name 'jndi_QueueConnectionFactory'


what else do i need to add or change to my code or environment

also tell me is this
Context.INITIAL_CONTEXT_FACTORY = "weblogic.jndi.WLInitialContextFactory" right value
******************************************************************************************
 
Author
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
In case that you are unsing a Sun application server version ,you are not using a correct initial context factory class.
here i explained how you can develop and test an end to end jms sample.
hope it helps.

http://weblogs.java.net/blog/kalali/archive/2006/05/step_by_step_to.html
http://weblogs.java.net/blog/kalali/archive/2006/05/step_by_step_to_2.html
one for remote client and one for client and server in same jvm(local client).
 
hasan khan
Ranch Hand
Posts: 223
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the reply,
apart from adding the propertiesthe example provided is fine, the example only require to 1 JMS connection factory and 1 JMS Queue in weblogic server.
[ September 04, 2006: Message edited by: hasaN khaN ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic