java.lang.ClassNotFoundException: org.springframework.web.struts.ContextLoaderPlugIn错误
严重: action: null
java.lang.ClassNotFoundException: org.springframework.web.struts.ContextLoaderPlugIn
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
at org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:117)
at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:143)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:846)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4042)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4348)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1105)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1203)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
at java.lang.Thread.run(Thread.java:619)
2012-5-26 20:41:06 org.apache.catalina.core.ApplicationContext log
信息: Marking servlet action as unavailable
SSH开发的初期会有很多人碰到这个错误
原因是在struts-config.xml中配置了org.springframework.web.struts.ContextLoaderPlugIn
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml"/>
</plug-in>
然而又加载不到这个类,当然会报ClassNotFoundException
这个类是和Struts的整合类,并没有在spring-core.jar等文件中,而是在spring-webmvc-struts.jar中。
把spring-webmvc-struts.jar加载到ClassPath中就OK了。
如果找不到在哪里可以查找这个JAR增加到lib库文件里,用myeclipse的可以再这个路径查找到
D:\Program Files\MyEclipse\MyEclipse 10\configuration\org.eclipse.osgi\bundles\97\1\.cp\data\2.5\dist\modules\spring-webmvc-struts.jar