[英]CXF 2.7.7 org.apache.cxf.interceptor.Fault: Unexpected element
[英]org.apache.cxf.interceptor.Fault: [warning] org.eclipse.jetty.io.EofException: timeout
我正在使用apache karaf容器以及碼頭,彈簧和cxf。 並且在使用Spring Security進行身份驗證時注意到很多警告。
試圖在網上查找信息,但找不到太多。 任何人都遇到過類似的問題。 為什么會有這樣的警告? 有影響嗎?
代碼段 public void prepareSecurityContext(ServletRequest request, ServletResponse response, FilterChain chain, MeetingRef user, String username, String token) throws IOException, ServletException {
// Build an Authentication object with the user's info AbstractAuthenticationToken auth = new UserTokenAuthentication( username, token, getAuthorities(user)); auth.setDetails(new WebAuthenticationDetailsSource() .buildDetails((HttpServletRequest) request)); // Set the authentication into the SecurityContext SecurityContextHolder.getContext().setAuthentication(auth); // Continue through the filter chain chain.doFilter(request, response); }
下面是異常堆棧跟蹤的代碼段:
2015-07-23T09:37:42.0 localhost.localdomain org.apache.cxf.interceptor.Fault: [warning] org.eclipse.jetty.io.EofException: timeout 2015-07-23T09:37:42.0 localhost.localdomain at [warning] org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:1243) 2015-07-23T09:37:42.0 localhost.localdomain at [warning] org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:782) 2015-07-23T09:37:42.0 localhost.localdomain at [warning] org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:741)
......................................................
2015-07-23T09:37:42.0 localhost.localdomain Caused [warning] by: java.lang.RuntimeException: org.eclipse.jetty.io.EofException: timeout 2015-07-23T09:37:42.0 localhost.localdomain at [warning] org.apache.cxf.attachment.LazyAttachmentCollection.loadAll(LazyAttachmentCollection.java:58) 2015-07-23T09:37:42.0 localhost.localdomain at [warning]
....................................................... org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 2015-07-23T09:37:42.0 localhost.localdomain at [warning] com.mypackage.UserAuthenticationProcessingFilter.prepareSecurityContext(UserAuthenticationProcessingFilter.java:132)
您可以嘗試以這種方式手動設置身份驗證嗎:
// Below gets the object from the database for the user which you want to authenticate.
Person person1 = this.personService.findPersonByUsername(username);
Collection<GrantedAuthority> authorities = new ArrayList<>();
// Add the role of the user
authorities.add(new SimpleGrantedAuthority("ROLE_USER"));
Authentication authentication = new UsernamePasswordAuthenticationToken(person1, null, authorities);
SecurityContextHolder.getContext().setAuthentication(authentication);
嘗試一下,請使用正確的格式更正確地發布日志,因此現在只能看到警告,並且流程無法理解。 萊姆知道這是否有幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.