我在Eclipse和Tomcat中使用QPid。创建一个动态Web应用程序并设置QPID_HOME,QPID_WORK环境变量。

试用此处提到的Hello.java示例:

https://svn.apache.org/repos/asf/qpid/trunk/qpid/java/client/example/

但是我在运行此文件时遇到这些错误:-

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/qpid/url/URLSyntaxException
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.init(Unknown Source)
    at javax.naming.InitialContext.<init>(Unknown Source)
    at myApp.runTest(myApp.java:25)
    at myApp.main(myApp.java:15)
Caused by: java.lang.ClassNotFoundException: org.apache.qpid.url.URLSyntaxException
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    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)
 ... 9 more

最佳答案

看来您失踪了:

qpid-common-0.10.jar


可从http://qpid.apache.org/download.html获得

要么

<dependency>
   <groupId>org.apache.qpid</groupId>
   <artifactId>qpid-common</artifactId>
   <version>0.10</version>
</dependency>


如果您正在使用Maven。

关于java - 线程“main”中的异常java.lang.NoClassDefFoundError:org/apache/qpid/url/URLSyntaxException,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11617005/

10-10 19:17