at org.apache.struts.action.ActionServlet.parseModuleConfigFile错误的解决方法
tomcat 启动后,报出了如下异常
java.lang.NullPointerException at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1003),
?
private void parseModuleConfigFile( String prefix, String paths, ModuleConfig config, Digester digester, String path) throws UnavailableException { InputStream input = null; try { URL url = getServletContext().getResource(path); InputSource is = new InputSource(url.toExternalForm()); input = getServletContext().getResourceAsStream(path); is.setByteStream(input); digester.parse(is); getServletContext().setAttribute(Globals.MODULE_KEY + prefix, config); } catch (MalformedURLException e) { handleConfigException(paths, e); } catch (IOException e) { handleConfigException(paths, e); } catch (SAXException e) { handleConfigException(paths, e); } finally { if (input != null) { try { input.close(); } catch (IOException e) { throw new UnavailableException(e.getMessage()); } } } }
?
?第1003行就是
?URL url = getServletContext().getResource(path);
也就是说在查找配置文件的过程中,有一个path找不多对应的资源文件;
?
然后在web.xml的config字段中,挨个检查配置文件,发现找不到 /WEB-INF/struts-config-scmt.xml 对应的源文件,于是找到出错原因。