JMS message listener invoker failed, Cause: Identifier contains invalid JMS identifier character '-': 'x-request-id'
Asked Answered
C

3

9

I'm working with JMS and queues (Azure queues) for the first time. I'm required to make a queue where Rubi server would write some data and Java would read it from queue and will do further executions. This process is working fine locally on my machine. I've created a REST endpoint which is writing data in the queue and once data is written in the queue, the listener would take over and read the data and execute. When we deploy it to Azure the error I can see in logs which is not letting the Queues start is

Setup of JMS message listener invoker failed for destination 'queue' - trying to recover. Cause: Identifier contains invalid JMS identifier character '-': 'x-request-id' 

Zipkin is also present on the Azure server as a distributed tracing system and I guess this x-request-id is related to Zipkin which is creating the problem. I've searched Google for the issue but couldn't understand why its happening.

Following is detailed error message:

[36mc.m.s.l.NextGenRequestLoggingFilter     [0;39m [2m:[0;39m 
Before request [uri=/services/deal-service/api/v2/deals/ack;headers= 
[x-request-id:"2d8d86d7-4fbf-9db6-8e95-28813f21a85c", 
x-envoy-internal:"true", x-b3-parentspanid:"a209cdc649b0b890", content- 
length:"575", x-forwarded-proto:"http", postman-token:"ad074595- 
76a5-474b-9711-7e071b12b3b0", x-b3-sampled:"1", x-forwarded- 
for:"10.244.2.1", accept:"*/*", 
authorization: "some-token-YJc4tg--34jPRziJNSACqNQ", x-b3- 
traceid:"6b40ff22781be67ba209cdc649b0b890", x-b3- 
spanid:"702684ddb62cfe6b", 
host:"portal-gateway.52.228.65.225.nip.io", 
cache-control:"no-cache", accept-encoding:"gzip, deflate, br", 
user-agent:"PostmanRuntime/7.22.0", 
Content-Type:"application/xml;charset=UTF-8"]]
2020-02-18T15:19:34.197666458Z [2m2020-02-18 15:19:34.197[0;39m  . 
[32mDEBUG 
[,6b40ff22781be67ba209cdc649b0b890,702684ddb62cfe6b,true][0;39m  . 
[35m9[0;39m [2m---[0;39m [2m[ XNIO-1 task-15][0;39m
Cinematography answered 12/2, 2020 at 14:6 Comment(3)
What is "Rubi server" and how is it writing the data to the queue which you're attempting to use from your JMS client?Lymphosarcoma
Where is the actual error in the "detailed error message" which you pasted? That just looks like some debug logging.Lymphosarcoma
Whee is the code?Cliquish
E
1

From the error message its obvious that you are using qpid JMS client for communication through queues. qpid client won’t allow any keys which violates java variable naming convention e.g. you won’t be able to send x-request-id in a queue’s header which qpid jms client is consuming as it’ll throw error. You need to take care of istio/zipkin to not to add certain headers (id you don’t need them actually) with the queue when its trying to communicate on azure bus. So you have to disable the istio/zipkin libraries to intercept the request for queues so that request to/from queue can be made without headers. This will fix the issue.

Etude answered 25/2, 2020 at 10:26 Comment(0)
L
4

Section 3.5.1 of the JMS 2 specification states this about message properties:

Property names must obey the rules for a message selector identifier. See Section 3.8 “Message selection” for more information.

In regards to identifiers, section 3.8.1.1 states, in part:

An identifier is an unlimited-length character sequence that must begin with a Java identifier start character; all following characters must be Java identifier part characters. An identifier start character is any character for which the method Character.isJavaIdentifierStart returns true. This includes '_' and '$'. An identifier part character is any character for which the method Character.isJavaIdentifierPart returns true.

If you pass the character - into either Character.isJavaIdentifierStart or Character.isJavaIdentifierPart the return value is false. In other words, the - character in the name of a message property violates the JMS specification and therefore will cause an error.

Lymphosarcoma answered 21/2, 2020 at 1:40 Comment(0)
E
1

From the error message its obvious that you are using qpid JMS client for communication through queues. qpid client won’t allow any keys which violates java variable naming convention e.g. you won’t be able to send x-request-id in a queue’s header which qpid jms client is consuming as it’ll throw error. You need to take care of istio/zipkin to not to add certain headers (id you don’t need them actually) with the queue when its trying to communicate on azure bus. So you have to disable the istio/zipkin libraries to intercept the request for queues so that request to/from queue can be made without headers. This will fix the issue.

Etude answered 25/2, 2020 at 10:26 Comment(0)
P
0

Details of error (Java stack trace) would be really useful here.

By error message I assume, you are using qpid JMS client, that is performing check of message properties' names. These names can contain only characters, that are valid Java identifier characters.

In string 'queue-name' there is a '-' character, that is not Java identifier. To fix, you need to change 'queue-name' into something with valid characters, for example 'queue_name' (with underscore), or 'queueName' (camel case).

Polanco answered 18/2, 2020 at 15:41 Comment(1)
I've updated question with detailed error message. We can see values in header (i.e. x-request-id) is creating the issue. its getting added through istio. But somehow JMS is not being able to parse these.Cinematography

© 2022 - 2024 — McMap. All rights reserved.