resin getRemoteAddr()总是抛出NullPointerException

时间:2014-03-07 06:01:46

标签: java spring nullpointerexception resin

使用nginx + resin4.0 pro的Linux web服务器,总是抛出这样的错误:

{http://*:8082-117} java.lang.NullPointerException
    at com.caucho.server.http.HttpServletRequestImpl.getRemoteAddr(HttpServletRequestImpl.java:237)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:921)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:96)
    at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
    at com.caucho.server.cache.ProxyCacheFilterChain.doRequestCacheable(ProxyCacheFilterChain.java:245)
    at com.caucho.server.cache.ProxyCacheFilterChain.doFilter(ProxyCacheFilterChain.java:188)
    at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
    at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:287)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:792)
    at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:730)
    at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:689)
    at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:669)
    at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:617)
    at com.caucho.network.listen.AcceptTask.doTask(AcceptTask.java:104)
    at com.caucho.network.listen.ConnectionReadTask.runThread(ConnectionReadTask.java:98)
    at com.caucho.network.listen.ConnectionReadTask.run(ConnectionReadTask.java:81)
    at com.caucho.network.listen.AcceptTask.run(AcceptTask.java:67)
    at com.caucho.env.thread.ResinThread.runTasks(ResinThread.java:164)
    at com.caucho.env.thread.ResinThread.run(ResinThread.java:130)

1 个答案:

答案 0 :(得分:0)

可能由较旧的resin.jar引起。代码:

    public String getRemoteAddr(){return _request.getRemoteAddr();}

此代码于2012年6月16日更新,并成为:

    public String getRemoteAddr(){AbstractHttpRequest request = _request;   return request != null ? request.getRemoteAddr() : null;}