getServletContext().getRealPath("/WEB-INF")

修改为

ServletActionContext.getRequest().getSession().getServletContext().getRealPath("/WEB-INF")

即可