Eclipse + tomcat - 部署时的ClassNotFound异常 [英] Eclipse + tomcat - ClassNotFound exception on deploy

查看:247
本文介绍了Eclipse + tomcat - 部署时的ClassNotFound异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正面临着日食的一个奇怪问题。

I am facing a weird problem with eclipse.

我有一个带有CXF,hibernate和spring的多模块maven项目。如果我接受maven包之后产生的战争,并在tomcat 7上手动部署它 - 一切正常。但如果我正在尝试使用eclipse(Servers - > tomcat),我会收到以下错误:

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)

值得一提的是我的tomcat我试图与eclipse整合是同一个独立的tomcat,我在manualy上部署了战争。
我使用eclipse Juno ..如果重要..

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..

在我的web.xml上:

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

推荐答案

如果您同时安装了 Maven Eclipse插件 Maven WTP插件这是自动的。如果您没有安装这些,请继续安装它们,然后在Eclipse重新启动后右键单击项目并执行 Maven>更新项目... 。这将在内部更改项目配置,以便将Maven依赖项复制到部署目标上的 / WEB-INF / lib 文件夹。

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.

这篇关于Eclipse + tomcat - 部署时的ClassNotFound异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆