1

I am using JSF 2.3, PrimeFaces 6.2, WildFly 10, and JEE7. Upon deploying my application , I am getting the exception above, altough according to

https://arjan-tijms.omnifaces.org/p/jsf-23.html

this should not cause exception. Below is my source code:

@Named ("allAssignmentsBean")
@javax.faces.view.ViewScoped
public class AllAssignmentsBean {


@Inject
private ExternalContext extCtx;

My pom.xml:

    <dependency>
        <groupId>org.jboss.spec.javax.servlet</groupId>
        <artifactId>jboss-servlet-api_3.1_spec</artifactId>
        <version>1.0.0.Final</version>
        <scope>compile</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.jboss.logging</groupId>
        <artifactId>jboss-logging</artifactId>
        <version>3.0.1.GA</version>
        <scope>compile</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.jboss.as</groupId>
        <artifactId>jboss-as-web</artifactId>
        <version>7.1.1.Final</version>
        <scope>compile</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>7.0</version>
    </dependency>
    <dependency>
        <groupId>javax.faces</groupId>
        <artifactId>javax.faces-api</artifactId>
        <version>2.3</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>6.2</version>
    </dependency>

What could be the problem? Thank you!

Alex Mi
  • 1,409
  • 2
  • 21
  • 35
  • Did you use one of the Wildfly starter applications? Your pom.xml doesn't look right to me. See here and pick one that uses JSF and check out its pom.xml. https://github.com/wildfly/quickstart – Melloware Jun 06 '19 at 11:02
  • Thank you! I will check and let you know. Could you tell me please what is wrong with the pom.xml, according to you? I use it in a number of JSF applications and all of them seem to work (however, without using the JSF 2.3 features such as injecting an ExtarnalContext) – Alex Mi Jun 06 '19 at 11:26
  • Well I am not saying its WRONG I am just saying it doesn't look RIGHT. Most of mine use the WildFly BOM(Bill of Material) from their quick start apps which has everything you usually need. That still may not be your ExternalContext problem though. – Melloware Jun 06 '19 at 15:16
  • This exception will be thrown when you're not actually using JSF 2.3+ (i.e. when you think that you're using JSF 2.3, but the environment/build actually isn't correctly configured as-is). The cause of this problem is however not visible in the information provided so far. So this question cannot be answered. One of probable causes is that WildFly isn't configured to use standalone-ee8.xml. Another probable cause is that you forgot to set the JSF 2.3 flag in faces-config.xml and/or the `@FacesConfig` trigger. – BalusC Jun 06 '19 at 17:14
  • I tried modfiying my pom.xml with one of the poms in the github.com/wildfly/quickstart mentioned by Melloware, but I did not succeed in compiling it, so I reverted my changes to my original pom.xml given above. @BalusC you seem to be right: Actually I am using Mojarra 2.2.13.SP1 20160303-1204 altough I am referring in the pom.xml JSF 2.3. Could you tell me what might be the reason for that? – Alex Mi Jun 07 '19 at 04:15
  • That's the default Mojarra version of WildFly 10. So you actually never replaced/upgraded it. You have 2 options: upgrade to at least WildFly 11 (it's currently already at 16 .. please catch up), or manually upgrade Mojarra in WildFly 10. The instructions are in the duplicate. – BalusC Jun 07 '19 at 10:22

0 Answers0