当前位置: 代码迷 >> Web前端 >> 警告: Can't find ServletContext to check for <welcome-file-list> in web.xml
  详细解决方案

警告: Can't find ServletContext to check for <welcome-file-list> in web.xml

热度:924   发布时间:2012-06-29 15:48:46.0
警告: Can't find ServletContext to check for <welcome-file-list> in web.xml.
警告: Can't find ServletContext to check for <welcome-file-list> in web.xml. Assuming defaults.
2011-9-30 14:21:32 org.directwebremoting.impl.DefaultPageNormalizer normalizePage
警告:  - To prevent this message from happening, either call the PageNormalizer from a DWR thread
2011-9-30 14:21:32 org.directwebremoting.impl.DefaultPageNormalizer normalizePage
警告:  - Or seed the PageNormalizer with a ServletContext before access from outside a DWR thread


因为使用了dwr的推送技术,在初始化web.xml时就需要将类初始化,而这个时候根本就没有网页调用这个类,当然报这样的错误了。

解决方法参考如下:http://directwebremoting.org/dwr/documentation/reverse-ajax/threads.html
添加如下红色内容即可

WebContext wctx = WebContextFactory.get();
sctx = ServerContextFactory.get(wctx.getServletContext());
wctx.getScriptSessionsByPage("");

  相关解决方案