Hot questions for Using Azure in amqp


I'm trying to execute this example program, but I am getting the following class not found exception:

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>(
    at filternet.SimpleSenderReceiver.main(
Caused by: java.lang.ClassNotFoundException: org.apache.qpid.amqp_1_0.jms.jndi.PropertiesFileInitialContextFactory*

I have included the following dependency in my pom file:

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

But I can't find PropertiesFileInitialContextFactory class file nor any jndi directories in the local maven repository.


Solved by downloading the jars separately and installing them into the Maven repository according to this document:

How to add local jar files in maven project?

Then adding the pom definitions from the jar installs into the project's pom.xml file.


I am trying to send messages to Service bus using AMQP QPID java library

I am getting this error:

"SessionId needs to be set for all brokered messages to a Partitioned Topic that supports Ordering"

My topic has "Enforce Message ordering" turned on (this is way i get this error i guess)

When using the Azure Service bus java library (and not AMQP) i have this function :


When using the AMQP library i do not see an option to set the session ID on the message i want to send

Note that if i un-check the option "Enforce Message ordering" the message will be sent successfully

This is my code

private boolean sendServiceBusMsg(MessageProducer sender,Session sendSession) {

        try {
            // generate message

            BytesMessage createBytesMessage = (BytesMessage)sendSession.createBytesMessage();

            createBytesMessage.setStringProperty(CAMPAIGN_ID, campaignKey);             
            createBytesMessage.setJMSMessageID("ID:" + bm.getMessageId());                                                    

            /*message is the actual data i send / not seen here*/


        } catch (JMSException e) {


The SessionId property is mapped to AMQP message The Qpid JMS client should map it to JMSXGroupID property, so try the following, createBytesMessage.setStringProperty("JMSXGroupID", "session-1");


I have already working application based on Azure EventHub. Now I need write java receiver that connects to the existing infrastructure. Existing configuration:

Event Hub > SomeName > Consumer Group > SomeGroupName

In the administrative console I cannot see any QUEUE or TOPIC definitions. Analyzing working c# code I can see that hub-name + group-name is enough to connect.

I have reconstructed url that allows me to connect over java (and connection works so far).


So my questions:

1) When instead of queue /topic I specify group-name then I get exception The messaging entity 'sb://' could not be found. What is the model used there instead of queue/topic?

2) How to work with such infrastructure from Apache-qpid?


Are you using the Event Hub created in the old portal or one created using the new portal?

EventHub is not a Message Bus, so there are no Queues or Topics, that is correct.

The consumer group is not a part of the address. The address is build using the namespace and the name of the eventhub in that namespace.

So the address becomes:


Can you post the c# code you've analyzed? Since you have an already working application maybe we can workout the differences that prevents it from working now.


I'm getting the below exception thrown at AmqpProviderFactory.createProvider in qpid-jms-client-0.40.0.jar

java.lang.NoClassDefFoundError: org/apache/qpid/proton/engine/Collector
    at org.apache.qpid.jms.provider.amqp.AmqpProviderFactory.createProvider( ~[qpid-jms-client-0.40.0.jar:?]
    at org.apache.qpid.jms.provider.amqp.AmqpProviderFactory.createProvider( ~[qpid-jms-client-0.40.0.jar:?]
    at org.apache.qpid.jms.provider.ProviderFactory.create( ~[qpid-jms-client-0.40.0.jar:?]
    at org.apache.qpid.jms.provider.ProviderFactory.create( ~[qpid-jms-client-0.40.0.jar:?]
    at org.apache.qpid.jms.JmsConnectionFactory.createProvider( ~[qpid-jms-client-0.40.0.jar:?]
    at org.apache.qpid.jms.JmsConnectionFactory.createConnection( ~[qpid-jms-client-0.40.0.jar:?]
    at org.apache.qpid.jms.JmsConnectionFactory.createConnection( ~[qpid-jms-client-0.40.0.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
    at sun.reflect.NativeMethodAccessorImpl.invoke( ~[?:1.8.0_131]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke( ~[?:1.8.0_131]
    at java.lang.reflect.Method.invoke( ~[?:1.8.0_131]
    at ~[spring-aop-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke( ~[spring-aop-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at com.sun.proxy.$Proxy715.createConnection(Unknown Source) ~[?:?]
    at org.springframework.jms.connection.SingleConnectionFactory.doCreateConnection( ~[spring-jms-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.jms.connection.SingleConnectionFactory.initConnection( ~[spring-jms-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.jms.connection.SingleConnectionFactory.getConnection( ~[spring-jms-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.jms.connection.SingleConnectionFactory.createConnection( ~[spring-jms-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at ~[spring-jms-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.jms.listener.DefaultMessageListenerContainer.refreshConnectionUntilSuccessful( ~[spring-jms-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.jms.listener.DefaultMessageListenerContainer.recoverAfterListenerSetupFailure( ~[spring-jms-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.jms.listener.DefaultMessageListenerContainer$ ~[spring-jms-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at [?:1.8.0_131]

Some of the dependencies I have in the classpath are

  • qpid-jms-client:0.40.0
  • proton-j:0.31.0
  • azure-eventhubs:2.2.0

Is there any other dependency that I should add to this to make it work?


The proton event collector class is a pretty basic bit of the proton-j library that has been in there for years so my guess is that you don't have the libraries on your classpath that you think you do. The failure indicates it cannot be found and the only reason for that should be that the library simply isn't there.