骆驼CXF:单向场景访问用户主体导致空指针异常
发现此问题与Websphere Liberty配置文件17.0.0.4。当我进行单向请求时,这会导致一个空指针。它适用于请求响应服务。骆驼CXF:单向场景访问用户主体导致异常" title="空指针异常">空指针异常
矿是一个春季启动应用程序。该代码可以很好地作为独立的springboot应用程序与嵌入式tomcat容器一起运行。
在Websphere Liberty配置文件中运行时发生该错误。 whend在WLP
java.lang.NullPointerException: null at com.ibm.ws.webcontainer.osgi.collaborator.CollaboratorHelperImpl.getCurrentSecurityCollaborator(CollaboratorHelperImpl.java:286) ~[na:na]
at com.ibm.ws.webcontainer.srt.SRTServletRequest.getUserPrincipal(SRTServletRequest.java:2796) ~[na:na]
at org.apache.cxf.transport.http.AbstractHTTPDestination$2.getUserPrincipal(AbstractHTTPDestination.java:392) ~[cxf-rt-transports-http-3.2.1.jar:3.2.1]
at org.apache.camel.component.cxf.DefaultCxfBinding.populateExchangeFromCxfRequest(DefaultCxfBinding.java:274) ~[camel-cxf-2.20.1.jar:2.20.1]
at org.apache.camel.component.cxf.CxfConsumer$CxfConsumerInvoker.prepareCamelExchange(CxfConsumer.java:316) ~[camel-cxf-2.20.1.jar:2.20.1]
at org.apache.camel.component.cxf.CxfConsumer$CxfConsumerInvoker.syncInvoke(CxfConsumer.java:253) ~[camel-cxf-2.20.1.jar:2.20.1]
at org.apache.camel.component.cxf.CxfConsumer$CxfConsumerInvoker.invoke(CxfConsumer.java:183) ~[camel-cxf-2.20.1.jar:2.20.1]
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) ~[cxf-core-3.2.1.jar:3.2.1]
回答:
部署我已经禁用了嵌入式容器我通过重写DefaultCxfBinding.I已禁用SecurityContext的创建,现在解决了这个。 CFX JMSConfig可以通过将createSecurityContext设置为false来做到这一点。即使是HTTP传输应该有这个功能
@覆盖 公共无效populateExchangeFromCxfRequest(交易所cxfExchange,org.apache.camel.Exchange camelExchange){
Message cxfMessage = cxfExchange.getInMessage(); cxfMessage.put(SecurityContext.class, null);
super.populateExchangeFromCxfRequest(cxfExchange, camelExchange);
}
以上是 骆驼CXF:单向场景访问用户主体导致空指针异常 的全部内容, 来源链接: utcz.com/qa/264372.html