使用maven运行jetty时发生异常

时间:2015-03-18 06:43:28

标签: java maven jetty

我正在尝试使用maven部署并运行我的应用程序到jetty。以下是我在pom.xml中的配置:

<plugin>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-maven-plugin</artifactId>
      <version>9.3.0.M2</version>
      <configuration>
         <war>${project.build.directory}/${project.build.finalName}.war</war>
       </configuration>
 </plugin>

但是当我运行mvn jetty:run-war时,我的控制台中出现以下异常:

    2015-03-18 14:04:46.708:WARN:oejs.BaseHolder:main:
java.lang.ClassNotFoundException: org.apache.cocoon.servlet.multipart.MultipartFilter
        at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
        at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:450)
        at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:403)
        at org.eclipse.jetty.util.Loader.loadClass(Loader.java:86)
        at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:95)
        at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:93)
2015-03-18 14:04:46.718:WARN:oejs.BaseHolder:main:
java.lang.ClassNotFoundException: org.apache.cocoon.servlet.DebugFilter
        at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
        at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:450)
        at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:403)
        at org.eclipse.jetty.util.Loader.loadClass(Loader.java:86)
        at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:95)

有谁知道这里发生了什么?

1 个答案:

答案 0 :(得分:0)

您必须将cocoon-core-<Version>.jar jar添加到类路径中。这个jar包含类路径中缺少的类org.apache.cocoon.servlet.DebugFilter

添加:

<dependency>
    <groupId>org.apache.cocoon</groupId>
    <artifactId>cocoon-core</artifactId>
    <version>2.2.0</version>
</dependency>

到您的pom文件