0
package com.spring.trip.spring3.jms.activemq;
import java.util.Map;

import org.springframework.jms.JmsException;
import org.springframework.jms.core.JmsTemplate;
public class MessageSender 
{

    private final JmsTemplate jmsTemplate;

    public MessageSender(final JmsTemplate jmsTemplate) {
        this.jmsTemplate = jmsTemplate;
    }

    public void send(final Map map) throws java.lang.Exception
    {
          try {
            jmsTemplate.convertAndSend(map);
        } catch (JmsException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

Above is my code, and I get the following error even though I have the try/catch block. Any help? Many Thanks!!!

No exception of type JmsException can be thrown; an exception type must be a subclass of Throwable
Francis Raj
  • 107
  • 4
  • 12
  • 1
    http://stackoverflow.com/questions/27277008/how-can-i-fix-no-exception-of-type-someexception-can-be-thrown-an-exception-ty – Ragul May 12 '17 at 13:25
  • 1
    http://stackoverflow.com/questions/10379207/no-exception-of-type-dataaccessexception-can-be-thrown-an-exception-type-must-b – Ragul May 12 '17 at 13:26

1 Answers1

0

probably you have not NestedRuntimeException in your classloader... or any class of the JmsException heriarchy

add to classLoader spring-core jar and sure it begins to work!