用了一下struts2,结果刚启动TOMCAT我就石化了。

TOMCAT告诉我: Exception starting filter struts2

Thursday, 24. March, 16:09
2011-3-24 16:07:16 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\dev\Java\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:\dev\Java\jre\bin;D:/dev/Java/bin/../jre/bin/server;D:/dev/Java/bin/../jre/bin;D:/dev/Java/bin/../jre/lib/amd64;D:\dev\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\dev\DB\MySQL\MySQL5.5\bin;D:\dev\eclipse-SDK-3.6.2-win32-x86_64\eclipse;
2011-3-24 16:07:17 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2011-3-24 16:07:17 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 1130 ms
2011-3-24 16:07:17 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2011-3-24 16:07:17 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.32
2011-3-24 16:07:17 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor host-manager.xml
2011-3-24 16:07:17 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor manager.xml
2011-3-24 16:07:18 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor phonebook.xml
2011-3-24 16:07:18 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:269)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4071)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4725)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1315)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
2011-3-24 16:07:18 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2011-3-24 16:07:18 org.apache.catalina.core.StandardContext start
严重: Context [/phonebook] startup failed due to previous errors
2011-3-24 16:07:18 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor Struts2Demo.xml
2011-3-24 16:07:19 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts-default.xml]
2011-3-24 16:07:19 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts-plugin.xml]
2011-3-24 16:07:19 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts.xml]
2011-3-24 16:07:19 org.apache.struts2.config.Settings getLocale
警告: Settings: Could not parse struts.locale setting, substituting default VM locale
2011-3-24 16:07:19 com.opensymphony.xwork2.util.ObjectTypeDeterminerFactory <clinit>
信息: Detected GenericsObjectTypeDeterminer, initializing it...
2011-3-24 16:07:19 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory docs
2011-3-24 16:07:19 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory examples
2011-3-24 16:07:20 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2011-3-24 16:07:20 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2011-3-24 16:07:20 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory ROOT
2011-3-24 16:07:20 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2011-3-24 16:07:20 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2011-3-24 16:07:20 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/50 config=null
2011-3-24 16:07:20 org.apache.catalina.startup.Catalina start
信息: Server startup in 3180 ms






最后解决的方法:


诡异。把引用的一些外部jar(struts2相关的5个: commons-logging, freemarker, ognl, struts2-core, xwork)从build path里面remove掉,把这几个jar文件从之前的工程无关的目录复制到工程的WEB-INF/lib里面,重新往build path里面添加这几个复制进来的jar,然后clean,build,start TOMCAT,这次居然不报错了……?

为了验证是不是jar文件没放在lib目录里导致,又到build path里把这几个包remove,添加了工程外目录的这几个jar,clean, build, restart tomcat, 居然还不报错!?

以前就偶尔碰到这种问题…… 都说eclipse好使,我感觉光是这一点就挺烦人的了。太匪夷所思了。到底怎么回事?



同样非议所思的还有,修改了东西之后无论怎么build,都无法把更改builld到work目录(或者classes)里,只能清空work让它崭新地build,才能好使。诸如此类的。基本都是build工程方面出的问题。前两天听说的那个maven不知道能根治这个不。


不知道别的开源IDE是否也有这种问题。有足够的时间肯定要试试NetBeans会不会这样。

你可能感兴趣的:(struts2)