Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-3042

Maven jetty plugin is misconfigured

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 3.6, 4.0-ALPHA
    • None
    • None

    Description

      The maven jetty plugin is very popular and useful because it allows you to run a web application with a trivial command line execution "mvn jetty:run" and without setting up a servlet engine or deploying your app to it. Perhaps more importantly, it allows fast debug cycles in development. The plugin is misconfigured right now and I'm told its pedigree was a copy-paste from somewhere – it was never verified to work. Attached is a patch that configures it properly. There's not much to it.

      Attachments

        Activity

          sarowe Steven Rowe added a comment -

          I successfully ran mvn jetty:run with the patched version on trunk; I've committed it there.

          However, when I applied the patch to branch_3x, I get this error when I run mvn jetty:run:

          SEVERE: org.apache.solr.common.SolrException: Error loading class 'solr.VelocityResponseWriter'
                  at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:389)
                  at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:425)
                  at org.apache.solr.core.SolrCore.createInitInstance(SolrCore.java:447)
                  at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1559)
                  at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1553)
                  at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1586)
                  at org.apache.solr.core.SolrCore.initWriters(SolrCore.java:1469)
                  at org.apache.solr.core.SolrCore.<init>(SolrCore.java:556)
          

          Apparently trunk is not affected because the example solrconfig.xml says to load solr.VelocityResponseWriter lazily - branch_3x seems to also have lazy-startup-loading capabilities - I wonder why this wasn't backported?

          I was able to get things to work by setting the solr.velocity.enabled system property to false, but people shouldn't have to know that.

          When I add a dependency from the webapp module on the velocity contrib module, things just work. This means, though, that the velocity contrib will be included in the Maven-built war, unlike the Ant-built war, and I want to avoid differences like this.

          An alternative (works for me) is to add a <systemProperty> setting to the maven-jetty-plugin configuration in the webapp POM:

          <systemProperty>
            <name>solr.velocity.enabled</name>
            <value>false</value>
          </systemProperty>
          

          David, what do you think?

          sarowe Steven Rowe added a comment - I successfully ran mvn jetty:run with the patched version on trunk; I've committed it there. However, when I applied the patch to branch_3x, I get this error when I run mvn jetty:run : SEVERE: org.apache.solr.common.SolrException: Error loading class 'solr.VelocityResponseWriter' at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:389) at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:425) at org.apache.solr.core.SolrCore.createInitInstance(SolrCore.java:447) at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1559) at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1553) at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1586) at org.apache.solr.core.SolrCore.initWriters(SolrCore.java:1469) at org.apache.solr.core.SolrCore.<init>(SolrCore.java:556) Apparently trunk is not affected because the example solrconfig.xml says to load solr.VelocityResponseWriter lazily - branch_3x seems to also have lazy-startup-loading capabilities - I wonder why this wasn't backported? I was able to get things to work by setting the solr.velocity.enabled system property to false, but people shouldn't have to know that. When I add a dependency from the webapp module on the velocity contrib module, things just work. This means, though, that the velocity contrib will be included in the Maven-built war, unlike the Ant-built war, and I want to avoid differences like this. An alternative (works for me) is to add a <systemProperty> setting to the maven-jetty-plugin configuration in the webapp POM: <systemProperty> <name> solr.velocity.enabled </name> <value> false </value> </systemProperty> David, what do you think?
          sarowe Steven Rowe added a comment -

          Aha - the lazy-loading was added to trunk in SOLR-2718, and Erik Hatcher says on the issue that it should be backported to branch_3x, but nobody ever did that. (Mea culpa - I was the one who backported SOLR-2588 to branch_3x.) I'll look into backporting SOLR-2718 and see if that fixes the branch_3x mvn jetty:run problem.

          sarowe Steven Rowe added a comment - Aha - the lazy-loading was added to trunk in SOLR-2718 , and Erik Hatcher says on the issue that it should be backported to branch_3x, but nobody ever did that. (Mea culpa - I was the one who backported SOLR-2588 to branch_3x.) I'll look into backporting SOLR-2718 and see if that fixes the branch_3x mvn jetty:run problem.
          sarowe Steven Rowe added a comment -

          I'll look into backporting SOLR-2718 and see if that fixes the branch_3x mvn jetty:run problem.

          Done - this does fix the branch_3x mvn jetty:run problem; I'll commit the branch_3x backport shortly.

          sarowe Steven Rowe added a comment - I'll look into backporting SOLR-2718 and see if that fixes the branch_3x mvn jetty:run problem. Done - this does fix the branch_3x mvn jetty:run problem; I'll commit the branch_3x backport shortly.
          sarowe Steven Rowe added a comment -

          Committed to branch_3x.

          sarowe Steven Rowe added a comment - Committed to branch_3x.
          sarowe Steven Rowe added a comment -

          Thanks David!

          sarowe Steven Rowe added a comment - Thanks David!

          People

            sarowe Steven Rowe
            dsmiley David Smiley
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: