找不到类Exception - Maven Eclipse

时间:2016-12-07 05:32:03

标签: java eclipse maven

我用Maven创建了dyamic web项目。 我在我的pom.xml中使用了这个(https://github.com/Codearte/jfairy)假数据生成器插件作为maven,如下所示:

<dependency>
    <groupId>io.codearte.jfairy</groupId>
    <artifactId>jfairy</artifactId>
    <version>0.5.3</version>
</dependency>

但我得到的错误如下:

java.lang.NoClassDefFoundError: io/codearte/jfairy/Fairy
at dao.Users.InsertUser(Users.java:20)
at model.UserManager.InsertUsers(UserManager.java:19)
at contoller.InsertUsers.doPost(InsertUsers.java:38)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

所以建议我。

1 个答案:

答案 0 :(得分:0)

Eclipse maven集成效果不佳。您可以转到项目目录并运行此命令:

mvn eclipse:clean
mvn eclipse:eclipse
mvn install

换句话说,每次更改pom.xml时,最好使用

mvn eclipse:eclipse 
壳牌中的