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
答案 0 :(得分:0)
可能您的类加载器中没有NestedRuntimeException ...或JmsException继承关系的任何类
添加到classLoader弹簧核心jar中,并确保它开始工作!