Title: 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