Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Invalid
    • Affects Version/s: 2.0-m03
    • Fix Version/s: 2.0-m03, 2.0
    • Component/s: media
    • Labels:
      None

      Description

      I created a very simple project with one bean and a resource implementing HTTP POST such that it echoes the sent entity. The test fails (no content received from the server). The same sample works if I switch to application/xml. So it is json specific problem. From the brief investigation using wireshark seems the client sends the correct JSON, but server fails to deserialize it - returns null.

        Activity

        Hide
        Martin Matula added a comment -

        Project that reproduces the issue. Simply run the test in the project.

        Show
        Martin Matula added a comment - Project that reproduces the issue. Simply run the test in the project.
        Hide
        Miroslav Fuksa added a comment -

        In the given example project MessageBodyReader for application/json was not found on the server. Module JsonJaxbModule was not registered on the server (contains readers for application/json).

        To fix this problem change thee line in Main.startServer from:
        final ResourceConfig rc = ResourceConfig.builder().packages("test.mavenproject2").build();
        to:
        final ResourceConfig rc = ResourceConfig.builder().addModules(new JsonJaxbModule()).packages("test.mavenproject2").build();

        diff is: .addModules(new JsonJaxbModule())

        this module will register the json body providers.

        However, the problem of this issue is that the server returns response with status code 204 (no content). So, the client does not get any information that the given type is not supported by the server. Therefore new issue was raised to fix this problem. See JIRA-1058.

        Show
        Miroslav Fuksa added a comment - In the given example project MessageBodyReader for application/json was not found on the server. Module JsonJaxbModule was not registered on the server (contains readers for application/json). To fix this problem change thee line in Main.startServer from: final ResourceConfig rc = ResourceConfig.builder().packages("test.mavenproject2").build(); to: final ResourceConfig rc = ResourceConfig.builder().addModules(new JsonJaxbModule()).packages("test.mavenproject2").build(); diff is: .addModules(new JsonJaxbModule()) this module will register the json body providers. However, the problem of this issue is that the server returns response with status code 204 (no content). So, the client does not get any information that the given type is not supported by the server. Therefore new issue was raised to fix this problem. See JIRA-1058.
        Hide
        Miroslav Fuksa added a comment -

        See previous comment about this issue. The test case was invalid (in the example the JSonJaxbModule was not registered on the server and therefore no MessageBodyReader was found). To fix wrong response code (also in the comments) new JIRA-1058 bug was raised.

        Show
        Miroslav Fuksa added a comment - See previous comment about this issue. The test case was invalid (in the example the JSonJaxbModule was not registered on the server and therefore no MessageBodyReader was found). To fix wrong response code (also in the comments) new JIRA-1058 bug was raised.

          People

          • Assignee:
            Miroslav Fuksa
            Reporter:
            Martin Matula
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 5 hours
              5h