Hey, Is there a reason you're trying to use JMS? As far as I know, Azure IoT supports AMQP and MQTT (limited features). The IoT SDK uses AMQP (via proton-j). https://github.com/Azure/azure-iot-sdk-java
Cheers, Connie -----Original Message----- From: GowthamAG <govthamre...@gmail.com> Sent: Wednesday, January 6, 2021 04:15 To: users@qpid.apache.org Subject: [EXTERNAL] Cannot connect to Azure IoT Hub with Qpid JMS client The goal is to connect to Azure IoT Hub using Qpid jms client. I am getting error as "javax.jms.JMSSecurityException: Received error from remote peer without description [condition = amqp:unauthorized-access]" I have tried below code // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. import com.microsoft.azure.servicebus.primitives.ConnectionStringBuilder; import javax.jms.*; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import java.util.Hashtable; import java.util.Scanner; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; public class JmsTopicQuickstart2 { // number of messages to send private static int totalSend = 1; public void run(String connectionString) throws Exception { // The connection string builder is the only part of the azure-servicebus SDK library // we use in this JMS sample and for the purpose of robustly parsing the Service Bus // connection string. ConnectionStringBuilder csb = new ConnectionStringBuilder(connectionString); // set up the JNDI context Hashtable<String, String> hashtable = new Hashtable<>(); hashtable.put("connectionfactory.SBCF", "amqps://xxxxx.azure-devices.net?amqp.idleTimeout=120000"); hashtable.put("topic.TOPIC", "devices/device001/messages/events"); hashtable.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.qpid.jms.jndi.JmsInitialContextFactory"); Context context = new InitialContext(hashtable); ConnectionFactory cf = (ConnectionFactory) context.lookup("SBCF"); // Look up the topic Destination topic = (Destination) context.lookup("TOPIC"); // we create a scope here so we can use the same set of local variables cleanly // again to show the receive side seperately with minimal clutter { // Create Connection Connection connection = cf.createConnection(csb.getSasKeyName(), csb.getSasKey()); connection.start(); System.out.println("Started"); // Create Session, no transaction, client ack Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); // Create producer MessageProducer producer = session.createProducer(topic); // Send messaGES for (int i = 0; i < totalSend; i++) { BytesMessage message = session.createBytesMessage(); message.writeBytes(String.valueOf(i).getBytes()); producer.send(message); System.out.printf("Sent message %d.\n", i + 1); } producer.close(); session.close(); connection.stop(); connection.close(); } } public static void main(String[] args) { //System.exit(runApp(args, (connectionString) -> { JmsTopicQuickstart2 app = new JmsTopicQuickstart2(); String connectionString="HostName=xxxx.azure-devices.net;DeviceId=device001;SharedAccessKey=XXXX"; try { app.run(connectionString); //return 0; } catch (Exception e) { System.out.printf("%s", e.toString()); System.out.println("\n"+e.getLocalizedMessage()); // return 1; } //})); } } Can someone help me with this? -- Sent from: https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fqpid.2158936.n2.nabble.com%2FApache-Qpid-users-f2158936.html&data=04%7C01%7Cconniey%40microsoft.com%7C7f26984cf0ef426ba03008d8b23e84e0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637455329141125786%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=LPPl5jbowZ03U%2FJOZVN65fi2mWDe%2Fe4KxpCbY65f%2Bzg%3D&reserved=0 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org For additional commands, e-mail: users-h...@qpid.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org For additional commands, e-mail: users-h...@qpid.apache.org