我在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
答案 0 :(得分:4)
看起来你错过了:
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。