Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8017941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:59:21+00:00 2026-06-04T20:59:21+00:00

I have two stateless SessionBeans. My client (JSF2 application) is calling a method (saveOrderCompletion)

  • 0

I have two stateless SessionBeans.
My client (JSF2 application) is calling a method (saveOrderCompletion) on the first EJB (CompletionFacade), which calls another method (processRequest) on the second EJB (ContactFacade) to send a message to a queue via JMS.

At the end of the first called method I am throwing a RuntimException to see how JBoss behaves. This should all run in one transaction, thus the transaction should do a rollback, so that no message should be sent to the queue.

I double checked this this on weblogic server, which shows exactly the expeced behaviour.
My question is why JBoss does not rollback the entire transaction? Did I miss something…

The entity is not being persisted, but the message is sent to the queue anyway.

I am using jboss 7.1.1, app is deployed as EAR

Here are my session beans…

/**
* Session Bean implementation class CompletionFacade
*/
@Stateless
public class CompletionFacade implements CompletionFacadeRemote, CompletionFacadeLocal {


    @PersistenceContext(unitName="my_test")
    private EntityManager entityManager;


    @EJB
    ContactFacadeLocal contactFacade;

    .....

    @Override
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public OrderCompletion saveOrderCompletion(OrderCompletion orderCompletion) throws TestBusinessException {
        try {

            ...do some stuff on entity

            //persist to get id
            entityManager.persist(orderCompletion);


            //finally send email
            contactFacade.processRequest(orderCompletion,partner);

            if (0 == 0)
                throw new RuntimeException("Test RuntimeException ");

        } catch (TestGenericException re) {
            throw new TestBusinessException("Could not print orderCompletion: " ,re);
        } catch (DocumentException e) {
            throw new TestBusinessException("Could not print orderCompletion: " ,e);
        }

        return orderCompletion;
    }
}

and the second facade:

@Stateless
public class ContactFacade implements ContactFacadeRemote, ContactFacadeLocal {

....


    /*
     * actually create message
     */
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public void processRequest(Object request, SmtpPartner partner) throws TestGenericException {

        if (logger.isDebugEnabled()) {
            logger.debug("Starting to process request!");
        }

        QueueConnection connection = null;
        QueueSession session = null;

        try {

         ...lookup queue etc...

             sender.send(QUEUE, objectMessage);

        } catch (JMSException e) {
            logger.error("MS Exception:", e);
        } catch (NamingException e) {
            logger.error("Naming exception:", e);
        } ...
        } finally {
            try {
                session.close();
                connection.close();
            } catch (JMSException e) {
                logger.error("Error closing connection:", e);
            }

        }
    }

...
}

Any help is highly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:59:24+00:00Added an answer on June 4, 2026 at 8:59 pm

    You’ve left the most important part out; the JMS connection factory where you obtain the connection from and the way how you got hold of this factory.

    Make sure you inject this factory, and that you use a transactional one. In JBoss AS 6, java:/JmsXA was the transactional one, and java:/ConnectionFactory the unmanaged/not-transactional alternative. Check that for AS 7 you are using the right one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering... Let's say that I have two stateless beans in ejb 3.1:
I have a stateless EJB and two different SessionScoped managed beans. e.g. EJB as
I have to create a method which tests if two object enum are equal.
I have a stateless session bean which is exposed as webservice. There are two
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
I have two classes which need to be in same xml file. The way
I have two XML files. The first XML has a bunch of nodes that
I create an Enterprise Application CustomerApp that also generated two projects CustomerApp-ejb and CustomerApp-war
Have two IBOutlets which won't appear in File's Owner to connect to even though
I'm using IBM RAD 7.5 and WebSphere 7. I have an EJB (@Stateless CustomerService),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.