Jetty runs correctly via maven, but incorrectly as a jar

后端 未结 2 808
南旧
南旧 2021-01-16 02:17

(If my title is misleading/incorrect please suggest something more descriptive, that the best I could think of)

I\'ve created my own web app using spring roo and hav

相关标签:
2条回答
  • 2021-01-16 02:39

    Having looked at your pom.xml it is clear that you are running different versions of Jetty. That may or may not be the root cause of your issue, but as the different versions implement different versions of the Servlet Container specification you may find that something which is a Servlet 3.0 feature works with Jetty 8 and doesn't work with Jetty 7 (which is Servlet 2.5 IIRC)

    If you look at your plugin configuration:

            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>8.1.4.v20120524</version>
                <configuration>
                    <webAppConfig>
                        <contextPath>/${project.name}</contextPath>
                    </webAppConfig>
                </configuration>
            </plugin>
    

    You will notice that jetty:run will be using Jetty 8.1.4.v20120524 whereas when you inject the jetty-runner

           <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-dependency-plugin</artifactId>
              <version>2.3</version>
              <executions>
                <execution>
                  <phase>package</phase>
                  <goals><goal>copy</goal></goals>
                  <configuration>
                    <artifactItems>
                      <artifactItem>
                        <groupId>org.mortbay.jetty</groupId>
                        <artifactId>jetty-runner</artifactId>
                        <version>7.4.5.v20110725</version>
                        <destFileName>jetty-runner.jar</destFileName>
                      </artifactItem>
                    </artifactItems>
                  </configuration>
                </execution>
              </executions>
            </plugin>
    

    And run with java -jar jetty-runner.jar namename.war you are using Jetty 7.4.5.v20110725

    As somebody else has pointed out you are using EL 2.2 which is really a Servlet 3.0 feature, so perhaps you just need to upgrade to a newer version of jetty runner

    0 讨论(0)
  • 2021-01-16 02:44

    I'd got the same error and I resolved. Your question is wrong.

    This is due to Expression Parser. You have used

    #{applicationBean.getColumnName(column)}
    

    in your nameMeaning.xhtml. It is not valid EL for that parser. Either u need to change like

    #{applicationBean.getColumnName} 
    

    and pass param like

     <f:param name="column" value="#{column}"/>
    

    or use el-api-2.2.jar parser in jetty.

    0 讨论(0)
提交回复
热议问题