0

I am using Apache TomEE 1.7.4.

The dependencies added in my pom.xml file are-

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency> 

        <dependency>
            <groupId>javax.el</groupId>
            <artifactId>el-api</artifactId>
            <version>2.2</version>
        </dependency>

        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.2.0</version>
        </dependency>

        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.2.0</version>
        </dependency>

To make use of the new string concatenation operator += like in -

 <h:graphicImage 
   value="#{resource[facesContext.viewRoot.locale+='/default:img/rafa.png']}"/>

I replaced the EL 2.2 version with this-

         <dependency>
            <groupId>javax.el</groupId>
            <artifactId>javax.el-api</artifactId>
            <version>3.0.0</version>
         </dependency>

But i am getting a -

Caused by: javax.el.ELException: Failed to parse the expression [#{resource[facesContext.viewRoot.locale+='/default:img/rafa.png']}]
    at org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:145)
    at org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:171)
    at org.apache.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:216)
    at org.apache.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:66)
    at org.apache.webbeans.el22.WrappedExpressionFactory.createValueExpression(WrappedExpressionFactory.java:59)
    at com.sun.faces.facelets.tag.TagAttributeImpl.getValueExpression(TagAttributeImpl.java:408)
    ... 43 more

Suggestions, if any?

I am not sure whether I will have to upgrade to version 8 since,

Apache Tomcat 8 supports the Java Servlet 3.1, JavaServer Pages 2.3, Java Unified Expression Language 3.0 and Java API for WebSocket 1.1 specifications.


OKay, it works perfect with GlassFish(4.0) Java EE Application Server. But what I don't understand which entries to be made in pom.xml file-

Here, it is mentioned that the below dependency needs to be added in pom.xml

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-web-api</artifactId>
    <version><!-- 7.0 (JSF 2.2) or 6.0 (JSF 2.0/2.1) --></version>
    <scope>provided</scope>
</dependency>

After adding it, there is-

enter image description here

A screenshot to illustrate my confusion-

In the server logs, i found that the server is using this version of Mojarra

2016-06-08T17:26:36.778+0530|INFO: Initializing Mojarra 2.2.0 ( 20130502-2118 https://svn.java.net/svn/mojarra~svn/tags/2.2.0@11930)

with the lib folder of Glassfish 4.0 - enter image description here

You see there is a jar file javaee.

If I need to use the Mojarra 2.2.6 version, say for example, what exactly I need to do?

Community
  • 1
  • 1
Farhan stands with Palestine
  • 13,890
  • 13
  • 58
  • 105
  • Your Maven config is not correct. Is this helpful? http://stackoverflow.com/q/8081234 (and "Installing JSF" in http://stackoverflow.com/tags/jsf/info) – BalusC Jun 08 '16 at 08:14
  • @BalusC: The JSF info page suggests for (AS + Maven) users to add this to the pom.xml file- ` javax javaee-web-api provided `, with `scope` provided. Since Apache TomEE will be shipping with Myfaces implementation, please suggest or do I need to make use of Apache TomEE PLUME for Mojarra support. – Farhan stands with Palestine Jun 08 '16 at 09:34
  • You should basically replace libraries in server itself, not provide via webapp. Or replace the whole server itself, indeed. – BalusC Jun 08 '16 at 10:10
  • @BalusC: Replace the whole server itself by WHICH server? Didn't get your point. Secondly, replace libraries in server itself, do you mean replacing jars present in lib folder of Apache-TomEE-webprofile-1.7.4\lib. My confusion being that I haven't worked with AS. :) – Farhan stands with Palestine Jun 08 '16 at 10:15
  • 1) By the one bundling Mojarra. 2) That's correct. Perhaps more things need to be done or taken into account, this depends on server itself. In e.g. WildFly it's a bit more work than just swapping out JARs. – BalusC Jun 08 '16 at 10:18
  • @BalusC: It works fine with Glassfish. Please suggest on the updated part of the question. – Farhan stands with Palestine Jun 08 '16 at 12:33
  • That's answered in http://stackoverflow.com/questions/10782528/how-to-update-mojarra-version-in-glassfish (by the way, GF 4.0 is full of childhood diseases -all the hassle to get "first Java EE 7" server ready on time. Grab latest one, which is IIRC 4.1.1, or just get Payara). – BalusC Jun 08 '16 at 12:35
  • @BalusC: And the first part in the updated question, I mean the JSF info suggested to add the dependency (see above), & there is a javaee jar file in glassfish lib folder. Which one will get precedence? Or are the 2 jars exactly same? – Farhan stands with Palestine Jun 08 '16 at 12:46
  • The jar file specified in the maven pom.xml is only used to compile your application - it is not used at runtime. That is what `provided means. At runtime your server implementation (whatever it may be) is used. – Steve C Jun 08 '16 at 14:05
  • @SteveC: Thanks Steve for clarification. – Farhan stands with Palestine Jun 08 '16 at 14:06

1 Answers1

0

MyFaces supports to configure the EL ExpressionFactory to use (https://myfaces.apache.org/core20/myfaces-impl/webconfig.html) so it can be one way to enforce one impl but you can also upgrade to TomEE 7 which packages Tomcat 8.

Romain Manni-Bucau
  • 3,354
  • 1
  • 16
  • 13