tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: [SOLVED] Sudden missing javax/servlet/http/HttpServlet ?
Date Thu, 07 Aug 2008 21:38:11 GMT
Hash: SHA1


Thanks for your patience with my stupidity. I try not to do it publicly
very often ;)

I found the culprit: multiple instances of a class were defined in my
webapp. You'll never guess why.

A clean checkout from cvs revealed that my webapp was just fine (which I
sort of knew already). So, I started copying uncommitted files from the
broken staging directory into the working one. At the same time, I was
removing old cruft that had accumulated in the now broken directory.

At one point, I deleted the "META-INF" and "org" directories that had
been created in my project's base directory when I apparently expanded
velocity-tools-1.4.jar inadvertently.

I lathered, rinsed, and repeated my tomcat-stop, install-clean, install,
tomcat-start process and then the broken directory was working again. I
confirmed by re-expanding the JAR file into my project's base directory.

The odd thing is that all the source files for my project are in the
'src' directory and all the libs are under 'lib', and so the WAR file
used for deployment is nearly identical, and none of the changes affect
the deployment.

I thought that I had a bad /build/ coming from the broken directory, and
that the build coming from the good/working directory was a "good"
build. Not so. Building from either directory works when actually
/deploying and running Tomcat/ from the good directory, while the
opposite is true for the broken directory.

The only conclusion that I can come to is that since does
not change the working directory, my project directory is the "current
working directory" during TC execution. I believe that the default
CLASSPATH for Java includes the cwd, even when CLASSPATH is actually "".
Thus, running Tomcat from my project directory which contained a stray
copy of velocity-tools-1.4.jar (expanded) caused multiple copies of the
classes therein to be available to my webapp, and the JVM freaked out

I'm not entirely sure why the webapp-defined JAR didn't override the
classes found in the bootstrap classpath given how webapp ClassLoaders
are supposed to work, but this is the only explanation I can come up with.

At any rate, my application works and it was neither my code nor my
configuration that caused it. <sigh>

- -chris

Christopher Schultz wrote:
| All,
| I've checked everything I can think of. Today, my dev instance of Tomcat
| started acting funny, saying:
| java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
| ~        at java.lang.ClassLoader.defineClass1(Native Method)
| ~        at java.lang.ClassLoader.defineClass(
| ~        at
| (ultimately coming from)
| ~        at
| ~        at org.apache.catalina.startup.Bootstrap.main(
| I've checked the obvious things:
| 1. Only one copy of servlet-api.jar anywhere (it's in
| TOMCAT_HOME/common/lib and has md5 hash of
| 043724d8aadd4e5c50417dfcef52934b)
| 2. All configuration files appear to be sane (using copies available in
| our cvs repo and verified working by a colleague)
| 3. No CLASSPATH set anywhere (and adding an echo in confirms
| this)
| I've rebooted, just in case my system went braindead (it's Linux: it
| hadn't, and the error persists).
| I've re-installed Tomcat (5.5.26, since you asked), but the installation
| directory had no differences after the install than before the install
| except for the presence of mysql-connector-whatever.jar.
| I deleted my own webapp from the deployment directory and dropped
| LambdaProbe's probe.war into my webapps directory, just to check, and
| that application seems to deploy with no complaints.
| Here is the list of files in my webapp's WEB-INF/lib directory:
| antlr-2.7.3-runtime.jar      expreval-1.0a.jar
| chadis-tools-1.1.jar         jakarta-oro-2.0.8.jar
| commons-beanutils-1.7.0.jar  jmock-1.0.1.jar
| commons-chain-1.1.jar        junit-3.8.1.jar
| commons-collections-3.2.jar  log4j-1.2.15.jar
| commons-digester-1.8.jar     ppg.jar
| commons-lang-2.2.jar         securityfilter-2.0+.jar
| commons-logging-1.1.1.jar    struts-core-1.3.8.jar
| commons-validator-1.3.1.jar  struts-taglib-1.3.8.jar
| dxengine-1.0b.jar            velocity-1.4.jar
| engine-1.0a.jar              velocity-tools-1.4.jar
| Those you might not recognize are in-house libraries. But, you can see,
| there's no servlet-api.jar or anything like that.
| The server.xml file I'm using works file with LambdaProbe, so there is
| not likely to be an error in there.
| I'm totally confused. This install has been working literally for years,
| and today it decided to crap out.
| Does anyone have any suggestions for what to check? It's obviously my
| own application, but I can't see anything that might be problematic.
| Thanks,
| -chris

- ---------------------------------------------------------------------
To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla -


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message