【问题标题】:Spring NoClassDefFoundError on org/springframework/transaction/support/TransactionSynchronizationorg/springframework/transaction/support/TransactionSynchronization 上的 Spring NoClassDefFoundError
【发布时间】:2011-02-14 13:22:54
【问题描述】:

Spring JMS 对我不利,正如标题所说,我收到 NoClassDefFoundError,您可以在下面找到代码。

import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Queue;
import javax.jms.Session;

import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.JmsTemplate102;
import org.springframework.jms.core.MessageCreator;

public class JMSQueueSender {
    private JmsTemplate jmsTemplate;
    private Queue queue;

    public void setConnectionFactory(ConnectionFactory cf) {
        this.jmsTemplate = new JmsTemplate102(cf, false);
    }

    public void setQueue(Queue queue) {
        this.queue = queue;
    }

    public void simpleSend() throws Exception {
        this.jmsTemplate.send(this.queue, new MessageCreator() {
            public Message createMessage(Session session) throws JMSException {
                return session.createTextMessage("hello queue world");
            }
        });
    }
}

这也是示例代码,我在 IBM 有一个工作代码,但我正在尝试将它更改为 Spring JMS,但它不起作用。谁能帮帮我。

【问题讨论】:

    标签: spring noclassdeffounderror


    【解决方案1】:

    我猜你需要在类路径中添加spring-tx.jar(或org.springframework.transaction-*.jar 具有新的名称样式)。

    【讨论】:

      【解决方案2】:

      尝试检查您的 JAVA_HOME 和 CLASSPATH 设置。

      【讨论】:

      • 我在哪里寻找?我检查了它们,java_home 指向我的 JDK,类路径指向 IBM 和我的 JDK 的 bin 目录
      猜你喜欢
      • 2014-04-15
      • 2015-05-01
      • 2017-04-23
      • 1970-01-01
      • 2014-02-07
      • 1970-01-01
      • 2016-11-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多