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

  • Home
  • SEARCH
  • 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 8935621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:01:44+00:00 2026-06-15T10:01:44+00:00

I have a project coded using Spring-hibernate-activeMq What I would like to know is

  • 0

I have a project coded using Spring-hibernate-activeMq

What I would like to know is if I configured activeMq like I explained below, how should I implement the exception listener class of it? I know you don’t understand well now but please give a look to my samples below.

Let me know if I implemented exception listener right or not. If not, please give an example how it must be. Thanks in advance.

Application context: (note that I didn’t declare any bean for exception listener except the one the property of connectionFactory)

<bean id="connectionFactory"
      class="org.springframework.jms.connection.CachingConnectionFactory"
      depends-on="broker">
    <constructor-arg ref="amqConnectionFactory"/>
    <property name="reconnectOnException" value="true"/>
    <property name="exceptionListener" ref="jmsExceptionListener"/> 
    <property name="sessionCacheSize" value="100"/>
</bean>

Jms exception listener class: (Note that I am trying to inject ConnectionFactory, I am not sure whether it is possible or not.. And the last thing, please check the constructor arguments of it, I am also not sure of it..)

@Component("jmsExceptionListener")
public class JMSExceptionListener implements ExceptionListener {

private final static Logger logger = LoggerFactory.getLogger(JMSExceptionListener.class); 

@Autowired
private CachingConnectionFactory connection;

//    private Connection connection = null;

private ExceptionListener exceptionListener = null; 

public JMSExceptionListener() {
}

public JMSExceptionListener(CachingConnectionFactory connection, ExceptionListener exceptionListener) {
    super();
    this.connection = connection;
    this.exceptionListener = exceptionListener; 
}

public void onException(JMSException arg0) {
    logger.error("JMS exception has occured.. ", arg0);

    if(connection != null){
        connection.onException(arg0);
    } 
    if (exceptionListener != null) {
        exceptionListener.onException(arg0);
    } 
} 
}
  • 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-15T10:01:49+00:00Added an answer on June 15, 2026 at 10:01 am

    I have manipulated exceptionListener class like the following:

    public class JmsExceptionListener implements ExceptionListener {
    private final static Logger logger = LoggerFactory.getLogger(JmsExceptionListener.class);
    
    @Autowired
    private MailService mailService;
    
    private ExceptionListener exceptionListener = null;
    
    private CachingConnectionFactory cachingConnectionFactory;
    
    public JmsExceptionListener() {
    }
    
    public JmsExceptionListener(Connection connection, ExceptionListener exceptionListener) {
        super();
        this.exceptionListener = exceptionListener;
    }
    
    public synchronized void onException(JMSException e) {
        logger.error("JMS exception has occurred: ", e);
        sendErrorNotificationMail(e);
    
        Exception ex = e.getLinkedException();
        if (ex != null) {
            logger.error("JMS Linked exception: ", ex);
        }
    
        if (exceptionListener != null) {
            exceptionListener.onException(e);
        }
    }
    
    public CachingConnectionFactory getCachingConnectionFactory() {
        return cachingConnectionFactory;
    }
    
    public void setCachingConnectionFactory(CachingConnectionFactory cachingConnectionFactory) {
        this.cachingConnectionFactory = cachingConnectionFactory;
    }
    
    private void sendErrorNotificationMail(Exception e) {
        try {
            mailService.sendJmsExceptionMail(e, ErrorMessageAccessor.get("core.jms.unexpected"));
        } catch (ElekBusinessException e1) {
            logger.error(ErrorMessageAccessor.get("generic.mailService.exp"), e);
        }
    }
    

    }

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

Sidebar

Related Questions

I have recently setup a spring + hibernate project. I am using oracle DB.
I have an existing project built on spring. I would like to catch calls
I have a small code base using Subsonic 2.1 in my project. I would
In my project I can successfully test database code. I'm using Spring, Hibernate, HSQLDB,
I have created a project using Spring Roo. I have a User entity (MODEL),
While working on a Spring 3 MVC project using Hibernate, we encountered an annoying
I have got a simple project using spring. In the spring config, I have
I'm trying to make a project using Spring MVC and JPA but I have
I have a project that is using Spring and is broken down into a
I am using Spring in my JSP project: I have following mapping for all

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.