3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

JerseyでMessageBodyProviderNotFoundExceptionが出ちゃった時。にProvider作らず楽に解決する

Posted at

おそらくこちらと同じケースだと思うのですが、
[Jerseyで、MessageBodyProviderNotFoundExceptionが出ちゃった時。](http://qiita.com/ukiuni@github/items/
b2e9d4ed2bebefb1bf0a)

@Produces(MediaType.APPLICATION_JSON)とか指定したところにアクセスすると "MessageBodyWriter not found for media type=application/json" って出てしまう症状でしょうか。

もちろんProviderを作ってもよいのですが、「それすらめんどくさい!」っていう人は以下のようにMOXyとJacksonを組み合わせてしまうのが楽です。具体的には jersey-media-moxy と jersey-media-json-jackson を突っ込みます。

gradleだとこんな感じです。

build.bradle
dependencies {
 ...
 
    compile('org.glassfish.jersey.media:jersey-media-moxy:2.17')
    compile('org.glassfish.jersey.media:jersey-media-json-jackson:2.17')
}

私の場合はMyBatis Generatorで自動生成したentityを突っ込んだらこれでコケてました。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?