Um... NoClassDefFoundError sounds like, well, an unavailable class definition. In this case, most likely the jar file containing org/apache/cayenne/query/Query.class .
This sounds like you need to read up on the workflow for installing web applications in Tomcat. In particular, how to make sure that all required jar files are available. And maybe review the list of jar files required for Cayenne. That should be easy to find in the Cayenne docs.
