Unsupported Media Type Error in POST Jersey Requests
When encountering an HTTP status code 415 - Unsupported Media Type in a POST request to a Jersey REST service, the issue typically lies in missing JSON/POJO support in the Jersey distribution. To resolve this error, the necessary JAR dependencies need to be added to the project.
Specifically, the following dependencies are required:
If using Maven, the dependency can be added as follows:
org.glassfish.jersey.media
jersey-media-json-jackson
2.17
Note that for users of Jersey versions other than 2.17, the transitive dependency versions may differ. Consult the Jersey documentation for the specific version being used. By adding the appropriate dependencies, JSON/POJO support will be enabled for the Jersey REST service, allowing successful POST requests with JSON content.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3