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();
}
}
}
上面是我的代码,即使我有try / catch块,也会出现以下错误。有帮助吗?非常感谢!!!
No exception of type JmsException can be thrown; an exception type must be a subclass of Throwable
可能你的类加载器中没有NestedRuntimeException ...或者JmsException heriarchy的任何类
添加到classLoader spring-core jar并确保它开始工作!