This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am getting a "noclassdef" error when I deploy my war file. This is odd to me for two reasons. First, I've been deploying this same war with no problems for several months now. However, I did accidentally close Tomcat today and the war has not been successfully deployed since I restarted Tomcat. The second reason this is odd is that I did a jar tf servlet-api.jar located in the Apache Tomcat lib directory and I see clearly that the class that can't be found is there in the lib directory. Can someone tell me how to resolve this please? Stack trace is below...
Joined: May 25, 2011
I think it's a setup issue based on my latest stack trace. I'm not sure how this is happening but perhaps this latest stack trace will sound familiar to someone who faced a similar issue in the past?
I commented out the <listener> flex.messaging.HttpFlexSession </listener> declaration in web.xml. Since that was the subject of the earlier stack trace, I tried to get the war to deploy without that listener declared. It didn't. During deploy, Tomcat threw a new noclassdef error. The class Tomcat can't find now is javax.servlet.http.HttpServlet.
I moved jars out of my jre/lib/ext directory and to TOMCAT_HOME/shared/lib and I also changed all Maven dependencies to "provided" so now my war file has only jar files I created in it. All to no avail. Any help solving this would be very appreciated.
Alvin Watkins wrote:I moved jars out of my jre/lib/ext directory and to TOMCAT_HOME/shared/lib
What are you doing mucking around in Tomcat's lib folder? And what did you copy to ext?
My recommendation: don't ever, ever touch anything in the lib foder, including not copying them anywhere else.
If I were you, I'd make sure that the lib folder is restored to its default conditions, and any jars that you may have copied out of it to elsewhere in the system are removed. Sounds like you have quite a mess on your hands.
You can judiciously add jars to the lib folder (such as a DB driver for container-managed pooling). But never copy or remove anything from it!
I didn't change or move anything in the Tomcat_Home/lib dir. I created a Tomcat_Home/shared/lib dir based on the instructions at Apache (and then deleted it when it didn't help). I also added a common/lib dir and tried with all jar files located there which is where they reside now and will reside until I get the rest of my issues figured out. In Tomcat 7.0, it's Tomcat/lib you don't want to mess with and can create and add to the other locations as long as you don't create collisions (at least that's what the Apache Tomcat class loading documentation says). Those file locations will allow you to share resources across all webapp's.
I added JDBC drivers to ext and the Java sound packages there.
The lib folder is in its original state. It has never changed.
I did manage to get my war to load and was able to connect to a servlet that I wrote and prints your IP to the browser. I got that far by taking out all Flex (BlazeDS) declarations in the web-xml so it's clearly a BlazeDS conflict I need to chase down.
Unfortunately, during all of this, I lost my server and can't connect to it via RDC so I'm forced to stop dealing with this issue until I get a new server up. I'm betting that, with a new server coming on line, whatever the conflict is will be eliminated due to a fresh install of everything from the ground up...