Title: RE: Using a Message Driven Bean to put in another Queue does not work with 1.5.2 / OC4J

We figured out what the problem is.

The beans are being deployed before the JNDI tree is initialized or something.
As long as the QueueConnectionFactory is gotten in the onMessage() it works.

I just put an if() block around the try/catch block to see if this.connection == null
if it is I initialize everything, else I just use the static methods.

This needs to be FIXED. ejbCreate it the place to put this code and ejbRemove is where the clean up
code should be.

Thanks for all the replies.
 
-----Original Message-----
From: Kesav Kumar [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 10:07 AM
To: Orion-Interest
Cc: [EMAIL PROTECTED]
Subject: Re: Using a Message Driven Bean to put in another Queue does not work with 1.5.2 / OC4J


There is a serious problem in queueconnections in orion.  If you try to obtain queueconnection in MDB you will run into some kind of deadlocks.  I am not even sure what is the behaviour of this It gave me the exactly same problem when I tried to implement.

 
The alternate to this is write a Session Bean for submitting messages to queue.  I wrote a SessionBean which just submits given message to specified queue.  You can write all queueconnection and queue lookups in ejbCreate of the session bean.

 
Kesav Kumar
 
 
----- Original Message -----
From: [EMAIL PROTECTED]
To: Orion-Interest
Sent: Tuesday, November 13, 2001 3:20 PM
Subject: Using a Message Driven Bean to put in another Queue does not work with 1.5.2 / OC4J


We have a MDB that processes messages, we need it to put the results in ANOTHER queue.
This does not work right now, as per a couple of examples I found on the web this is what we are trying
    public void ejbCreate() throws EJBException, CreateException
    {
        try
        {
            InitialContext context = new InitialContext();
            QueueConnectionFactory conFactory = ( QueueConnectionFactory )context.lookup( CONNECTION_FACTORY );
            // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            // Create a JMS connection
            this.connection = conFactory.createQueueConnection();
            // Create a JMS session object
            this.session = connection.createQueueSession( false, Session.AUTO_ACKNOWLEDGE );
            // Start the connection so we can use it
            this.connection.start();
            // Lookup a JMS queue      
            this.searchResultsQueue = ( Queue )context.lookup( QUEUE_NAME );
            // Create a JMS sender
            this.sender = session.createSender( this.searchResultsQueue );
        }
        catch ( Exception e )
        {
            // error is logged by our logging service
        }
the line that looks up the connection factory fails
if we move this to onMessage() it works, where should this go to avoid creating this on EVERY message.
ejbCreate() is the "CORRECT" place as per all the examples and everything else.
Jarrod Roberson

Reply via email to