HornetQ-java.lang.NoClassDefFoundError:Lorg/hornetq/core/logging/Logger; [英] HornetQ - java.lang.NoClassDefFoundError: Lorg/hornetq/core/logging/Logger;

查看:183
本文介绍了HornetQ-java.lang.NoClassDefFoundError:Lorg/hornetq/core/logging/Logger;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从书中运行一个简单的HornetQ示例(《 HornetQ消息传递开发人员指南》),但会收到错误消息.我没有使用过maven,因为我想紧紧抓住书中给出的例子. HornetQ独立服务器在命令行中正常启动.我只是想向HonretQ服务器发送消息.

I am trying to run a simple HornetQ example from a book (HornetQ Messaging Developers Guide) but get error messages. I have not used maven since I wanted to stick close to the example given in the book. The HornetQ Standalone server started normally in command line. I am just trying to send a message to the HonretQ server.

package chapter01;

import javax.jms.JMSException;
import javax.naming.NamingException;

public class ECGMessageConsumerProducerExample {

    public static void main(String[] args) throws NamingException, JMSException {
        // TODO Auto-generated method stub


         javax.naming.Context ic = null;
         javax.jms.ConnectionFactory cf = null;
         javax.jms.Connection connection = null;
         javax.jms.Queue queue = null;
         javax.jms.Session session = null;
         com.mongodb.Mongo m;
         com.mongodb.DB db;
         String destinationName = "queue/DLQ";


         java.util.Properties p = new java.util.Properties();
         p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
         "org.jnp.interfaces.NamingContextFactory");
         p.put(javax.naming.Context.URL_PKG_PREFIXES,
         "org.jboss.naming:org.jnp.interfaces");
         p.put(javax.naming.Context.PROVIDER_URL, "jnp://localhost:1099");
         ic = new javax.naming.InitialContext(p);


         cf = (javax.jms.ConnectionFactory)ic.lookup("/ConnectionFactory");
         queue = (javax.jms.Queue)ic.lookup(destinationName);
         connection = cf.createConnection();
         session = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
         connection.start();


         String theECG = "1;02/20/2012 14:01:59.010;1020,1021,1022";
         javax.jms.MessageProducer publisher = session.createProducer(queue);
         javax.jms.TextMessage message =
         session.createTextMessage(theECG);
         publisher.send(message);
         System.out.println("Message sent!");
         publisher.close();





    }

}

虽然我添加了书中提到的所有罐子,但遇到以下错误:

Eventhough I added all jars mentioned in the book I get the following Error:

Exception in thread "main" java.lang.NoClassDefFoundError: Lorg/hornetq/core/logging/Logger;
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Unknown Source)
    at java.lang.Class.getDeclaredField(Unknown Source)
    at java.io.ObjectStreamClass.getDeclaredSUID(Unknown Source)
    at java.io.ObjectStreamClass.access$700(Unknown Source)
    at java.io.ObjectStreamClass$2.run(Unknown Source)
    at java.io.ObjectStreamClass$2.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.io.ObjectStreamClass.<init>(Unknown Source)
    at java.io.ObjectStreamClass.lookup(Unknown Source)
    at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
    at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
    at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at org.hornetq.jms.referenceable.SerializableObjectRefAddr.deserialize(SerializableObjectRefAddr.java:79)
    at org.hornetq.jms.referenceable.ConnectionFactoryObjectFactory.getObjectInstance(ConnectionFactoryObjectFactory.java:43)
    at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
    at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1479)
    at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1496)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:822)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at chapter01.ECGMessageConsumerProducerExample.main(ECGMessageConsumerProducerExample.java:31)
Caused by: java.lang.ClassNotFoundException: org.hornetq.core.logging.Logger
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 27 more

我还添加了许多其他与该主题相关的jar,但是没有解决问题.

I also added a bunch of other jars that I found related to this topic, but without solving the problem.

是否会产生错误?

推荐答案

您需要

You need hornetq-core jar, download and use it

这篇关于HornetQ-java.lang.NoClassDefFoundError:Lorg/hornetq/core/logging/Logger;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆