Session Bean trying to send a message to Websphere MQ5.3

Hello all,
I use WSAD5.1 and Websphere MQ 5.3. Websphere MQ is installed on a
Solaris box with a Queue Manager configured and several queues created on it.
The WSAD, is running on a different machine. I have written a session bean with a method, putMessage( ).
Inside this putMessage( ), I'm supposed to send a message to one of the
queues configured in Websphere MQ running on the solaris box. How should I code in my putMessage( ) method, so that I'm able to send a message to the queue.
My major doubt is I need to look up for the QueueConnectionFactory and also the queue inside the session bean. I doubt if this is possible using JNDI.
I'm coding as per EJB2.0 specs.
Can someone guide me what is the right approach so that I'm able to send a message from sessionbean to a queue.
If someone could point to some kind of example code, that would be great.
P.S. I know, how to code if I create the queue and QueueConnectionFactory, in WSAD, i.e., in the Server configuration.
But what I don't know is, how to code if I'm using MQ Series running
elsewhere.
Thanks in advance,
Pandit.
Please get back to me if you need any clarifications.

try this : (you need some mq libraries (search for ma88 in google ( MQSeries classes for Java and MQSeries classes for Java))
import com.ibm.mq.*; // Include the WebSphere MQ classes for Java package
public class SendMessageToMQ
private String qManager = "AIXD004"; // define name of queue // manager to connect to.
private MQQueueManager qMgr; // define a queue manager
// object
public static void main(String args[]) {
new SendMessageToMQ();
public SendMessageToMQ() {
    // Set up WebSphere MQ environment
MQEnvironment.hostname = "192.168.19.41";
MQEnvironment.port=1415;
// hostname & channel
//MQEnvironment.channel = "S_ibcn_c029"; // string directly here!
//MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES);//Connection
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT);
MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
   try {
      // Create a connection to the queue manager
      qMgr = new MQQueueManager(qManager);
      // Set up the options on the queue we wish to open...
      // Note. All WebSphere MQ Options are prefixed with MQC in Java.
      int openOptions = MQC.MQOO_INPUT_AS_Q_DEF |
      MQC.MQOO_OUTPUT ;
      // Now specify the queue that we wish to open,
      // and the open options...
      MQQueue system_default_local_queue =
      //qMgr.accessQueue("ENTEST1.HOST.ASYNC.RECEPCION",
      qMgr.accessQueue("QNO.0002.AIXD004.L",
      openOptions);
      // Define a simple WebSphere MQ message, and write some text in UTF format..
      MQMessage hello_world = new MQMessage();
      hello_world.writeUTF("Hello World!");
      // specify the message options...
      MQPutMessageOptions pmo = new MQPutMessageOptions(); // accept the // defaults,
      // same as MQPMO_DEFAULT
      // put the message on the queue
      system_default_local_queue.put(hello_world,pmo);
      // get the message back again...
      // First define a WebSphere MQ message buffer to receive the message into..
      MQMessage retrievedMessage = new MQMessage();
      // Set the get message options...
      MQGetMessageOptions gmo = new MQGetMessageOptions(); // accept the defaults
      // same as MQGMO_DEFAULT
      // get the message off the queue...
      system_default_local_queue.get(retrievedMessage, gmo);
      // And prove we have the message by displaying the UTF message text
      //String msgText = retrievedMessage.readUTF();
      String msgText = retrievedMessage.readUTF();
      System.out.println("The message is: " + msgText);
      // Close the queue...
      system_default_local_queue.close();
      // Disconnect from the queue manager
      qMgr.disconnect();
  // If an error has occurred in the above, try to identify what went wrong
  // Was it a WebSphere MQ error?
  catch (MQException ex)
  System.out.println("A WebSphere MQ error occurred : Completion code " +
  ex.completionCode + " Reason code " + ex.reasonCode);
  // Was it a Java buffer space error?
  catch (java.io.IOException ex)
  System.out.println("An error occurred whilst writing to the message buffer: " + ex);
} // end of sample

Similar Messages

  • My Apple store ID password is not working, so I tried to send a message to my Yahoo email (ID) the new password, so when it said that a massage was send to my email, but when I login to my yahoo email, I didn't receive any email from apple

    My  other apple store ID ([email protected]) password is not working, so I tried to send a message to my Yahoo email (ID) the new password, so when it said that a massage was send to my email, but when I login to my yahoo email, I didn’t receive any email from apple

    You can send over WiFi, but it sounds as if you need to setup your Gmail account, or did you do this already?

  • Network authentication failed error message when trying to send picture messages

    I have a family member who is trying to send picture messages from Dubois, WY.  Verizon's map shows that Dubois is in the extended enhanced services area.  I am guessing that this may be one of those instances where the coverage map is not 100% accurate.  Please let me know if you have any other ideas or suggestions as to what the problem might be or how to resolve it.

    Customers have the ability to take pictures / videos anywhere. However, messages can only be sent, received, or uploaded, while in the Verizon Wireless National Enhanced Services Rate and Extended Network Coverage Area.
    Try dialing *228 send and option 2 to update the PRL on the phone.  Updating the PRL or Preferred Roaming List, ensures the phone is getting the best service possible.  
    You can also check the coverage area at the link below:
    http://www.verizonwireless.com/b2c/CoverageLocatorController?market=all

  • TS2755 when trying to send a message, I have an error message that a particular addressee is not registered with imessage.  How is this corrected?

    I just purchased the latest ipad.  When trying to send a message, the addressee indicates an error stating that it has not been registered with imessage and to remove it.  How can this be corrected.

    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    iOS: About Messages
    http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90
     Cheers, Tom

  • When trying to send a message an error says phone not registered in imessage.

    When trying to send a message from my ipad some numbers say not registered with imessage. How do I register a number?

    Hi lkgallagher24,
    If you are talking about registering your own phone number with iMessage, you may find the following article helpful:
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    Regards,
    - Brenden

  • I'm from the uk and I'm trying to send a message to someone who lives in the US, however it does not recognise that they have an iPhone so it won't send as an iMessage, any solutions?

    I'm from the uk and I'm trying to send a message to someone who lives in the US, however it does not recognise that they have an iPhone so it won't send as an iMessage, any solutions?

    Hi Will_medlock,
    If you are having issues sending iMessages to a specific person overseas, you may find the following article helpful:
    iOS: Troubleshooting Messages
    http://support.apple.com/kb/ts2755
    Regards,
    - Brenden

  • [svn] 1774: Bug: BLZ-176 - Not getting an authentication error when Producer tries to send a message over streaming channel with insufficient credentials .

    Revision: 1774
    Author: [email protected]
    Date: 2008-05-16 13:29:10 -0700 (Fri, 16 May 2008)
    Log Message:
    Bug: BLZ-176 - Not getting an authentication error when Producer tries to send a message over streaming channel with insufficient credentials.
    QA: Yes
    Doc: No
    Checkintests: Pass
    Details: This was caused by the fact that streaming channels do not report connected until the initial ping completes and a URLStream is established with the server. Added some extra code in ChannelSet to make sure authentication errors are reported with correct faultCode even if the channel is not reporting connected.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/BLZ-176
    Modified Paths:
    flex/sdk/branches/3.0.1.x/frameworks/projects/rpc/src/mx/messaging/ChannelSet.as

    Revision: 1774
    Author: [email protected]
    Date: 2008-05-16 13:29:10 -0700 (Fri, 16 May 2008)
    Log Message:
    Bug: BLZ-176 - Not getting an authentication error when Producer tries to send a message over streaming channel with insufficient credentials.
    QA: Yes
    Doc: No
    Checkintests: Pass
    Details: This was caused by the fact that streaming channels do not report connected until the initial ping completes and a URLStream is established with the server. Added some extra code in ChannelSet to make sure authentication errors are reported with correct faultCode even if the channel is not reporting connected.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/BLZ-176
    Modified Paths:
    flex/sdk/branches/3.0.1.x/frameworks/projects/rpc/src/mx/messaging/ChannelSet.as

  • While trying to send a message to the receipient outside the domain...

    While trying to send a message to the receipient outside the domain,the server
    sends back the delivery error email message to the sender. this is OK. But for
    some reason the the mail server keeps searching for the wrong recepient and
    sending back the deleivery error email to the sender periodically. In this way,
    it has sent around 450 such messages to my mailbox.
    the mail delivery error looks like this :
    451.. Name Server timeout while searching a.com in DN
    Reporting -MTA;: dns; s-ghq-csc-ocsapp1.tawasul.mil.ae
    Received -From-MTA:DNS;w-anh-sic-004.ANH.mil.ae
    Final Recepient:RFC822; [email protected]
    ACtion: Failed
    Remote-MTA:DNS; a.com
    Diagnostic-Code:SMTP;451... Name server timeout while searching a.com in DNS
    Last-Attempt-Date:Tue, 18Feb 2003 08:34:38 =0000
    solution ???

    Hi,
    This is apparently the week for integration questions!
    There's no such product as "WebLogic MQ". I assume that what your trying to do is communicate with MQSeries or some other non-WebLogic vendor.
    You cannot use a WebLogic client to communicate with MQ or vice-versa. You must create an MQ client using a MQ JMS connection factory in order to communicate with an MQ destination. Similarly, you must create a WL client using a WL connection factory in order to communicate with a WL destination. This advice applies to any JMS vendor, and is quite similar to the way JDBC drivers work.
    Note that if you're communicating with MQ from a client rather than an application that's running on a WebLogic server, then there's often little purpose in using the "Foreign JMS" mapping facilities (in addition, these facilities may not work on the client for all foreign vendors -- I assume it depends on whether the foreign vendor connection factories and destinations are fully serializable/transferable between JVMs). Instead, you might want to consider using the standard JNDI and JMS APIs to communicate with MQ directly (eg, there's no need to involve WebLogic code in this case).
    For information on integration, see the WebLogic doc for [ Integrating Remote JMS Providers | http://download.oracle.com/docs/cd/E12839_01/web.1111/e13727/interop.htm#JMSPG553 ] and, if the "MQ" your refering to in this case happens to be MQSeries, also see the blog post [Integrating WebSphere MQ 6 with BEA Weblogic Server 10|http://ibswings.blogspot.com/2008/02/integrating-mq-broker-6-with-bea.html].
    Note that the majority of MQSeries integration customer apps that I've run across require "exactly-once" behavior, which means they must run on a WebLogic server (not a client) in order to participate in a WebLogic JTA transaction.
    Hope this helps,
    Tom

  • I am receiving email messages but when trying to send a message, it is stuck in the outbox,

    I am receiving email but when trying to send a message, it is stuck in the outbox, never makes it to the sent messages, used to have same problem with Vista on a Dell, have had this Toshiba with Windows 7 since Sept, first time this has happened, need help and thanks, RR

    which computer? which mail program?
    -civicman4-
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Post all info about your laptop and version of windows. We are working on it but still do not have the powers to read your mind.

  • HT3529 I am trying to send a message and it says the person is unavailable by imessage at this time

    I am trying to send a message to someone's ipod touch and it keeps saying the person is unavailable by imessage at this time. however I was able to reach this person yesterday. She did an apple id change yesterday and since then I can not message her. I can facetime her and email her but I can not message her. On her ipod touch it shows when I am typing and I can receive her messages but she can not receive mine. Other people in my family tested their messages and they are able to reach her but not me. Is there something wrong on my end?

    I tried that. Did not work. When I try to add her to message her it turns green and at the top it says new mms and then it sends my message to her email not to her ipod touch as an imessage.

  • Keep trying to send a message and it wont go through i keep getting a message that says network problems cause code :3 what does that mean

    keep trying to send a message and it wont go through I keep getting a message pop up that says network problems cause code :3 what does this mean

    SMS Error: Cause Code 3, Error Code 2

  • I tried to send too large an attachment using mail,and now mail is hung up trying to send any message.  How do I reset mail?

    I tried to send too large an attachment using mail,and now mail is hung up trying to send any message.  How do I reset mail?

    It will time out, if it hasn't already. Delete the message from the Outbox.

  • Mac desktop. trying to send email, message:  SMTP failed?  No new changes to computer.

    Mac desktop, trying to send email, message say-SMTP failed.  No new changes have been made to this Mac.

    iOS does not run on Macs.
    Not knowing your operating system or Mail program we can't give you much detailed help.   Go to Apple menu -> About This Mac to find your Mac OS or Mac OS X version.  If it is an X version, please post in the right forum:
    http://discussions.apple.com/docs/DOC-2463
    SMTP servers are of two types.   Those associated with the internet provider giving you the internet access.  I.e. if you have Verizon FiOS for Fiberoptic internet your SMTP server would be something based on verizon.net.   And those associated with separate web/e-mail host providers if you have a personal website or e-mail provider you chose from before you switched to the current internet access provider.   If the latter, it is possible the internet access provider, in order to prevent being implicated from being the source of spam has decided to enforce port or password authentication on the SMTP server to ensure you aren't a spam bot.  In that event, you'll probably have to check with them if it is better to use port 2626, 2662, or 587, and password authentication.  You may have to check with both e-mail provider and internet access provider.    Usually when you have separate providers doing both, your e-mail address is your username, and password on password authentication is same as checking your e-mail.

  • My iphone 4 says outgoing whenever i send an sms to multiple recipients.  does this mean it's still trying to send the message?

    my iphone 4 says outgoing whenever i send an sms to multiple recipients.  does this mean it's still trying to send the message?

    Perhaps someone from Apple could reply to this rather than leaving it unanswered?

  • JMS Exception while trying to send a message on Login

    I am getting the following exception while trying to send a JMS message after the login.
    2012-06-01 12:09:30,688 ERROR [nucleusNamespace.com.tesco.events.manager.ILActivityManager] JMSException Occured
    javax.jms.JMSException: A transaction-related exception occurred while trying to obtain a JMS Session from provider "Login": javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.syncwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.syncwhenaborted] Can't register synchronization because the transaction is in aborted state
         at atg.dms.patchbay.SessionManager.getSession(SessionManager.java:190)
         at atg.dms.patchbay.Provider.getQueueSession(Provider.java:632)
         at atg.dms.patchbay.OutputDestination.getPooledSession(OutputDestination.java:268)
         at atg.dms.patchbay.OutputPort.getPooledSession(OutputPort.java:156)
         at atg.dms.patchbay.ElementManager.createTextMessage(ElementManager.java:848)
         at atg.dms.patchbay.ElementManager.createTextMessage(ElementManager.java:546)
         at atg.dms.patchbay.ElementManager.createTextMessage(ElementManager.java:557)
         at com.tesco.events.manager.ILActivityManager.sendLogMessage(ILActivityManager.java:81)
         at com.tesco.events.manager.ILActivityManager.logActivity(ILActivityManager.java:69)
         at com.tesco.events.listener.ATGLogEventListenerImpl.logActivity(ATGLogEventListenerImpl.java:46)
         at com.tesco.events.source.ATGLogEventSource.logActivity(ATGLogEventSource.java:61)
         at com.tesco.ecom.userprofiling.ProfileFormHandler.postLoginUser(ProfileFormHandler.java:2022)
         at com.tesco.ecom.userprofiling.ProfileFormHandler.handleLogin(ProfileFormHandler.java:1191)
         at sun.reflect.GeneratedMethodAccessor1140.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at atg.droplet.EventSender.sendEvent(EventSender.java:582)
         at atg.droplet.FormTag.doSendEvents(FormTag.java:791)
         at atg.droplet.FormTag.sendEvents(FormTag.java:640)
         at atg.droplet.DropletEventServlet.sendEvents(DropletEventServlet.java:523)
         at atg.droplet.DropletEventServlet.service(DropletEventServlet.java:550)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at com.tesco.ecom.userprofiling.AssignCookieServlet.service(AssignCookieServlet.java:139)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at atg.servlet.sessionsaver.SessionSaverServlet.service(SessionSaverServlet.java:2442)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at atg.commerce.order.CommerceCommandServlet.service(CommerceCommandServlet.java:128)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at atg.commerce.promotion.PromotionServlet.service(PromotionServlet.java:191)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at com.spindrift.sitebuilder.request.AuthServlet.service(AuthServlet.java:74)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at com.tesco.ecom.userprofiling.LoginControlServlet.service(LoginControlServlet.java:61)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at com.tesco.ecom.userprofiling.AccessControlServlet.processExpiredSession(AccessControlServlet.java:645)
         at com.tesco.ecom.userprofiling.AccessControlServlet.service(AccessControlServlet.java:392)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at com.tesco.bns.droplets.AddingRecentlyViewedDroplet.service(AddingRecentlyViewedDroplet.java:235)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at atg.userprofiling.PageEventTriggerPipelineServlet.service(PageEventTriggerPipelineServlet.java:169)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at atg.userprofiling.SessionEventTrigger.service(SessionEventTrigger.java:477)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at atg.search.servlet.SearchClickThroughServlet.service(SearchClickThroughServlet.java:396)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at com.tesco.servlet.pipeline.LogOutputFilterServlet.logWithMdc(LogOutputFilterServlet.java:68)
    Edited by: 915252 on Jun 4, 2012 2:39 AM

    Hi,
    you may be interested in a solution I tracked down at http://support.bea.com/application?namespace=askbea&origin=ask_bea.jsp&event=button.search_ask_bea&askbea_display=relevancy&askbea_max_number_returned=50&question=weblogic.jms.common.JMSException%3A+Connection+not+found&all_bea_products=all_bea_products&ES=ES#
    Basically : you need to have your Weblogic servers, JMS servers and JMS stores
    on each domain named uniquely !!!
    "Joe Mooney" <[email protected]> wrote:
    >
    Any news on this one ?
    "B Liu" <[email protected]> wrote:
    Can u tell me how you supplied the required security credentials?
    Thanks,
    -Ben
    "Andy" <[email protected]> wrote:
    Hi.
    I have a situation where I am sending an JMS message to external queue
    on Weblogic
    Server which is not part of cluster. This happens in a session bean,which
    is wrapped
    in a container transaction. I have supplied the required security credentials
    like user, password etc.
    I get an error while tryign to send the message through bean. The stack
    trace
    is :
    weblogic.jms.common.JMSException: Connection not found
    at weblogic.jms.dispatcher.InvocableManager.invocableFind(InvocableManager.java:136)
    at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.java:596)
    at weblogic.jms.dispatcher.DispatcherImpl.dispatchSync(DispatcherImpl.java:153)
    at weblogic.jms.client.JMSConnection.createSessionInternal(JMSConnection.java:400)
    at weblogic.jms.client.JMSConnection.createQueueSession(JMSConnection.java:347)
    also one thing interesting is that if I call the same server and queue
    outside
    of the session bean,it works fine.
    Any ideas what might be causing the issue?
    Thanks
    Andy

Maybe you are looking for

  • How to have two Firefox in the same machine?

    I have Firefox installed from the repo (Namoroka), but I also want to have another version to use exclusively with Tor. Downloading it from Mozilla's official website and running the executable doesn't work because it opens Namoroka. How should it be

  • Font Troubles on MacBook Pro

    I recently purchased a MacBook Pro and took all of the fonts off of my Mac Pro at home and copied them to my harddrive>library>fonts folder. Only some of the fonts are working. Others do not work whatsoever in any application (Photoshop, InDesign, Pa

  • Start managed servers via admin console

    Hello, I have installed weblogic server, created a domain, added a managed server. All working fine. Now I want to be able to start managed server through admin console. According to this documentation (http://docs.oracle.com/cd/E13222_01/wls/docs81/

  • BAPI for operation change in production order?

    Hi there, I want to change operation data in a production order and I can only find this BAPI: BAPI_ALM_ORDER_MAINTAIN Can this BAPI also be used for changing an production order? Because in the documentation of the BAPI this function isn't really me

  • Which Linksys Wireless Routers support WDS?

    includer 802.11G and 802.11N product support WDS (wireless distribution) or repeate mode I need  AP+WDS hybrid mode Message Edited by angel_nx on 07-14-2008 05:09 AM Message Edited by angel_nx on 07-14-2008 05:09 AM