Create/close QueueSession, QueueConnection

I have a Message Driven bean that on its onMessage() sends messages to another queue. The messages are posted to this queue only if certain conditions are met.
I lookup the QueueConnectionFactory and the Queue in the ejbCreate() method.
My question is - when should I create and close the QueueSession and QueueConnection objects?
A) create them in ejbCreate(), and close them in ejbRemove(), OR
B) create and close them in the onMessage()?
Thanks for the help!

Hi,
From the J2EE Tutorial (p. 1253).
The ejbCreate method, which has the following signature:
public void ejbCreate() {}
If your message-driven bean produces messages or does synchronous
receives from another destination, you use its ejbCreate method to look
up JMS API connection factories and destinations and to create the JMS
API connection.
The ejbRemove method, which has the following signature:
public void ejbRemove() {}
If you used the message-driven bean�s ejbCreate method to create a JMS
API connection, you ordinarily use the ejbRemove method to close the
connection.
Regards,
Magnus Strand

Similar Messages

  • Item Details - Event for 'Create', 'Close' buttons - possible?

    Hi Friends,
    I am looking for EPCF Events for Item Details iView. I am able to show the record in this iview by selectIdHandler. Now, i want to clear the iView content - the functionality when we click 'Close' button.
    So, does any one of you know any Events to fire Create, Close buttons on Item Details iView?
    Thanks,
    Raags

    Hello Raags,
    Have you discovered how to trigger any of those events? I'm having a similar issue.
    I need when I open the record to have it in Edit mode already, not to click the Edit button in order to get there.
    Let me know if you discovered a solution.
    Best regards,
    Boris

  • Creating Close-up of TV Pixel Look in FCP or Motion

    Looking for a tutorial and how to create the effect of a camera close up to a TC screen - so you have the appearance of the rectangular RGB pixels. I would like to create several shots, progressively snapping closer to that TV screen.
    Would anyone know the best way to do this? Any help or suggestions would be greatly appreciated.
    TIA

    Thanks both for your replies.
    I was more looking for an effect that would be done completely in FCP/Motion, so that I could use it on any resolution video without worrying about whether my monitor/TV could handle the resolution. It would also make changing the footage in the effect dynamic, not requiring a new setup of gear if the DP wants a different clip.
    Also, since I am working on an HD project, and I only have access to SD cameras, the resulting taping of a TV screen in SD, would make the image a bit soft.... but I guess that could be part of the effect...
    Anyway, this is generally the method I had conceived to achieve the effect.
    1. create a pixel mask in Photoshop to mimic the layout of one the color pixels (e.g. green),
    2. create three time lines of the same clip
    3. Apply RGB filter to each layer, so that each layer only contained one color channel - one layer red, one green, one blue
    4. Apply pixel mask to each layer - offsetting each layer to position for each color to duplicate RGB pixel configuration.
    5. Composite the layers as Screen(?) to blend them together.
    Something like that....
    If I used this method with Motion, then I could make drop zones for the three color channels, I suppose, and be able to reuse the effect on a whim.
    Anyway, I was hoping not to reinvent the wheel, if there was already a better method.
    TIA

  • Connection not found when trying to create a QueueSession

              We have run into the following situation using JMS under
              Weblogic 6.1 SP3 (on both the clients and server, which have different server
              names, so that is not the cause). We have no
              problem connecting and sending messages from multiple clients to
              the same server. However, after some period of time (which
              varies), some "event" occurs that causes each client connection
              to become ineffective, i.e., the next time you try to create a
              new session off that connection, you ge a "Connection not found"
              JMSException. In fact, when this occurs, all active client see
              the same problem at the same time... there is no evidence in the
              server log of any problem. If I have each client re-create and
              re-start the JMS connection, they are able to proceed with no problem (until the
              "event" occurs again). It appears as though
              the connection to the server is somehow being dropped, though we're not sure why...
              Has anyone else reported this sort of problem?
              Here is the stack trace we get:
              [weblogic.jms.common.JMSException: Connection not found
              Start server side stack trace:
              weblogic.jms.common.JMSException: Connection not found
                      at weblogic.jms.dispatcher.InvocableManager.invocableFind(InvocableManager.java:121)
                      at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.java:509)
                      at weblogic.jms.dispatcher.DispatcherImpl.dispatchAsync(DispatcherImpl.java:149)
                      at weblogic.jms.dispatcher.DispatcherImpl.dispatchSyncFuture(DispatcherImpl.java:300)
                      at weblogic.jms.dispatcher.DispatcherImpl_WLSkel.invoke(Unknown Source)
                      at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:305)
                      at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:274)
                      at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
                      at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
                      at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              End  server side stack trace
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             

    I don't think there is a simple way to rename things on the console (I may be
              wrong on this). Via the console, I think you can create copies with new names, set the
              targets again, and delete the old version. But it is likely easiest just
              to do a search and replace of the names in your config.xml file.
              Tom
              Bill O'Keefe wrote:
              > Rajesh Mirchandani <[email protected]> wrote:
              > >
              > >Apart from different server names you should have different domain, JMS
              > >server and JMS store
              > >names too.
              >
              > Is there a way to rename an existing domain/server? Or do I need to configure
              > new ones? Thanks.
              > >
              > >Bill O'Keefe wrote:
              > >
              > >> We have run into the following situation using JMS under
              > >> Weblogic 6.1 SP3 (on both the clients and server, which have different
              > >server
              > >> names, so that is not the cause). We have no
              > >> problem connecting and sending messages from multiple clients to
              > >> the same server. However, after some period of time (which
              > >> varies), some "event" occurs that causes each client connection
              > >> to become ineffective, i.e., the next time you try to create a
              > >> new session off that connection, you ge a "Connection not found"
              > >> JMSException. In fact, when this occurs, all active client see
              > >> the same problem at the same time... there is no evidence in the
              > >> server log of any problem. If I have each client re-create and
              > >> re-start the JMS connection, they are able to proceed with no problem
              > >(until the
              > >> "event" occurs again). It appears as though
              > >> the connection to the server is somehow being dropped, though we're
              > >not sure why...
              > >> Has anyone else reported this sort of problem?
              > >>
              > >> Here is the stack trace we get:
              > >> [weblogic.jms.common.JMSException: Connection not found
              > >>
              > >> Start server side stack trace:
              > >> weblogic.jms.common.JMSException: Connection not found
              > >>         at weblogic.jms.dispatcher.InvocableManager.invocableFind(InvocableManager.java:121)
              > >>         at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.java:509)
              > >>         at weblogic.jms.dispatcher.DispatcherImpl.dispatchAsync(DispatcherImpl.java:149)
              > >>         at weblogic.jms.dispatcher.DispatcherImpl.dispatchSyncFuture(DispatcherImpl.java:300)
              > >>         at weblogic.jms.dispatcher.DispatcherImpl_WLSkel.invoke(Unknown
              > >Source)
              > >>         at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:305)
              > >>         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:274)
              > >>         at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
              > >>         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              > >>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              > >> End  server side stack trace
              > >
              > >--
              > >Rajesh Mirchandani
              > >Developer Relations Engineer
              > >BEA Support
              > >
              > >
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     

  • Error when using same QueueSession in a multi threaded application

    I have deployed a OSSJ Trouble Ticket refererence Implementation on Sun Java System App Server Platform Edition 8.1 default server.
    The TT server listens on queue MessageQueue and sends its reply on MessageReplyQueue
    The application that sends the request to the TT server should support concurrent requests using threads.
    The sender application creates a QueueConnection and a QueueSession.
    This QueueSession is shared by all the threads that send the request to the TT server.
    Each thread creates its own QueueSender, TemporaryQueue which is set as replyTo in the message, QueueReceiver using the TemporaryQueue in the run method
    When the application is run multiple times i get the following exception
    javax.jms.IllegalStateException: [C4055]: Resource in conflict. Concurrent operations on a session.
    at com.sun.messaging.jmq.jmsclient.SessionImpl.setInSyncState(SessionImpl.java:2177)
    at com.sun.messaging.jmq.jmsclient.SessionImpl.acknowledge(SessionImpl.java:972)
    at com.sun.messaging.jmq.jmsclient.MessageConsumerImpl.receive(MessageConsumerImpl.java:375)
    at com.sun.messaging.jmq.jmsclient.MessageConsumerImpl.receive(MessageConsumerImpl.java:347)
    at xvt.tt.MessageSenderMultiThread.run(MessageSenderMultiThread.java:112)
    The code looks as follows
    public class MessageSenderMultiThread extends Thread {
    private String strMessage = null;
    private QueueSender queueSender = null;
    private QueueReceiver queueReceiver = null;
    private TextMessage message = null;
    private TemporaryQueue tempQueue = null;
    private QueueConnection tempQC = null;
    private QueueSession tempQS = null;
    private Queue tempQ = null;
    String inputQname = "MyQueue";
    String outputQname = "A";
    private int sleepTime;
    static InitialContext jndiContext = null;
    Queue replyQueue=null;
    Hashtable sessions=null;
    static QueueConnection queueConnection = null;
    public static String readFromFile(String fileName) {
    String line = null;
    try {
    FileReader fr = new FileReader(fileName);
    BufferedReader br = new BufferedReader(fr);
    String temp = "";
    line = "";
    while ((temp = br.readLine()) != null) {
    //System.out.println("line is"+line);
    if (temp != null)
    line = line + temp;
    return line;
    } catch (Exception ex) {
    System.out.println("Exception occurred,Ex" + ex);
    return line;
    MessageSenderMultiThread(String strMsg, int sTime, QueueConnection qC, QueueSession qS, Queue q, String name) {
    super(name);
    this.strMessage = strMsg;
    this.sleepTime = sTime;
    this.tempQC = qC;
    this.tempQS = qS;
    this.tempQ = q;
    sessions=new Hashtable();
    System.out.println("Inside Constructior");
    public void run() {
    try {           
    queueSender = tempQS.createSender(tempQ);
    tempQueue = tempQS.createTemporaryQueue();
    queueReceiver = tempQS.createReceiver(tempQueue);
    //queueReceiver = tempQS.createReceiver(replyQueue);
    message = tempQS.createTextMessage();
    message.setText(this.strMessage);
    message.setJMSReplyTo(tempQueue);
    //message.setJMSReplyTo(replyQueue);
    message.setJMSCorrelationID("1234");
    queueSender.send(message);
    System.out.println(message.getText());
    tempQC.start();
    //while (true) {
    Message m = queueReceiver.receive();
    if (m != null) {
    if (m instanceof TextMessage) {
    message = (TextMessage) m;
    if (message != null) {                           
    System.out.println("########################corr id::"+message.getJMSCorrelationID());
    queueReceiver.close();
    //System.out.println("message:: " + message.getText() + "Thread Name " + this.getName());
    } else
    System.out.println("NULL");
    } //else
    //break;
    System.out.println("Exiting !");
    } catch (JMSException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
    public static void main(String args[]) {
    String inputQname = "System/RI/ApplicationType/TroubleTicket/Application/1-0;0-0;OSSJTTRI/Comp/MessageQueue";
    QueueConnectionFactory queueConnectionFactory = null;
    QueueSession queueSession = null;
    Queue inputQueue = null;
    try {
    jndiContext = new InitialContext();
    queueConnectionFactory = (QueueConnectionFactory) jndiContext.lookup("System/RI/ApplicationType/TroubleTicket/Application/1-0;0-0;OSSJTTRI/Comp/QueueConnectionFactory");
    inputQueue = (Queue) jndiContext.lookup(inputQname);
    queueConnection = queueConnectionFactory.createQueueConnection();
    queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    } catch (JMSException e) {
    e.printStackTrace();
    } catch (Exception e) {
    e.printStackTrace();
    String strRequest = null;
    strRequest = readFromFile("C:/ISM/getTroubleTicketsByKeysRequest.xml");
    new MessageSenderMultiThread(strRequest, 100, queueConnection, queueSession, inputQueue, "Thread1").start();
    strRequest = readFromFile("C:/ISM/getTroubleTicketsByKeysRequest1.xml");
    new MessageSenderMultiThread(strRequest, 100, queueConnection, queueSession, inputQueue,"Thread2").start();
    System.out.println("OVER");
    // System.exit(-1);
    }

    A session is single threaded (so it can not be used by different threads and generate valid behavior). This behavior is covered in @ setion 4.4 of the JMS specification
    If you need multiple threads to process messages you should either:
    * have them share a single session
    * read messages in from the session in a single thread and pass them off to
    other threads processing the message
    On the second option, you must have the "reading" thread also acknowledge the message in client acknowledge (or commit in transactions)

  • Error while creating a temp queue (JMSException sayin .Destination dosnt ex

    i will just post part of my code
    Properties env = new Properties();
                        env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.NamingContextFactory");
                        jndiContext = new InitialContext();
                        queueConnectionFactory = (QueueConnectionFactory)jndiContext.lookup("QueueConnectionFactory");
                        queue = (Queue) jndiContext.lookup(queueName);
                   }catch (NamingException e) {
                        System.out.println("JNDI API lookup failed: " + e.toString());
                        System.exit(1);
                   try {
                        queueConnection = queueConnectionFactory.createQueueConnection();
                        queueSession = queueConnection.createQueueSession (false, Session.AUTO_ACKNOWLEDGE);
                        queueConnection.start();
                        queueSender = queueSession.createSender(queue);
                        requestMessage = queueSession.createTextMessage();
                                                                requestMessage.setText("does");
    /* The code works fine  till here , but below as soon as i say  replyQueue = queueSession.createQueue("todo"); , it says the destination dosenot exist. why isnt it creating  a temporary queue for me . Exception thrown is javax.jms.JMSException :
    This Destination Does Not Exist.
                        replyQueue = queueSession.createQueue("todo");
                                            Destination replyDestination = replyQueue;

    createTemporaryQueue() already creates a unique
    destination; you don't need to do anything else.
    Note as we discussed in the previous thread; you
    should not create a temporary destination per
    request; you should create 1 temporary destination
    per consumer/process and reuse it across requests;
    using a correlationID to match requests to
    responses.
    James
    http://logicblaze.com/
    Hello Mr.James,
    pleeeeeeeeeeeeeeease give me one example of how do i create only one temporary queue and differentiate resposes based on CorrelationID, i mean i am just not able to do it , i feel i will have to browse through entire queue matching for CorrelationId's, however u had earlier rejected this approach
    THEN HOW DO I MATCH RESPONSES IN TEMPORARY QUEUES TO MY REQUESTS BASED ON CORRELATIONID , PLEASE GIVE ME AN EXAMPLE

  • Can I create a new Queue/Topic in client application?

    In sun's JMS turorial the application client sends messages to the queue, which is created administratively, using the j2eeadmin command. Can I create a new destination(queue or topic) in my client's code?
    Thanks very much.

    Thank you very much, flhood. This is my first time to gain aid from website except my school's BBS.
    But I still cann't solve the problem, here is my code, can you help me to check it if there is anywhere that I might do wrong?( I omit the try/catch part)
    QueueConnectionFactory queueConnectionFactory =null;
    QueueConnection queueConnection =null;
    QueueSession queueSession =null;
    Queue queue =null;
    Queue tempQueue =null;
    QueueSender queueSender =null;
    TextMessage message =null;
    final int NUM_MSGS;
    Context jndiContext =null;
    jndiContext =new InitialContext();
    queueConnectionFactory =(QueueConnectionFactory)jndiContext.lookup("QueueConnectionFactory");
    queueConnection =queueConnectionFactory.createQueueConnection();
    queueSession =queueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
    queueConnection.start();
    queue =queueSession.createQueue("MyQueue");
    tempQueue =queueSession.createTemporaryQueue();(Actually I don't know why I shall need a tempQueue if I have the queue.)
    queueSender =queueSession.createSender(queue);
    message =queueSession.createTextMessage();
    NUM_MSGS=10;
    for (int i =0;i <NUM_MSGS;i++){
    message.setText("This is message "+(i +1));
    System.out.println("Sending message:"+message.getText());
    queueSender.send(message);
    These codes run well if I lookup in the JNDI for the existing queue "MyQueue", but when I try to make it dynamically, the resutlt shows(I only use texteditor+j2sdk1.4+j2ee1.3.1):
    Java(TM) Message Service 1.0.2 Reference Implementation (build b14)
    Sending message:This is message 1
    Exception occurred:javax.jms.InvalidDestinationException: No Destination found f
    or name: MyQueue
    I use deloytool to check the destionation, of course the "MyQueue" hasn't been created, but I use try/catch to brace these two line:
    queue =queueSession.createQueue("MyQueue");
    queueSender =queueSession.createSender(queue);
    Nothing gain.
    They are really puzzling me!

  • Alert box:No more free items available, please create new one

    Hi,
    We are running a SAP ERP Ecommerce, we get a strange alert box message "no more free items available, please create a new one". This alert window pops up only when you have created one order in a session and you are trying to create another order. Has anyone come across this issue?
    Steps to recreated this issue
    1. Create an order with any product - quantity is rounded to next possible value.
    2. Order created, close the order.
    3. Trying to create new order. (Product field is not a text box anymore)
    4. Try to transfer product from catalog by hitting shopping basket icon.
    5. Error message -> "No more free items available, please create new one".
    Thanks,
    -Tarun

    Hi,
    We are running a SAP ERP Ecommerce, we get a strange alert box message "no more free items available, please create a new one". This alert window pops up only when you have created one order in a session and you are trying to create another order. Has anyone come across this issue?
    Steps to recreated this issue
    1. Create an order with any product - quantity is rounded to next possible value.
    2. Order created, close the order.
    3. Trying to create new order. (Product field is not a text box anymore)
    4. Try to transfer product from catalog by hitting shopping basket icon.
    5. Error message -> "No more free items available, please create new one".
    Thanks,
    -Tarun

  • Close Functionality in an iview

    HI,
       i have  an iview which i was opening as an external vindow. now my issue is need to close this iview using a close button. can any one

    HI JEGADHEESAN,
    For SAP NetWeaver 7.0, you can perform the following activities step by step:
    1.Create close.html file and write javascript code for closing window.
    2.Place this close.html in \src\mimes\Components\<component_name>\
    3.Create CLOSE button in view and assign corresponding action (e.g. onActionClose)
    4.Now write code for closing external window (i.e. Web Dynpro Window).
      public void onActionClose(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionClose(ServerEvent)
              try {
                        String URL = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getComponent().getDeployableObjectPart(),"close.html");
                        TaskBinder.getCurrentTask().getClient().sendRedirect(URL, 0);
                   } catch (WDURLException e)
                        e.printStackTrace();     
                   } catch (IOException e)
                        e.printStackTrace();
        //@@end
    Thanks
    Gautam Singh

  • Close webdynpro Application

    Hi Experts,
    On click of a link in Portal, my web dynpro application opens in a new window.. I have a close button on that screen and I want to close that application ..what code should I use for it.
    Thanks & regards,
    Sushant singh

    Hi,
    If you have create Close button manually then you can create an exit plug and on click of this button you can fire the exit plug.
    look at the related thread
    Re: Closing of IE window
    If its a standard close button ( FPM close button ) then you don't need to do anything .
    Regards
    Manas Dua

  • Adobe Premiere Pro 6 CS Close Captions using Pro 6 CC?

    I have Adobe Premiere Pro 6 CS and need to create Close Captions for a production I'm doing.
    I know I can't create the Captions on Pro 6 CS but can I create them in Pro 6 CC and import them into the production on the CS side?

    Here is a thread that discusses closed captioning functionality and the split between legacy PPRO CS 6.0 and the online CC version at that time -- Premiere Pro CC version 7.01.
    Premiere Pro CS6 - Closed Captioning
    Projects created from on version of PPRO should migrate with no problems to the next version. Closed captions can be added to any project you open, provided the application version you are using supports creating closed captions.
    I suggest you work with one version of PPRO to keep things simple.

  • Creating User in CMC &restrict option(EDIT SQL or Edit option) in Infoview

    Hi,
    Any one can help creating user in CMC.I want to restrict option(EDIT SQL or Edit option) for particular user in Infoview.
    Please explain with steps.Thanks in advance.
    Regards,
    Swapna.

    Hi,
    1. Go to the "Users and Groups" management area of the CMC.
    2. Click Manage > New > New User.
    The "New User" dialog box appears.
    3. Select Enterprise from the Authentication Type list.
    4. Type the account name, full name, email, and description information.
    Tip:
    Use the description area to include extra information about the user or
    account.
    5. Specify the password information and settings.
    6. Select the connection type.
    7. Click Create & Close.
    8.Edit the user and define access right
    Admin Guide is a good reference-Chapter 19,chapter18
    [Admin Guide|http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_bip_admin_en.pdf]
    Regards,
    Bilahari

  • Close Browser window when you close 10g forms

    Help Please.... I am trying to close browser window when I exit 10g forms:
    Per oracle Note:115905.1
    create close.html file Put the html file in the webserver root.
    I created the following file in $ORACLE_HOME/Apache directory (webserver directory??)
    1.)Create an html file (es. close.html):
    <html>
    <body onload="closeit()">
    <script>
    function closeit()
    win = top;
    win.opener = top;
    win.close ();
    </script>
    </body>
    </html>
    In exit form when button pressed I have the code
    web.show_document('http://apphost1.univ-wea.com:7777/close.html','_self');
    The brwser window does not close automatically.
    thanks,
    Anitha

    Hello this is saras from chennai.
    Now i m developing oracle forms using 6i. now i m running it independantly. that is i put forms in one folder and run these forms using shortcut. If i m using the same in client machine also. But now i want to run these forms in webbrowser(client-server). for this i done the followings.
    1. installing forms server and reports server.
    2.Also i install IIS Server and appachie server also.
    3. I had fmx files.
    now i dont know the procedure to configure these web server with forms server. And i hold the fmx files in inetpub\wwroot folder.
    Which one is the easy method appachiee server or iis server.
    Please help me to run these fmx files in web browser.
    I m eagerly waiting for your favourable reply.
    saras,
    [email protected]
    chennai

  • Problem in sending JMS message on remote OC4J

    I have two OC4J standalone (10.1.3.0.0 build 041119.0001.2385)
    The containers work on Windows2000 in different machines connected by the LAN.
    The First container has deployed application from example http://www.oracle.com/technology/tech/java/oc4j/1013/howtos/how-to-jca-intro/doc/how-to-jca-intro.html
    The second container has j2ee application (Servlet) that sending JMS messages in the queue of the first container.
    Code Servlet in second OC4J:
    package mypackage2;
    import javax.servlet. *;
    import javax.servlet.http. *;
    import java.io. PrintWriter;
    import java.io. IOException;
    import javax.jms. *;
    import javax.naming. *;
    import java.util. *;
    public class Servlet1 extends HttpServlet
    private static final String CONTENT_TYPE = "text/html;charset=windows-1251";
    public void init (ServletConfig config) throws ServletException
    super.init (config);
    String QUEUE_NAME = "OracleASjms/MyQueue1";
    String QUEUE_CONNECTION_FACTORY = "OracleASjms/MyQCF";
    public void doGet (HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    response.setContentType (CONTENT_TYPE);
    PrintWriter out = response.getWriter ();
    out.println (" < html > ");
    out.println (" < head > < title > Servlet1 < /title > < /head > ");
    out.println (" < body > ");
    try
    Hashtable env = new Hashtable ();
    env.put (Context. INITIAL_CONTEXT_FACTORY, "oracle.j2ee.rmi.RMIInitialContextFactory");
    env.put (Context. SECURITY_PRINCIPAL, "admin");
    env.put (Context. SECURITY_CREDENTIALS, "admin");
    env.put (Context. PROVIDER_URL, "ormi://host_OC4J_1:23791/jcamdb");
    env.put ("dedicated.rmicontext", "true");
    InitialContext ic = new InitialContext (env);
    QueueConnectionFactory connectionFactory = (QueueConnectionFactory)ic.lookup (QUEUE_CONNECTION_FACTORY);
    QueueConnection connection = connectionFactory.createQueueConnection ();
    connection.start ();
    QueueSession queueSession =
    connection.createQueueSession (false, Session.AUTO_ACKNOWLEDGE);
    Queue queue = (Queue) ic.lookup (QUEUE_NAME);
    ic.close ();
    System.out.println (" Queue: " + queue);
    QueueSender sender = queueSession.createSender (queue);
    System.out.println (" creating Message: " + queue);
    Message message = queueSession.createMessage ();
    System.out.println (" Message created ");
    message.setJMSType ("theMessage");
    message.setLongProperty ("time", System.currentTimeMillis ());
    message.setStringProperty ("id", "11111");
    message.setStringProperty ("oamount", "55555");
    message.setStringProperty ("message", "77777");
    message.setStringProperty ("RECIPIENT", "MDB");
    System.out.println (" Sending message... ");
    sender.send (message);
    System.out.println (" Message sent ");
    sender.close ();
    queueSession.close ();
    connection.close ();
    catch (Exception e)
    System.out.println (" ** TEST FAILED ** < br > Exception: " + e);
    out.println (e.toString ());
    e.printStackTrace ();
    out.println (" < p > The servlet has received a GET. This is the reply. < /p
    ");out.println (" < /body > < /html > ");
    out.close ();
    Error: This code send message in The First container, and should send in the second OC4J !!!!
    Please answer :
    As configure (what code it is necessary to write) servlet (any J2EE the application in OC4J) to use a path to OC4J JMS (remote OC4J JMS) through the Resource Adapter (using OracleASjms.rar). ???

    I have two OC4J standalone (10.1.3.0.0 build 041119.0001.2385)
    The containers work on Windows2000 in different machines connected by the LAN.
    The First container has deployed application from example http://www.oracle.com/technology/tech/java/oc4j/1013/howtos/how-to-jca-intro/doc/how-to-jca-intro.html
    The second container has j2ee application (Servlet) that sending JMS messages in the queue of the first container.
    Code Servlet in second OC4J:
    package mypackage2;
    import javax.servlet. *;
    import javax.servlet.http. *;
    import java.io. PrintWriter;
    import java.io. IOException;
    import javax.jms. *;
    import javax.naming. *;
    import java.util. *;
    public class Servlet1 extends HttpServlet
    private static final String CONTENT_TYPE = "text/html;charset=windows-1251";
    public void init (ServletConfig config) throws ServletException
    super.init (config);
    String QUEUE_NAME = "OracleASjms/MyQueue1";
    String QUEUE_CONNECTION_FACTORY = "OracleASjms/MyQCF";
    public void doGet (HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    response.setContentType (CONTENT_TYPE);
    PrintWriter out = response.getWriter ();
    out.println (" < html > ");
    out.println (" < head > < title > Servlet1 < /title > < /head > ");
    out.println (" < body > ");
    try
    Hashtable env = new Hashtable ();
    env.put (Context. INITIAL_CONTEXT_FACTORY, "oracle.j2ee.rmi.RMIInitialContextFactory");
    env.put (Context. SECURITY_PRINCIPAL, "admin");
    env.put (Context. SECURITY_CREDENTIALS, "admin");
    env.put (Context. PROVIDER_URL, "ormi://host_OC4J_1:23791/jcamdb");
    env.put ("dedicated.rmicontext", "true");
    InitialContext ic = new InitialContext (env);
    QueueConnectionFactory connectionFactory = (QueueConnectionFactory)ic.lookup (QUEUE_CONNECTION_FACTORY);
    QueueConnection connection = connectionFactory.createQueueConnection ();
    connection.start ();
    QueueSession queueSession =
    connection.createQueueSession (false, Session.AUTO_ACKNOWLEDGE);
    Queue queue = (Queue) ic.lookup (QUEUE_NAME);
    ic.close ();
    System.out.println (" Queue: " + queue);
    QueueSender sender = queueSession.createSender (queue);
    System.out.println (" creating Message: " + queue);
    Message message = queueSession.createMessage ();
    System.out.println (" Message created ");
    message.setJMSType ("theMessage");
    message.setLongProperty ("time", System.currentTimeMillis ());
    message.setStringProperty ("id", "11111");
    message.setStringProperty ("oamount", "55555");
    message.setStringProperty ("message", "77777");
    message.setStringProperty ("RECIPIENT", "MDB");
    System.out.println (" Sending message... ");
    sender.send (message);
    System.out.println (" Message sent ");
    sender.close ();
    queueSession.close ();
    connection.close ();
    catch (Exception e)
    System.out.println (" ** TEST FAILED ** < br > Exception: " + e);
    out.println (e.toString ());
    e.printStackTrace ();
    out.println (" < p > The servlet has received a GET. This is the reply. < /p
    ");out.println (" < /body > < /html > ");
    out.close ();
    Error: This code send message in The First container, and should send in the second OC4J !!!!
    Please answer :
    As configure (what code it is necessary to write) servlet (any J2EE the application in OC4J) to use a path to OC4J JMS (remote OC4J JMS) through the Resource Adapter (using OracleASjms.rar). ???

  • How to insert message in OC4J JMS from standalone java client.

    Hi,
    I have been following available examples for creating standalone java clients to insert messages in JMS queues.
    I am able to insert using java client when the SOA suite and the standalone java code are on same machine.
    package producerconsumerinjava;
    import javax.jms.*;
    import javax.naming.*;
    import java.util.Hashtable;
    public class QueueProducer
    public static void main(String[] args)
    String queueName = "jms/demoQueue";
    String queueConnectionFactoryName = "jms/QueueConnectionFactory";
    Context jndiContext = null;
    QueueConnectionFactory queueConnectionFactory = null;
    QueueConnection queueConnection = null;
    QueueSession queueSession = null;
    Queue queue = null;
    QueueSender queueSender = null;
    TextMessage message = null;
    int noMessages = 5;
    * Set the environment for a connection to the OC4J instance
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.rmi.RMIInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
    env.put(Context.SECURITY_CREDENTIALS, "mypass");
    env.put(Context.PROVIDER_URL,"ormi://myserver.company.com:12402"); //12402 is the rmi port
    * Set the Context Object.
    * Lookup the Queue Connection Factory.
    * Lookup the JMS Destination.
    try
    jndiContext = new InitialContext(env);
    queueConnectionFactory =
    (QueueConnectionFactory) jndiContext.lookup(queueConnectionFactoryName);
    queue = (Queue) jndiContext.lookup(queueName);
    catch (NamingException e)
    System.out.println("JNDI lookup failed: " + e.toString());
    System.exit(1);
    * Create connection.
    * Create session from connection.
    * Create sender.
    * Create text message.
    * Send messages.
    * Send non text message to end text messages.
    * Close connection.
    try
    queueConnection = queueConnectionFactory.createQueueConnection();
    queueSession =
    queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    queueSender = queueSession.createSender(queue);
    message = queueSession.createTextMessage();
    for (int i = 0; i < noMessages; i++)
    message.setText("Message " + (i + 1));
    System.out.println("Producing message: " + message.getText());
    queueSender.send(message);
    queueSender.send(queueSession.createBytesMessage());
    catch (JMSException e)
    System.out.println("Exception occurred: " + e.toString());
    finally
    if (queueConnection != null)
    try
    queueConnection.close();
    catch (JMSException e)
    System.out.println("Closing error: " + e.toString());
    But when the SOA Suite is remote, I am struggling to get the settings correct
    Till now, here is what I have figured out from looking at blogs/tars etc on the Net:
    1. I need to use ApplicationClientInitialContextFactory instead of RMIInitialContextFactory (http://download.oracle.com/docs/cd/E14101_01/doc.1013/e13975/jndi.htm)
    2. The project should have a META-INF/application-client.xml file, which may be dummy (http://www.wever.org/java/space/Oracle/JmsTar1). Question is, my code is there in a single absolutely standalone code..how I can use this application-client.xml and where it has to be placed.
    Errors:
    When trying to run exact same code on local server that tries to enqueue JMS on remotee serverer
    Exception occurred: javax.jms.JMSException: Unable to create a connection to "xxxxxxx.yyyyyy01.dev.com/10.42.456.11:12,602" as user "null".
    Any help is greatly welcome.
    As an exercise, I copied this complete code on the server and then ran locally using a telnet client...it worked. So the problem is coming when accessing the server remotely.
    Rgds,
    Amit

    1. I need to use ApplicationClientInitialContextFactory instead of RMIInitialContextFactoryNot necessarily.
    2. The project should have a META-INF/application-client.xml fileThat's only necessary if going the ApplicationClientInitialContextFactory route.
    There are two types of JMS client applications you can write -- a pure/plain Java app, and an "AppClient". That first is your everyday run-of-the-mill Java application, nothing special. That latter is a special, complicated beast that tries to act as a part of the whole client/server/J2EE architecture which provides you with a semi-managed environment. Either can be made to work, but if all you need is JMS access (using plain OC4J JMS factory/queue names and not JMS Connector names), then the first is easier to get working (and performs a tiny bit better as well due to being a lighter-weight solution).
    I think the problem you are having might be: When you use the plain Java client solution, you do not have any type of management, and that includes user management. With no user management (and if the JMS server is not configured to allow anonymous connections) you need to include the username and password in the call to createConnection. (I think it may be that this is actually true in the AppClient case as well -- I avoid using the AppClient model as much as possible so my memory there is weaker.)
    If you prefer to go the AppClient route, I would point you to a demo I wrote which had a functioning example, but Oracle seems to have removed it (and all of the 10.1.3 demos?) from OTN. :-(
    Hmm, it seems to still be available on the wayback machine:
    http://web.archive.org/web/20061021064014/www.oracle.com/technology/tech/java/oc4j/1013/how_to/index.html
    (Just look down the page for "With OEMS JMS (In-Memory and File-Based)" -- there is an .html document with info, and there is a .zip file with source code.)
    Question is, my code is there in a single absolutely standalone code..how I can use this application-client.xml and where it has to be placed.The app client in my demo had the following directory structure:
    myjavaclient.class
    jndi.properties
    META-INF\MANIFEST.MF
    META-INF\application-client.xml
    META-INF\orion-application-client.xml
    When you use ApplicationClientInitialContextFactory I think it just looks under .\META-INF for the .xml files.
    -Jeff

Maybe you are looking for

  • How to downgrade from ios 8.02 to 7.04 on iphone 4s

    how to downgrade from ios 8.02 to 7.04 on iphone 4s?

  • My iPhone won't let me play some of my music

    i have some music downloaded from dat piff  but it wont allow me to play it on my iphone

  • No sound in hp mini 1047tu

    I have a hp mini 110-1047TU. I reloded the windows XP prof. Used drivers from hp site. But sound did not get activated. In speakers, sound in control panel, shows no device. Please help me to solve this problem. This question was solved. View Solutio

  • Looking for MAC/Aperture user in the Morgnatown WV area

    Greetings, I am trying to find some help with a book project. I have two strikes against me. 1. I have no MAC 2. I have no Aperture I am trying to find a MAC users group or helpful person in the Morgantown WV area who would willing to lend me a hand

  • Doubt rearding bdc

    Hi, I am trying out BDC using session method. I am trying t upload  4 field values from a txt file on desktop to sap. when I process the session it still calls the screen and asks for the values for vendor creation...why does it not take values direc