Jetty runs correctly via maven, but incorrectly as a jar

谁都会走 提交于 2019-12-01 12:27:36

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!