项目应用rocketMQ
<dependency>
<groupId>com.aliyun.mq</groupId>
<artifactId>mq-http-sdk</artifactId>
<version>1.0.3.2</version>
<classifier>jar-with-dependencies</classifier>
</dependency>
如果按照官方的demo去实现http版的customer的时候。在openjdk11的情况下 会抛出一系列的interError。使用IDEA debug的时候发现。
try {
ConsumeMessageAction action = new ConsumeMessageAction(serviceClient, credentials, endpoint);
request.setRequestPath(topicURL + "/" + Constants.LOCATION_MESSAGES);
return action.executeWithCustomHeaders(request, null);
} catch (ServiceException e) {
if (Constants.CODE_MESSAGE_NOT_EXIST.equals(e.getErrorCode())) {
return null;
} else {
throw e;
}
serviceException抛出来的时候无法解析的Exception。(然后看无法解析的内容 其实就是消息不存在)。正常来说按照代码逻辑消息不存在应该抛出的是null。
没办法 继续debug。
他内部有一个static map 他会在第一次没找到的时候去加载。但是一直就是没找到。就是下面的initJAXBContext 方法。
org.apache.http.impl.client.HttpRequestTaskCallable#call
com.aliyun.mq.http.common.http.HttpCallback#buildResponseMessage
...............中间省略N步
com.aliyun.mq.http.common.parser.JAXBResultParser#parse(java.io.InputStream)
到达最下面这个func
他里面有一个func 叫initJAXBContext继续往下走
最后会在
javax.xml.bind.ContextFinder#firstByServiceLoaderDeprecated
这里面发现问题。具体的需要自己的DEBUG才会有感觉。
其实是Jaxb-api 和Jaxb-impl没有
解决方式:在pom里面引入即可。