Jetty
  1. Jetty
  2. JETTY-680

Can't configure the ResourceCollection with maven

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.1.12rc1
    • Fix Version/s: 7.0.0pre4, 6.1.12.rc2
    • Component/s: Maven
    • Labels:
      None
    • Environment:
      Maven 2.0.9, JDK 1.6, Mac OS 10.5.4
    • Number of attachments :
      0

      Description

      I tried following the instructions <a href="http://docs.codehaus.org/display/JETTY/Multiple+WebApp+Source+Directory">Multiple WebApp Source Directory</a>, but maven is giving an error when trying to configure the ResourceCollection. It looks like maven is having problems with the overloaded setters. It is is trying to use ResourceCollection.setResources(Resource[]) instead of ResourceColection.setResources(String).

      $mvn jetty:run
      ...
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Failed to configure plugin parameters for: org.mortbay.jetty:maven-jetty-plugin:6.1.12rc1

      (found static expression: 'src/main/webapp,target/mlsdb' which may act as a default value).

      Cause: Cannot assign configuration entry 'resources' to 'class [Lorg.mortbay.resource.Resource;' from 'src/main/webapp,target/mlsdb', which is of type class java.lang.String

      pom.xml:
      ...
      <plugin>
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>maven-jetty-plugin</artifactId>
      <configuration>
      <webAppConfig>
      <contextPath>/</contextPath>
      <baseResource implementation="org.mortbay.resource.ResourceCollection">
      <resources>src/main/webapp,target/mlsdb</resources>
      </baseResource>
      </webAppConfig>
      </configuration>
      </plugin>

      $ mvn -v
      Using Java version: 1.6
      Maven version: 2.0.9
      Java version: 1.6.0_05
      OS name: "mac os x" version: "10.5.4" arch: "x86_64" Family: "mac"

        Activity

        Hide
        David Yu added a comment -

        John,

        Mmm, I could not replicate. Could you try using the semi-colon as the separator (instead of comma) and see if the error goes away?
        Btw, there's a bug with using ResourceCollection on static resources (JETTY-683) on 6.1.12rc1. Its fixed for 6.1.12( now available in 6.1 branch)

        Thanks,
        dyu

        Show
        David Yu added a comment - John, Mmm, I could not replicate. Could you try using the semi-colon as the separator (instead of comma) and see if the error goes away? Btw, there's a bug with using ResourceCollection on static resources ( JETTY-683 ) on 6.1.12rc1. Its fixed for 6.1.12( now available in 6.1 branch) Thanks, dyu
        Hide
        John Hampton added a comment -

        David,

        Semicolons don't make a difference. But some more information for you. The configuration works fine under jdk 1.5. I get the problem only when running under 1.6. The version I'm using is:

        java version "1.6.0_05"
        Java(TM) SE Runtime Environment (build 1.6.0_05-b13-120)
        Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_05-b13-52, mixed mode)

        I really think that maven is getting confused by the overridden setters.

        Here is more output from mvn -X jetty:run

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

        (found static expression: '/Users/john/Projects/mlsdb/target/mlsdb,/Users/john/Projects/mlsdb/src/main/webapp' which may act as a default value).

        Cause: Cannot assign configuration entry 'resources' to 'class [Lorg.mortbay.resource.Resource;' from '/Users/john/Projects/mlsdb/target/mlsdb,/Users/john/Projects/mlsdb/src/main/webapp', which is of type class java.lang.String
        [INFO] ------------------------------------------------------------------------
        [DEBUG] Trace
        org.apache.maven.lifecycle.LifecycleExecutionException: Error configuring: org.mortbay.jetty:maven-jetty-plugin. Reason: Unable to parse the created DOM for plugin configuration
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:587)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:512)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:482)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
        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:maven-jetty-plugin. Reason: Unable to parse the created DOM for plugin configuration
        at org.apache.maven.plugin.DefaultPluginManager.populatePluginFields(DefaultPluginManager.java:1288)
        at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:661)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:429)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
        ... 16 more
        Caused by: org.codehaus.plexus.component.configurator.ComponentConfigurationException: Cannot assign configuration entry 'resources' to 'class [Lorg.mortbay.resource.Resource;' from '/Users/john/Projects/mlsdb/target/mlsdb,/Users/john/Projects/mlsdb/src/main/webapp', which is of type class java.lang.String
        at org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter.fromExpression(AbstractConfigurationConverter.java:149)
        at org.codehaus.plexus.component.configurator.converters.composite.ArrayConverter.fromConfiguration(ArrayConverter.java:62)
        at org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.configure(ComponentValueSetter.java:207)
        at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:137)
        at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.fromConfiguration(ObjectWithFieldsConverter.java:90)
        at org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.configure(ComponentValueSetter.java:207)
        at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:137)
        at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.fromConfiguration(ObjectWithFieldsConverter.java:90)
        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:1282)
        ... 19 more

        Show
        John Hampton added a comment - David, Semicolons don't make a difference. But some more information for you. The configuration works fine under jdk 1.5. I get the problem only when running under 1.6. The version I'm using is: java version "1.6.0_05" Java(TM) SE Runtime Environment (build 1.6.0_05-b13-120) Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_05-b13-52, mixed mode) I really think that maven is getting confused by the overridden setters. Here is more output from mvn -X jetty:run [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Failed to configure plugin parameters for: org.mortbay.jetty:maven-jetty-plugin:6.1.12rc1 (found static expression: '/Users/john/Projects/mlsdb/target/mlsdb,/Users/john/Projects/mlsdb/src/main/webapp' which may act as a default value). Cause: Cannot assign configuration entry 'resources' to 'class [Lorg.mortbay.resource.Resource;' from '/Users/john/Projects/mlsdb/target/mlsdb,/Users/john/Projects/mlsdb/src/main/webapp', which is of type class java.lang.String [INFO] ------------------------------------------------------------------------ [DEBUG] Trace org.apache.maven.lifecycle.LifecycleExecutionException: Error configuring: org.mortbay.jetty:maven-jetty-plugin. Reason: Unable to parse the created DOM for plugin configuration at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:587) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:512) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:482) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129) at org.apache.maven.cli.MavenCli.main(MavenCli.java:287) 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:maven-jetty-plugin. Reason: Unable to parse the created DOM for plugin configuration at org.apache.maven.plugin.DefaultPluginManager.populatePluginFields(DefaultPluginManager.java:1288) at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:661) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:429) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558) ... 16 more Caused by: org.codehaus.plexus.component.configurator.ComponentConfigurationException: Cannot assign configuration entry 'resources' to 'class [Lorg.mortbay.resource.Resource;' from '/Users/john/Projects/mlsdb/target/mlsdb,/Users/john/Projects/mlsdb/src/main/webapp', which is of type class java.lang.String at org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter.fromExpression(AbstractConfigurationConverter.java:149) at org.codehaus.plexus.component.configurator.converters.composite.ArrayConverter.fromConfiguration(ArrayConverter.java:62) at org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.configure(ComponentValueSetter.java:207) at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:137) at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.fromConfiguration(ObjectWithFieldsConverter.java:90) at org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.configure(ComponentValueSetter.java:207) at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:137) at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.fromConfiguration(ObjectWithFieldsConverter.java:90) 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:1282) ... 19 more
        Hide
        David Yu added a comment -

        John,

        Tried it on java 1.6_06 on windows. Got no errors.
        It looks like its spefically a java 1.6-on-mac issue.
        And more likely a maven2 issue.
        I'll see if I can find a workaround

        Cheers

        Show
        David Yu added a comment - John, Tried it on java 1.6_06 on windows. Got no errors. It looks like its spefically a java 1.6-on-mac issue. And more likely a maven2 issue. I'll see if I can find a workaround Cheers
        Hide
        Kimmo Björnsson added a comment -

        Got the same error on

        maven2.0.9
        Windows
        jdk1.6.0_07

        So probably not a mac-issue.

        Show
        Kimmo Björnsson added a comment - Got the same error on maven2.0.9 Windows jdk1.6.0_07 So probably not a mac-issue.
        Hide
        Kimmo Björnsson added a comment -

        Tried with

        jdk1.5.0_16
        maven2.0.9
        Windows

        Same error.. Just to be sure 1.5 didnt solve it.

        Show
        Kimmo Björnsson added a comment - Tried with jdk1.5.0_16 maven2.0.9 Windows Same error.. Just to be sure 1.5 didnt solve it.
        Hide
        Kimmo Björnsson added a comment -

        Sorry for making multiple comments and not one.

        Just wanted to inform its the same error using 7.0.0pre3.

        Show
        Kimmo Björnsson added a comment - Sorry for making multiple comments and not one. Just wanted to inform its the same error using 7.0.0pre3.
        Hide
        David Yu added a comment -

        Thats interesting... It works for me on java 1.6.06 on windows xp.

        java version "1.6.0_06"
        Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
        Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)

        Show
        David Yu added a comment - Thats interesting... It works for me on java 1.6.06 on windows xp. java version "1.6.0_06" Java(TM) SE Runtime Environment (build 1.6.0_06-b02) Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)
        Hide
        David Yu added a comment -

        To avoid the maven overloading bug, use resourcesAsCSV instead.

        <baseResource implementation="org.mortbay.resource.ResourceCollection">
        <resourcesAsCSV>src/main/webapp,target/mlsdb</resourcesAsCSV>
        </baseResource>

        Cheers

        Show
        David Yu added a comment - To avoid the maven overloading bug, use resourcesAsCSV instead. <baseResource implementation="org.mortbay.resource.ResourceCollection"> <resourcesAsCSV>src/main/webapp,target/mlsdb</resourcesAsCSV> </baseResource> Cheers
        Hide
        Andrew Robinson added a comment -

        I can confirm this bug on Linux. Version info:

        mvn -v
        Maven version: 2.0.8
        Java version: 1.6.0_07
        OS name: "linux" version: "2.6.24-21-generic" arch: "i386" Family: "unix"

        Using resourcesAsCSV did work.

        This was using 6.1.12.rc2

        Show
        Andrew Robinson added a comment - I can confirm this bug on Linux. Version info: mvn -v Maven version: 2.0.8 Java version: 1.6.0_07 OS name: "linux" version: "2.6.24-21-generic" arch: "i386" Family: "unix" Using resourcesAsCSV did work. This was using 6.1.12.rc2
        Hide
        Gunther Verhemeldonck added a comment - - edited

        I had the same issues and was able to get it working, using 6.1.12.rc3 on Maven 2.2.1. However, if you specify a contextPath other than /, it will not work.

        If I enter a contextPath value as eg. "/test" and goto http://localhost:9081/, I can see that my additional source path is being recognized by Jetty, but somehow these resources are not servable.

        Working configuration:
        ----------------------

        <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
        <version>6.1.12.rc3</version>
        <configuration>
        <scanIntervalSeconds>10</scanIntervalSeconds>
        <webDefaultXml>src/dev/jetty/pb_webdefault.xml</webDefaultXml>
        <connectors>
        <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
        <port>9081</port>
        <maxIdleTime>60000</maxIdleTime>
        </connector>
        </connectors>

        <!-- For Dojo integration -->
        <webAppConfig>
        <contextPath>/</contextPath>
        <baseResource implementation="org.mortbay.resource.ResourceCollection">
        <resourcesAsCSV>src/main/webapp,..\pb-dojo\dist\release</resourcesAsCSV>
        </baseResource>
        </webAppConfig>
        <!-- End Dojo integration -->

        <jettyEnvXml>$

        {basedir}

        /src/dev/jetty/jetty-env.xml</jettyEnvXml>
        </configuration>
        <dependencies>
        ...
        </dependencies>
        </plugin

        Show
        Gunther Verhemeldonck added a comment - - edited I had the same issues and was able to get it working, using 6.1.12.rc3 on Maven 2.2.1. However, if you specify a contextPath other than /, it will not work. If I enter a contextPath value as eg. "/test" and goto http://localhost:9081/ , I can see that my additional source path is being recognized by Jetty, but somehow these resources are not servable. Working configuration: ---------------------- <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.1.12.rc3</version> <configuration> <scanIntervalSeconds>10</scanIntervalSeconds> <webDefaultXml>src/dev/jetty/pb_webdefault.xml</webDefaultXml> <connectors> <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> <port>9081</port> <maxIdleTime>60000</maxIdleTime> </connector> </connectors> <!-- For Dojo integration --> <webAppConfig> <contextPath>/</contextPath> <baseResource implementation="org.mortbay.resource.ResourceCollection"> <resourcesAsCSV>src/main/webapp,..\pb-dojo\dist\release</resourcesAsCSV> </baseResource> </webAppConfig> <!-- End Dojo integration --> <jettyEnvXml>$ {basedir} /src/dev/jetty/jetty-env.xml</jettyEnvXml> </configuration> <dependencies> ... </dependencies> </plugin
        Hide
        Samuel Robert added a comment -

        Using the Jetty maven plugin 6.1.26 with JDK1.7, I can still reproduce the bug in this environment:

        Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
        Java version: 1.7.0_21
        Java home: C:\Program Files\Java\jdk1.7.0_21\jre
        Default locale: de_DE, platform encoding: Cp1252
        OS name: "windows 7" version: "6.1" arch: "x86" Family: "windows"

        [INFO] Failed to configure plugin parameters for: org.mortbay.jetty:maven-jetty-plugin:6.1.26
        (found static expression: 'src/main/webapp , C:\dev\workspaces\xxxx' which may act as a default value).
        Cause: Cannot assign configuration entry 'resources' to 'class [Lorg.mortbay.resource.Resource;' from 'src/main/webapp , C:\dev\workspaces\xxxx', which is of type class java.lang.String

        But when I

        • use "resourcesAsCSV" instead of "resources"
        • OR switch back to a JDK 1.6 (1.6.0_25)
          then I do not get the error anymore.
          So the workaround of "resourcesAsCSV" is enough for me.
        Show
        Samuel Robert added a comment - Using the Jetty maven plugin 6.1.26 with JDK1.7, I can still reproduce the bug in this environment: Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200) Java version: 1.7.0_21 Java home: C:\Program Files\Java\jdk1.7.0_21\jre Default locale: de_DE, platform encoding: Cp1252 OS name: "windows 7" version: "6.1" arch: "x86" Family: "windows" [INFO] Failed to configure plugin parameters for: org.mortbay.jetty:maven-jetty-plugin:6.1.26 (found static expression: 'src/main/webapp , C:\dev\workspaces\xxxx' which may act as a default value). Cause: Cannot assign configuration entry 'resources' to 'class [Lorg.mortbay.resource.Resource;' from 'src/main/webapp , C:\dev\workspaces\xxxx', which is of type class java.lang.String But when I use "resourcesAsCSV" instead of "resources" OR switch back to a JDK 1.6 (1.6.0_25) then I do not get the error anymore. So the workaround of "resourcesAsCSV" is enough for me.

          People

          • Assignee:
            David Yu
            Reporter:
            John Hampton
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: