简体   繁体   中英

The method request(String...) in the type WebTarget is not applicable for the arguments (MediaType)

I'm doing Jersey client and getting this error on a line

String response = target.path("activities/" + id).request(MediaType.APPLICATION_JSON).get(String.class);

Java - 1.8.0.73 / Jersey - 2.22.2

According to docs - it should work, eclipse shows 3 overloads, but still: The method request(String...) in the type WebTarget is not applicable for the arguments (MediaType)

Why it doesn't see other overloads and throws an exception?

导入了错误的 MediaType - org.eclipse.persistence.oxm.MediaType 而不是 javax.ws.rs.core.MediaType

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM