代码报错:
java.lang.ClassNotFoundException: com.tujia.core.filter.SecurityFilter at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:527) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:509) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4775) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5452) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)
找不到类,但是,在我的代码中,并没有这个类的引用。
用eclipse的全局搜索,发现,在web.xml中,有注释,
<filter><!-- com.tujia.core.filter.SecurityFilter --> <filter-name>securityFilter</filter-name> <filter-class>com.tujia.corelogin.filter.SecurityFilter</filter-class> <init-param> <param-name>ignores</param-name><!-- /tbk, --> <param-value>/app/appNavs,/app/download,/tulogin,/tulogout,/static,/noauthority,/img/select</param-value> </init-param> <!-- <init-param> <param-name>checks</param-name>/tbk, <param-value>/,/app/,/video/</param-value> </init-param> --> </filter> <filter-mapping> <filter-name>securityFilter</filter-name> <url-pattern>*</url-pattern> </filter-mapping>
这句话是我已经注释掉的,但是,在xml中,并不是不编译,而是编译不执行,所以,会报错classnotfound.
<!-- com.tujia.core.filter.SecurityFilter -->
类似的这种问题,在jsp,xml中,会有很多,因为在这些文件中,注释并不代表不编译。希望以后注意一下。
时间: 2024-09-30 04:35:08