警告: Can't find ServletContext to check for 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("");

你可能感兴趣的:(警告: Can't find ServletContext to check for in web.xml.)