Problem with jetty-maven-plugin

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problem with jetty-maven-plugin

Jacob Bergöö
Hi,
I have defined the jetty-maven-plugin in my pom.xml that is using the 7.0.0.pre5 version. I read a post that that version is a dead end and that that is actually runnig jetty 6. My configuration of 7.0.0.pre5 is working, but I want to change it to work with the latest jetty-maven-plugin and not being stuck with a dead end version of jetty-plugin. My old configuration that is working looks like this:

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>7.0.0.pre5</version>
    <configuration>
        <contextPath>/</contextPath>
        <scanIntervalSeconds>0</scanIntervalSeconds>
        <classesDirectory>${basedir}/target/${build.finalName}/WEB-INF/classes</classesDirectory>
        <webAppConfig>
                <defaultsDescriptor>src/main/config/webdefault.xml</defaultsDescriptor>
                <baseResource implementation="org.mortbay.resource.ResourceCollection">
                        <resourcesAsCSV>${basedir}/src/main/webapp,target/${build.finalName}</resourcesAsCSV>
                </baseResource>
        </webAppConfig>
        <connectors>
                <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                           <port>7001</port>
                           <maxIdleTime>60000</maxIdleTime>
                </connector>
        </connectors>
    </configuration>
</plugin>


And I have tried to search a lot on google and on mailing lists and I havn't found any good reference on how to change the configuration to work with the new plugin.

I changed my pom.xml to this:

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <configuration>
        <scanIntervalSeconds>0</scanIntervalSeconds>
        <classesDirectory>${basedir}/target/${build.finalName}/WEB-INF/classes</classesDirectory>
        <webAppConfig>
                <contextPath>/</contextPath>
                <defaultsDescriptor>src/main/config/webdefault.xml</defaultsDescriptor>
                <baseResource implementation="org.mortbay.resource.ResourceCollection">
                        <resourcesAsCSV>${basedir}/src/main/webapp,target/${build.finalName}</resourcesAsCSV>
                </baseResource>
        </webAppConfig>
        <connectors>
                <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                           <port>7001</port>
                           <maxIdleTime>60000</maxIdleTime>
                </connector>
        </connectors>
    </configuration>
</plugin>


But when I try to run my application I get:

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to configure plugin parameters for: org.mortbay.jetty:jetty-maven-plugin:7.0.1.v20091125



Cause: Class name which was explicitly given in configuration using 'implementation' attribute: 'org.mortbay.jetty.nio.SelectChannelConnector' cannot be loaded
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error configuring: org.mortbay.jetty:jetty-maven-plugin. Reason: Unable to parse the created DOM for plugin config
uration
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:568)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.PluginConfigurationException: Error configuring: org.mortbay.jetty:jetty-maven-plugin. Reason: Unable to parse the created DOM for plug
in configuration
        at org.apache.maven.plugin.DefaultPluginManager.populatePluginFields(DefaultPluginManager.java:1157)
        at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:618)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:425)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
        ... 16 more
Caused by: org.codehaus.plexus.component.configurator.ComponentConfigurationException: Class name which was explicitly given in configuration using 'implementation' attri
bute: 'org.mortbay.jetty.nio.SelectChannelConnector' cannot be loaded
        at org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter.getClassForImplementationHint(AbstractConfigurationConverter.java:71)
        at org.codehaus.plexus.component.configurator.converters.composite.ArrayConverter.fromConfiguration(ArrayConverter.java:78)
        at org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.configure(ComponentValueSetter.java:247)
        at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:137)
        at org.codehaus.plexus.component.configurator.BasicComponentConfigurator.configureComponent(BasicComponentConfigurator.java:56)
        at org.apache.maven.plugin.DefaultPluginManager.populatePluginFields(DefaultPluginManager.java:1151)
        ... 19 more
Caused by: java.lang.ClassNotFoundException: org.mortbay.jetty.nio.SelectChannelConnector
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
        at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
        at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
        at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter.getClassForImplementationHint(AbstractConfigurationConverter.java:62)
        ... 24 more


I hope that anyone can give me some pointers or code example on how to configure this so it works.
Thanks in advance,
Jacob