java.lang.ClassNotFoundException:org.mortbay.jetty.plus.naming.Resource

时间:2014-05-12 00:50:25

标签: java jetty zk maven-jetty-plugin

我在使用jetty时遇到此错误:在ZK Web项目上运行插件,我使用的是zk原型版本7.0.0。

[ERROR] failed org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@a925d{/InTouchF,G:\workspace\InTouchF\src\main\webapp}
java.lang.NoClassDefFoundError
    at org.mortbay.jetty.plus.webapp.EnvConfiguration.class$(EnvConfiguration.java:163)

这是我的码头配置:

<plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.1.10</version>
                <configuration>
                    <scanIntervalSeconds>5</scanIntervalSeconds>
                    <stopKey>foo</stopKey>
                    <stopPort>9999</stopPort>
                </configuration>
                <executions>
                    <execution>
                        <id>start-jetty</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <scanIntervalSeconds>0</scanIntervalSeconds>
                            <daemon>true</daemon>
                        </configuration>
                    </execution>
                    <execution>
                        <id>stop-jetty</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

2 个答案:

答案 0 :(得分:4)

尝试将此添加到您的依赖项:

<dependency>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-plus</artifactId>
    <version>6.1.10</version>
</dependency>

答案 1 :(得分:1)

我使用7.0.0pre2jetty-maven-plugin版本jsp-2.1解决了问题,如下所示:

<properties>
        <jetty.version>7.0.0pre2</jetty.version>
</properties>


<dependencies>
    <dependency>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jsp-2.1</artifactId>
        <version>${jetty.version}</version>
    </dependency>     
</dependencies>

<build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <version>${jetty.version}</version>
        ........