title: NoClassDefFoundError when running Tomcat + Spring + Maven project (Eclipse)
body: <p>What I get is:</p>
  
  <pre><code>java.lang.NoClassDefFoundError: com/mongodb/DB
  at java.lang.Class.getDeclaredMethods0(Native Method)
  at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
  at java.lang.Class.getDeclaredMethods(Class.java:1791)
  at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:446)
  at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:430)
  at org.springframework.util.ReflectionUtils.getAllDeclaredMethods(ReflectionUtils.java:475)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:634)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:573)
  at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1319)
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:315)
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:394)
  at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:594)
  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:407)
  at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442)
  at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458)
  at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339)
  at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306)
  at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
  at javax.servlet.GenericServlet.init(GenericServlet.java:212)
  at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
  at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
  at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4420)
  at org.apache.catalina.core.StandardContext.start(StandardContext.java:4733)
  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
  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)
  </code></pre>
  
  <p>This class is inside maven jar (from M2 repository). I added Maven Dependencies to DeploymentAssembly (before I did it i got: java.lang.ClassNotFoundException: org.springframework.web.filter.CharacterEncodingFilter). I use m2e plugin and have my project configured as Maven project. My app is deployed to standard location /.metadata/.plugins/.../tmp0. Inside of WEB-INF/lib I have all necessary jars. Project compiles with no error. What could I do wrong?</p>
  
  <p>One quasi-solution is to add necessary libraries to Tomcat lib directory but I don't want to do that. I want to force Tomcat to use project libraries.</p>