简体   繁体   中英

org.apache.cxf.interceptor.Fault: [warning] org.eclipse.jetty.io.EofException: timeout

I am using apache karaf container along with jetty, spring and cxf. And noticed lot of warning while authenticating using spring security.

Tried to find the information on web, but could not find much. Anybody experienced similar issue. Why such warnings? Will it impact?

Code Snippet 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); } 

Below is the snippet of exception stacktrace:

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)

Can you try manually setting the authentication this way please :

// 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);

Try this out and please post the log a bit more properly with proper formatting, because of which it's only possible to see warnings now, and flow is not understandable. Lemme know if this helps.

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