Eclipse + tomcat - ClassNotFound exception on deploy
If you have installed both the Maven Eclipse Plugin and the Maven WTP Plugin this is automatic. If you don't have these installed, go ahead and install them and then once Eclipse restarts right-click on the project and do a Maven > Update project.... This will internally change the project configuration so the Maven dependencies are copied to the /WEB-INF/lib
folder on your deployment target.
If you don't want to use any of these plug-ins, then you have to go to the Project properties > Deployment Assembly configuration and add your dependencies manually, but again, this is done automatically by these plug-ins.
Ido Barash
Backend and data architect at Cooladata ltd. http://www.cooladata.com/ Here at cooladata we handle lots of events to gather and aggregate information.
Updated on June 05, 2022Comments
-
Ido Barash almost 2 years
I am facing a weird problem with eclipse.
I have a multi-module maven project with CXF, hibernate and spring. If I take the war produced after maven package, and deploy it manually on tomcat 7 - everything works fine. But if I am trying to work with eclipse (Servers -> tomcat) I get the following error:
SEVERE: Exception starting filter datasourceFilter java.lang.ClassNotFoundException: com.X.X.X.X.filter.DataSourceFilter at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:133) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:256) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)
It is worth mentioning that the tomcat which I am trying to integrate with eclipse is the same stand alone tomcat, I deployed the war on manualy. I use eclipse Juno.. if it matters..
on my web.xml:
<filter> <filter-name>datasourceFilter</filter-name> <filter-class>com.X.X.X.X.filter.DataSourceFilter</filter-class> </filter> <filter-mapping> <filter-name>datasourceFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
Can anyone help me?
Idob
-
Ido Barash over 11 yearsOh, what a stupid mistake. I was sure that I installed the m2e wtp plug-in. Oops... Thanks
-
crowmagnumb about 9 yearsAfter adding Spring to my eclipse web project I am now experiencing this exact same problem and can now no longer run tomcat in eclipse to make use of the debugging and fast re-deploy capabilities. Can't figure out how to solve it. The above steps have no effect. Any other ideas out there? -- Cheers.