(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 have yet to edit any of the code. I am building and running the web app with maven and jetty. When I execute the following everything works fine.
mvn jetty:run
However when I package and then run the jar directly, I come across some strange problems.
mvn package
java -jar target/dependency/jetty-runner.jar target/*.war
(Same thing with "mvn jetty:run-exploded")
The main page loads as it should, but when I click one of the navigation links (to create or list my models) I end up with these errors printed to the browser (http://localhost:8080/pages/main.jsf)
HTTP ERROR 500
Problem accessing /pages/main.jsf. Reason:
/pages/nameMeaning.xhtml @25,80 value="#{applicationBean.getColumnName(column)}" Error Parsing: #{applicationBean.getColumnName(column)}
Caused by:
javax.faces.view.facelets.TagAttributeException: /pages/nameMeaning.xhtml @25,80 value="#{applicationBean.getColumnName(column)}" Error Parsing: #{applicationBean.getColumnName(column)}
at com.sun.faces.facelets.tag.TagAttributeImpl.getValueExpression(TagAttributeImpl.java:401)
at com.sun.faces.facelets.tag.TagAttributeImpl.getValueExpression(TagAttributeImpl.java:351)
at com.sun.faces.facelets.tag.jsf.ValueHolderRule$DynamicValueExpressionMetadata.applyMetadata(ValueHolderRule.java:129)
at com.sun.faces.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:81)
at javax.faces.view.facelets.MetaTagHandler.setAttributes(MetaTagHandler.java:129)
at javax.faces.view.facelets.DelegatingMetaTagHandler.setAttributes(DelegatingMetaTagHandler.java:102)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.doNewComponentActions(ComponentTagHandlerDelegateImpl.java:398)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:159)
...
Caused by: javax.el.ELException: Error Parsing: #{applicationBean.getColumnName(column)}
at com.sun.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:171)
at com.sun.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:188)
at com.sun.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:232)
at com.sun.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:92)
at com.sun.faces.facelets.tag.TagAttributeImpl.getValueExpression(TagAttributeImpl.java:385)
... 95 more
Caused by: com.sun.el.parser.ParseException: Encountered "(" at line 1, column 32.
Was expecting one of:
"}" ...
"." ...
"[" ...
">" ...
"gt" ...
"<" ...
"lt" ...
">=" ...
"ge" ...
"<=" ...
"le" ...
"==" ...
"eq" ...
"!=" ...
"ne" ...
"&&" ...
"and" ...
"||" ...
"or" ...
"*" ...
"+" ...
"-" ...
"?" ...
"/" ...
"div" ...
"%" ...
"mod" ...
at com.sun.el.parser.ELParser.generateParseException(ELParser.java:1664)
at com.sun.el.parser.ELParser.jj_consume_token(ELParser.java:1544)
at com.sun.el.parser.ELParser.DeferredExpression(ELParser.java:147)
at com.sun.el.parser.ELParser.CompositeExpression(ELParser.java:74)
at com.sun.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:139)
... 99 more
Caused by:
Please see the pom.xml file here: http://pastebin.com/6aPpYP47
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.
来源:https://stackoverflow.com/questions/12241989/jetty-runs-correctly-via-maven-but-incorrectly-as-a-jar