Jetty
  1. Jetty
  2. JETTY-307

java.lang.ClassCastException while executing mvn jetty:run

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
    • Number of attachments :
      1

      Description

      java.lang.ClassCastException while executing mvn jetty:run when jetty dependency is present.

      Been creating a webapp project using:
      mvn archetype:create -DgroupId=foo.bar -DartifactId=foo-bar -DarchetypeArtifactId=maven-archetype-webapp

      Adding the jetty-plugin as described in:
      http://www.mortbay.org/maven-plugin/howto.html
      works fine.
      Using mvn jetty:run starts the server, the application can be seen with a browser.

      After adding
      <dependencies>
      ...
      <dependency>
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>jetty</artifactId>
      <version>6.1.1</version>
      </dependency>
      </dependencies>
      to the pom.xml, mvn jetty:run crashes with a ClassCastException.

      Attached is the pom.xml I used.

      Martin

        Activity

        Hide
        Jan Bartel added a comment -

        Martin,

        You don't need to add jetty as the dependency to use the plugin - what's your usecase that makes you think you need to depend on jetty?

        Jan

        Show
        Jan Bartel added a comment - Martin, You don't need to add jetty as the dependency to use the plugin - what's your usecase that makes you think you need to depend on jetty? Jan
        Hide
        MartinFunk added a comment -

        Hi Jan,

        it was always clear, that the dependency is not needed for starting the plugin. Problems arise when there are dependencies to jetty in the code. The aim was to keep the example as simple as possible.

        Some projects like wicket http://incubator.apache.org/wicket/ provide an in code entrypoint for starting their examples, like:
        http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/StartExamples.java?view=markup

        In that situation the maven-jetty-plugin can't be used for starting the examples.

        Martin

        Show
        MartinFunk added a comment - Hi Jan, it was always clear, that the dependency is not needed for starting the plugin. Problems arise when there are dependencies to jetty in the code. The aim was to keep the example as simple as possible. Some projects like wicket http://incubator.apache.org/wicket/ provide an in code entrypoint for starting their examples, like: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/StartExamples.java?view=markup In that situation the maven-jetty-plugin can't be used for starting the examples. Martin
        Hide
        Jan Bartel added a comment -

        Hi Martin,

        If you want to use the wicket examples with the jetty plugin, then you can do either:
        1. use the same version of the plugin as the examples depend on (6.0.1)
        or
        2. try using mvn jetty:run-war to run on the built war and there won't be any conflict.

        I've tested 1. myself and it works. It's not too desirable, but unfortunately there is nothing that I can see to do about it in this case. If you come up with a good idea, then please reopen.

        regards
        Jan

        Show
        Jan Bartel added a comment - Hi Martin, If you want to use the wicket examples with the jetty plugin, then you can do either: 1. use the same version of the plugin as the examples depend on (6.0.1) or 2. try using mvn jetty:run-war to run on the built war and there won't be any conflict. I've tested 1. myself and it works. It's not too desirable, but unfortunately there is nothing that I can see to do about it in this case. If you come up with a good idea, then please reopen. regards Jan

          People

          • Assignee:
            Jan Bartel
            Reporter:
            MartinFunk
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: