Spring Integration
  1. Spring Integration
  2. INT-2121

Message header value has type com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Complete
    • Affects Version/s: 2.1 M1
    • Fix Version/s: 2.1 M2
    • Component/s: AMQP Support
    • Labels:
      None

      Description

      This issue is exactly similar to https://jira.springsource.org/browse/AMQP-170 defect

      it is occurring when i am trying to receive AMQP message through AMQP inbound-channel-adapter connected to http:outbound-gateway

      http:outbound-gateway throws following Error

      Caused by: java.lang.IllegalArgumentException: Expected MediaType or String value for 'Content-Type' header value, but received: class com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString
      at org.springframework.integration.http.support.DefaultHttpHeaderMapper.setHttpHeader(DefaultHttpHeaderMapper.java:571)

      analyzing the spring-integration-amqp code pointed the problem in org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper.toHeaders() method

      1. HeaderMapper.java
        1 kB
        Dayanand
      2. pom.xml
        8 kB
        Dayanand

        Activity

        Hide
        Mark Fisher added a comment -

        Are you passing 'Content-Type' withing the headers Map of the AMQP Message's properties, or are you passing it as the actual "content-type" property there?

        Show
        Mark Fisher added a comment - Are you passing 'Content-Type' withing the headers Map of the AMQP Message's properties, or are you passing it as the actual "content-type" property there?
        Hide
        Dayanand added a comment -

        yes, i am passing it through http inbound gateway "mapped-request-headers="content-type"

        Scenarios are as follows

        1) set up a http inbound gateway have which will recive XML Content-Type set as "application/xml" in the header and "mapped-request-headers="content-type" is present

        2)this is routed to a out bound amqp adapter for storing into a Queue.

        3)another inbound amqp adapter picks messages from the above Queue and sends to HTTP outbound gateway where the exception is thrown.

        as of now i have simply extended DefaultAmqpHeaderMapper class and set the header-mapper="customHeaderMapper" in amqp:inbound-channel-adapter

        Show
        Dayanand added a comment - yes, i am passing it through http inbound gateway "mapped-request-headers="content-type" Scenarios are as follows 1) set up a http inbound gateway have which will recive XML Content-Type set as "application/xml" in the header and "mapped-request-headers="content-type" is present 2)this is routed to a out bound amqp adapter for storing into a Queue. 3)another inbound amqp adapter picks messages from the above Queue and sends to HTTP outbound gateway where the exception is thrown. as of now i have simply extended DefaultAmqpHeaderMapper class and set the header-mapper="customHeaderMapper" in amqp:inbound-channel-adapter
        Hide
        Mark Fisher added a comment -

        Can you verify exactly what version of spring-rabbit you have on your classpath when seeing this error? It seems to me that the particular example you are describing should have been covered by the AMQP-170 issue.

        Show
        Mark Fisher added a comment - Can you verify exactly what version of spring-rabbit you have on your classpath when seeing this error? It seems to me that the particular example you are describing should have been covered by the AMQP-170 issue.
        Hide
        Dayanand added a comment -

        1.0.0.RELEASE

        Show
        Dayanand added a comment - 1.0.0.RELEASE
        Hide
        Dayanand added a comment -

        Please check the dependencies

        Show
        Dayanand added a comment - Please check the dependencies
        Hide
        Dayanand added a comment -

        Please verify the pom.xml attached

        Show
        Dayanand added a comment - Please verify the pom.xml attached
        Hide
        Mark Fisher added a comment -

        Can you try removing the explicit dependencies that should be handled transitively? For example, "spring-integration-amqp" will bring in "spring-rabbit" and all of the necessary RabbitMQ client dependencies, so you can remove those from your list. I just want to make sure you still see the problem at that point.

        Thanks,
        Mark

        Show
        Mark Fisher added a comment - Can you try removing the explicit dependencies that should be handled transitively? For example, "spring-integration-amqp" will bring in "spring-rabbit" and all of the necessary RabbitMQ client dependencies, so you can remove those from your list. I just want to make sure you still see the problem at that point. Thanks, Mark
        Hide
        Dayanand added a comment -

        You are correct . after removing the following dependencies it worked properly

        <!-- <dependency>
        <groupId>com.rabbitmq</groupId>
        <artifactId>com.springsource.com.rabbitmq.client</artifactId>
        <version>1.8.1</version>
        </dependency>

        <dependency>
        <groupId>com.rabbitmq</groupId>
        <artifactId>amqp-client</artifactId>
        <version>2.6.0</version>
        </dependency> -->

        Thanks a lot

        Dayanand

        Show
        Dayanand added a comment - You are correct . after removing the following dependencies it worked properly <!-- <dependency> <groupId>com.rabbitmq</groupId> <artifactId>com.springsource.com.rabbitmq.client</artifactId> <version>1.8.1</version> </dependency> <dependency> <groupId>com.rabbitmq</groupId> <artifactId>amqp-client</artifactId> <version>2.6.0</version> </dependency> --> Thanks a lot Dayanand
        Hide
        Mark Fisher added a comment -

        Thanks for letting us know. I am going to mark this as resolved since it was an issue and others may come across it. However, it appears that the real fix is in Spring AMQP itself.

        Show
        Mark Fisher added a comment - Thanks for letting us know. I am going to mark this as resolved since it was an issue and others may come across it. However, it appears that the real fix is in Spring AMQP itself.

          People

          • Assignee:
            Mark Fisher
            Reporter:
            Dayanand
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: