尝试将Java消息服务(JMS)API与Service Bus和AMQP一起使用

时间:2015-06-13 11:48:37

标签: java maven azure amqp

我正在尝试执行此example program,但我发现以下类没有找到异常:

javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.qpid.amqp_1_0.jms.jndi.PropertiesFileInitialContextFactory [Root exception is java.lang.ClassNotFoundException: org.apache.qpid.amqp_1_0.jms.jndi.PropertiesFileInitialContextFactory]
    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 filternet.SimpleSenderReceiver.<init>(SimpleSenderReceiver.java:30)
    at filternet.SimpleSenderReceiver.main(SimpleSenderReceiver.java:60)
Caused by: java.lang.ClassNotFoundException: org.apache.qpid.amqp_1_0.jms.jndi.PropertiesFileInitialContextFactory*

我在我的pom文件中包含了以下依赖项:

 <dependency> <groupId>org.apache.qpid</groupId>
 <artifactId>qpid-jms-client</artifactId> </dependency>

但我找不到PropertiesFileInitialContextFactory类文件,也找不到本地maven存储库中的任何jndi目录。

1 个答案:

答案 0 :(得分:0)

通过单独下载jar并根据本文档将它们安装到Maven存储库中解决:

  

How to add local jar files in maven project?

然后将jar安装中的pom定义添加到项目的pom.xml文件中。