Search code examples
javajettyzkmaven-jetty-plugin

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


i get this error while using jetty:run plugin on a ZK web project , i am using a zk archetype version 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)

this is my jetty configuration :

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

Solution

  • i resolved the problem by using the version 7.0.0pre2 of jetty-maven-plugin and jsp-2.1 as follow :

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