• 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

Cannot reference a queue using Simple Java Client

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am trying to send messages from a plain java client to a JMS Queue using the Weblogic Workshop 8.1.

If I change the Connection Factory to weblogic.jms.ConnectionFactory or
weblogic.jws.jms.QueueConnectionFactory, I can get a value for factory in the lookup. Since they
are defaults. I can also get a (connection factory) if I add
java:comp/env/jms/QueueConnectionFactory to Admin Console

Yet the code still can't find the queue when these connection factories are used.

My queue in the Admin console is under CgJMSServer/Destinations, with name: of Synch Queue
JNDI NAme:SynchQueue

( I tried different parameters for looking up queue.)


Can someone recommend which connection factory to use and how I might configure it if necessary and
how the queue can be associated with the connection factory in the code and in the Admin Console.

I have seen examples to write to a queue from another bean using ebjgen tags, but I don't
know how to do the equivalent in a plain java client. It's also not
clear how this config is accomplished in the samples queue example,
which uses a simple java client.

Any assistance would be greatly apprecieated. Thank you!!



My code fragment is as follows:
//Function getinitialContext defined below
Context ic = getInitialContext("t3://localhost:7001", "weblogic", "weblogic");

factory = (QueueConnectionFactory) ic.lookup("java:comp/env/jms/QueueConnectionFactory");
queue = (Queue) ic.lookup("java:comp/env/jms/SynchQueue");
...


static Context getInitialContext(String url, String user, String password) {
InitialContext p =null;
Hashtable h = new Hashtable();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, url);
//h.put(Context.SECURITY_PRINCIPAL, user);
// h.put(Context.SECURITY_CREDENTIALS, password);
try
{
return (new InitialContext(h));
}
catch(Throwable ex)
{
ex.toString();
return p;
}
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Based on the information you provided... should be just:
 
Ken Rubin
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Chris, that worked!

Best Wishes,

Ken
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic