在 WebSphere Liberty 中将 JSON 消息发布到我的 REST 服务时,我遇到了以下问题。
这只发生在我将 Apache Wink 客户端 jar 捆绑到我的 WAR 中时。
[29/01/14 18:52:57:634 GMT] 00000027 org.apache.wink.server.internal.RequestProcessor I The following error occurred during the invocation of the handlers chain: WebApplicationException (415 - Unsupported Media Type) with message 'null' while processing POST request sent to http://host:9080/my-war/myrest/req
我要添加的依赖项:
<dependency>
<groupId>org.apache.wink</groupId>
<artifactId>wink-client</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.wink</groupId>
<artifactId>wink-client-apache-httpclient</artifactId>
<version>1.4</version>
</dependency>
自由版:
WebSphere Application Server 8.5.5.1 (wlp-1.0.4.cl50120131011-1639)
有没有办法解决这个问题?
固定的
在下面的 Anton 链接之后,我将wink-client
依赖范围更改为<scope>provided</scope>
并将以下内容添加到 WAS Liberty 中server.xml
:
<application location="C:\myproject\target\myapp.war" type="war">
<classloader apiTypeVisibility="spec,ibm-api,api,third-party"/>
</application>