Inavlid connection string in java

Pravalika Suryadevara 6 Reputation points
2021-03-24T04:31:14.763+00:00

Hi,

I have given the connection string from the service bus namespace but while running the code the following error is shown

SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.IllegalArgumentException: Illegal connection string parameter name: <Endpoint
at com.azure.core.amqp.implementation.ConnectionStringProperties.<init>(ConnectionStringProperties.java:98)
at com.azure.messaging.servicebus.ServiceBusClientBuilder.connectionString(ServiceBusClientBuilder.java:153)
at pack1.class1.sendMessage(class1.java:19)
at pack1.class1.main(class1.java:152)

Process finished with exit code 1

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
548 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 68,656 Reputation points
    2021-03-24T04:45:13.867+00:00

    Hi @Pravalika Suryadevara

    Welcome to Microsoft Q&A! Thanks for posting the question.

    As per the error message your connection string is not in the right format. Please make sure you are copying the primary/secondary connection string from the portal and you are not removing any part of the connection string while copying it from the portal. If someone has provided you the connecting string then make sure there is no special character in the connection string. You can use the command prompt (cmd) and paste it to verify if there were any special characters or use ASCII formatting.

    The connection string format will be :
    Endpoint=sb://{yournamespacename}.servicebus.windows.net/;SharedAccessKeyName={yourSharedAccessKeyName};SharedAccessKey={yourSharedAccessKey}

    80995-image.png

    Reference: https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-quickstart-portal#get-the-connection-string

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

    1 person found this answer helpful.