"Error java.lang.NoSuchFieldError: IS_DIR" while starting Apache Tomcat from Eclipse
While trying to start Apache Tomcat from eclipse, I encounter the following error:
18 Nov, 2010 5:2开发者_如何学运维3:03 PM org.apache.catalina.startup.Bootstrap initClassLoaders
SEVERE: Class loader creation threw exception
java.lang.NoSuchFieldError: IS_DIR
at org.apache.catalina.startup.Bootstrap.createClassLoader(Bootstrap.java:166)
at org.apache.catalina.startup.Bootstrap.initClassLoaders(Bootstrap.java:91)
at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:206)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:390)
I use tomcat 6.0.18, and also tried with 6.0.29. I just enter the tomcat path in the Window > Preferences > Tomcat. Eclipse is version 3.5.
What seems to be the problem?
You seem to have outdated versions of the Tomcat core libraries in the runtime classpath which got precedence in classloading. Cleanup your runtime classpath to get rid of Tomcat specific libraries where they don't belong. This covers among others /WEB-INF/lib
, JRE/lib
, JRE/lib/ext
. Tomcat specific libraries should be kept in its own Tomcat/lib
folder and never be copied/moved around.
Tomcat 4.0 for example does indeed not have this field, but Tomcat 6.0 do.
精彩评论