1 Reply Latest reply on Jul 22, 2011 2:36 PM by Rafael Chies

    BadRequestException using the REST interface

    Rafael Chies Novice

      I am trying to test the REST interface for HornetQ, but I am got a BadRequestException.

       

      This is my test:

       

      I'am using JBoss EAP 5.1.0, with hornetq 2.2.5, and using the profile default-with-hornetq that was generated.

       

      I've defined a simple queue /queue/ChiesQueue. I've tested it without rest interface and all is working fine.

       

      I am using the follow libs, taken from the hornetq lib/rest folder, with scannotation as an exception. Also, I've already tried using the libs inside my WAR and in the lib folder of my profile.

       

      hornetq-rest-2.2.5.Final.jar

      jaxb-impl.jar

      jaxrs-api.jar

      scannotation.jar

      resteasy-jaxrs.jar

       

       

      So, I am trying this access:

       

      HEAD http://localhost:8080/hornetq-resteasy/queues/jms.queue.ChiesQueue

       

      and getting this exception:

       

      Failed executing HEAD /queues/jms.queue.ChiesQueue

      org.jboss.resteasy.spi.InternalServerErrorException: Failed processing arguments of public org.hornetq.rest.queue.QueueDestinationsResource(org.hornetq.rest.queue.QueueServiceManager)

       

      ...

       

       

      Caused by: org.jboss.resteasy.spi.BadRequestException: Could not find message body reader for type: class org.hornetq.rest.queue.QueueServiceManager of content type: text/plain;charset="utf-8"

                at org.jboss.resteasy.core.MessageBodyParameterInjector$ReaderUtilityImpl.createReaderNotFound(MessageBodyParameterInjector.java:75)

                at org.jboss.resteasy.core.messagebody.ReaderUtility.doRead(ReaderUtility.java:106)

                at org.jboss.resteasy.core.messagebody.ReaderUtility.doRead(ReaderUtility.java:93)

       

       

      Many thanks in advice.

        • 1. Re: BadRequestException using the REST interface
          Rafael Chies Novice

          Just for information. I've taken off the follow listener from web.xml.

          <listener>

                              <listener-class>org.hornetq.rest.integration.RestMessagingBootstrapListener</listener-class>

          </listener>

           

          It can be the cause of my problem.But, if I put this listener on web.xml, i get this exception when starting JBoss:

           

          Caused by: org.jboss.resteasy.spi.LoggableFailure: You cannot have 2 locators for same path: {queue-name}

                    at org.jboss.resteasy.core.registry.RootSegment.addPath(RootSegment.java:67)

                    at org.jboss.resteasy.core.registry.RootSegment.addPath(RootSegment.java:97)

           

          Maybe because of these two definitions on resource QueueDesinationResource:

           

          @DELETE

          @Path("/{queue-name}")

          deleteQueue(@PathParam("queue-name") String name)

           

          @Path("/{queue-name}")

          findQueue(@PathParam("queue-name") String name)