question

PravalikaSuryadevara-1638 avatar image
1 Vote"
PravalikaSuryadevara-1638 asked MayankBargali-MSFT commented

Inavlid connection string in java

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
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MayankBargali-MSFT avatar image
1 Vote"
MayankBargali-MSFT answered MayankBargali-MSFT commented

Hi @PravalikaSuryadevara-1638

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://docs.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.


image.png (11.8 KiB)
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MayankBargali-MSFT avatar image MayankBargali-MSFT PravalikaSuryadevara-1638 ·

@PravalikaSuryadevara-1638 Please regenerate the keys. I have updated your comment to hide the namespace name and connecting string.
Please share the code on how you are authenticating the client.

Reference: https://docs.microsoft.com/en-us/java/api/overview/azure/messaging-servicebus-readme?view=azure-java-stable#authenticate-the-client

0 Votes 0 ·
MayankBargali-MSFT avatar image MayankBargali-MSFT PravalikaSuryadevara-1638 ·

@PravalikaSuryadevara-1638 The code looks good. Can you confirm what is the value of connectionString parameter? Want to reconfirm if the value is correctly passed or not coming as null.

0 Votes 0 ·