1

I am new in JSF. I'm trying to create a session-scoped bean of this class:

package com.mybusiness.clients.myproject;

public class OAuth2ServiceClient {
    ...
    public OAuth2ServiceClient(String serviceURI, String clientName, String clientSecret) {
        ...
    }
    ...
}

I cannot modify this class (since is being provided by a library), y have to create through faces-config.xml:

<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">

    <managed-bean>
        <managed-bean-name>oauth2Client</managed-bean-name>
        <managed-bean-class>com.mybusiness.clients.myproject.OAuth2ServiceClient</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
        <managed-property>
            <property-name>serviceURI</property-name>
            <value>http://localhost:8080/</value>
        </managed-property>
        <managed-property>
            <property-name>clientName</property-name>
            <value>myClient</value>
        </managed-property>
        <managed-property>
            <property-name>clientSecret</property-name>
            <value>secret</value>
        </managed-property>
    </managed-bean>
</faces-config>

I am using this oauth2Client in my LoginController class, but i tried to get it through these both ways without success

@ManagedBean
@SessionScoped
public class LoginController {

     @ManagedProperty(value = "#{oauth2Client}")
     private OAuth2ServiceClient oauth2Client // Coming null

     public String login(){
         HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
session.getAttributeNames(); // Doesn't contains oauth2Client 
         ...
     }

}

This is my pom.xml

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <primefaces.version>5.1</primefaces.version>
        <jsf-impl.version>2.2.4</jsf-impl.version>
        <jsf-api.version>2.2.4</jsf-api.version>
        <servlet.version>3.0.1</servlet.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>${primefaces.version}</version>
            <scope>compile</scope>
        </dependency>
        <!-- Servlet -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${servlet.version}</version>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>${jsf-impl.version}</version>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>${jsf-api.version}</version>
        </dependency>
        ...
    </dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>8.1.9.v20130131</version>
            <configuration>
                <connectors>
                    <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                        <port>9290</port>
                    </connector>
                </connectors>
                <stopKey>alpha</stopKey>
                <stopPort>9092</stopPort>
                <scanIntervalSeconds>5</scanIntervalSeconds>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <port>${jetty.port}</port>
                <path>/</path>
            </configuration>
        </plugin>
    </plugins>

    <extensions>
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-ssh</artifactId>
            <version>1.0</version>
        </extension>
    </extensions>
</build>

And my web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    id="WebApp_ID" version="3.0">
    <display-name>myproject-frontend</display-name>

    <listener>
    <listener-class>
        com.sun.faces.config.ConfigureListener
    </listener-class>
    </listener>

    <servlet>
        <servlet-name>JSF Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>JSF Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>JSF Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>redirect.xhtml</welcome-file>
    </welcome-file-list>

    <context-param>
        <param-name>primefaces.FONT_AWESOME</param-name>
        <param-value>true</param-value>
    </context-param>

</web-app>

What i am doing wrong? am i missing something?


EDIT

mvn jetty:run

Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building example-myproject Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> jetty-maven-plugin:8.1.9.v20130131:run (default-cli) @ myproject-frontend >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ myproject-frontend ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 12 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ myproject-frontend ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.3:testResources (default-testResources) @ myproject-frontend ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/jscherman/Documents/Workspace/myproject/myproject-frontend/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ myproject-frontend ---
[INFO] No sources to compile
[INFO] 
[INFO] <<< jetty-maven-plugin:8.1.9.v20130131:run (default-cli) @ myproject-frontend <<<
[INFO] 
[INFO] --- jetty-maven-plugin:8.1.9.v20130131:run (default-cli) @ myproject-frontend ---
[INFO] Configuring Jetty for project: example-myproject Maven Webapp
[INFO] webAppSourceDirectory not set. Defaulting to /home/jscherman/Documents/Workspace/myproject/myproject-frontend/src/main/webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes = /home/jscherman/Documents/Workspace/myproject/myproject-frontend/target/classes
[INFO] Context path = /
[INFO] Tmp directory = /home/jscherman/Documents/Workspace/myproject/myproject-frontend/target/tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] web.xml file = file:/home/jscherman/Documents/Workspace/myproject/myproject-frontend/src/main/webapp/WEB-INF/web.xml
[INFO] Webapp directory = /home/jscherman/Documents/Workspace/myproject/myproject-frontend/src/main/webapp
2015-10-02 15:39:17.860:INFO:oejs.Server:jetty-8.1.9.v20130131
2015-10-02 15:39:19.328:INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one.
2015-10-02 15:39:27.609:INFO:/:Spring WebApplicationInitializers detected on classpath: [org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration@76494bed]
2015-10-02 15:39:27.628:INFO:/:Initializing AtmosphereFramework
Oct 02, 2015 3:39:28 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.2.4 ( 20131003-1354 https://svn.java.net/svn/mojarra~svn/tags/2.2.4@12574) for context ''
Oct 02, 2015 3:39:28 PM com.sun.faces.spi.InjectionProviderFactory createInstance
INFO: JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.
Oct 02, 2015 3:39:29 PM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFO: Running on PrimeFaces 5.2
2015-10-02 15:39:29.904:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:9000
[INFO] Started Jetty Server
[INFO] Starting scanner at interval of 5 seconds.

mvn tomcat7:run

Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building example-myproject Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) @ myproject-frontend >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ myproject-frontend ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 12 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ myproject-frontend ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) @ myproject-frontend <<<
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) @ myproject-frontend ---
[INFO] Running war on http://localhost:9000/
[INFO] Using existing Tomcat server configuration at /home/jscherman/Documents/Workspace/myproject/myproject-frontend/target/tomcat
[INFO] create webapp with contextPath: 
Oct 02, 2015 3:47:04 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-9000"]
Oct 02, 2015 3:47:04 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Oct 02, 2015 3:47:04 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.47
Oct 02, 2015 3:47:09 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: 
        http://java.sun.com/jsf/html
     is already defined
Oct 02, 2015 3:47:09 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsf/core is already defined
Oct 02, 2015 3:47:09 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://mojarra.dev.java.net/mojarra_ext is already defined
Oct 02, 2015 3:47:09 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing AtmosphereFramework
Oct 02, 2015 3:47:09 PM org.apache.catalina.core.ApplicationContext log
INFO: Spring WebApplicationInitializers detected on classpath: [org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration@5de1865]
Oct 02, 2015 3:47:09 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.2.4 ( 20131003-1354 https://svn.java.net/svn/mojarra~svn/tags/2.2.4@12574) for context ''
Oct 02, 2015 3:47:10 PM com.sun.faces.spi.InjectionProviderFactory createInstance
INFO: JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.
Oct 02, 2015 3:47:10 PM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFO: Running on PrimeFaces 5.2
Oct 02, 2015 3:47:10 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.2.4 ( 20131003-1354 https://svn.java.net/svn/mojarra~svn/tags/2.2.4@12574) for context ''
Oct 02, 2015 3:47:10 PM com.sun.faces.spi.InjectionProviderFactory createInstance
INFO: JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.
Oct 02, 2015 3:47:11 PM com.sun.faces.mgbean.BeanManager addBean
WARNING: JSF1074: Managed bean named 'oauth2Client' has already been registered.  Replacing existing managed bean class type com.mybusiness.clients.myproject.OAuth2ServiceClient with com.mybusiness.clients.myproject.OAuth2ServiceClient.
Oct 02, 2015 3:47:11 PM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFO: Running on PrimeFaces 5.2
Oct 02, 2015 3:47:11 PM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFO: Running on PrimeFaces 5.2
Oct 02, 2015 3:47:11 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-9000"]

mvn dependency:tree

[INFO] com.mybusiness.myproject:myproject-frontend:war:0.0.1-SNAPSHOT
[INFO] +- org.primefaces:primefaces:jar:5.2:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:3.0.1:provided
[INFO] +- com.sun.faces:jsf-impl:jar:2.2.4:compile
[INFO] +- com.sun.faces:jsf-api:jar:2.2.4:provided
[INFO] +- com.mybusiness.myproject:myproject-service-client:jar:0.0.1-SNAPSHOT:compile
[INFO] |  +- com.mybusiness.myproject:myproject-api:jar:0.0.1-SNAPSHOT:compile
[INFO] |  |  +- org.springframework.hateoas:spring-hateoas:jar:0.16.0.RELEASE:compile
[INFO] |  |  |  \- org.objenesis:objenesis:jar:2.1:compile
[INFO] |  |  \- com.mybusiness.myproject:myproject-framework:jar:0.0.1-SNAPSHOT:compile
[INFO] |  |     +- org.springframework.boot:spring-boot-starter-web:jar:1.2.5.RELEASE:compile
[INFO] |  |     |  +- org.springframework.boot:spring-boot-starter:jar:1.2.5.RELEASE:compile
[INFO] |  |     |  |  +- org.springframework.boot:spring-boot:jar:1.2.5.RELEASE:compile
[INFO] |  |     |  |  \- org.springframework.boot:spring-boot-autoconfigure:jar:1.2.5.RELEASE:compile
[INFO] |  |     |  |     \- org.yaml:snakeyaml:jar:1.14:compile
[INFO] |  |     |  \- org.hibernate:hibernate-validator:jar:5.1.3.Final:compile
[INFO] |  |     |     +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] |  |     |     +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] |  |     |     \- com.fasterxml:classmate:jar:1.0.0:compile
[INFO] |  |     +- org.springframework.boot:spring-boot-starter-aop:jar:1.2.5.RELEASE:compile
[INFO] |  |     |  +- org.aspectj:aspectjrt:jar:1.8.6:compile
[INFO] |  |     |  \- org.aspectj:aspectjweaver:jar:1.8.6:compile
[INFO] |  |     +- org.springframework.boot:spring-boot-starter-security:jar:1.2.5.RELEASE:compile
[INFO] |  |     +- org.springframework.boot:spring-boot-starter-test:jar:1.2.5.RELEASE:compile
[INFO] |  |     |  +- junit:junit:jar:4.12:compile
[INFO] |  |     |  +- org.mockito:mockito-core:jar:1.10.19:compile
[INFO] |  |     |  +- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] |  |     |  +- org.hamcrest:hamcrest-library:jar:1.3:compile
[INFO] |  |     |  \- org.springframework:spring-test:jar:4.1.7.RELEASE:compile
[INFO] |  |     +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.2.5.RELEASE:compile
[INFO] |  |     |  +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.2.5.RELEASE:compile
[INFO] |  |     |  |  +- org.springframework:spring-jdbc:jar:4.1.7.RELEASE:compile
[INFO] |  |     |  |  \- org.springframework:spring-tx:jar:4.1.7.RELEASE:compile
[INFO] |  |     |  +- org.hibernate:hibernate-entitymanager:jar:4.3.10.Final:compile
[INFO] |  |     |  |  +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] |  |     |  |  +- org.hibernate:hibernate-core:jar:4.3.10.Final:compile
[INFO] |  |     |  |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |     |  |  |  \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] |  |     |  |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |     |  |  |  \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] |  |     |  |  +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final:compile
[INFO] |  |     |  |  \- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] |  |     |  +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] |  |     |  +- org.springframework:spring-orm:jar:4.1.7.RELEASE:compile
[INFO] |  |     |  +- org.springframework.data:spring-data-jpa:jar:1.7.3.RELEASE:compile
[INFO] |  |     |  |  +- org.springframework.data:spring-data-commons:jar:1.9.3.RELEASE:compile
[INFO] |  |     |  |  \- org.slf4j:jcl-over-slf4j:jar:1.7.12:runtime
[INFO] |  |     |  \- org.springframework:spring-aspects:jar:4.1.7.RELEASE:compile
[INFO] |  |     +- org.springframework.plugin:spring-plugin-core:jar:1.1.0.RELEASE:compile
[INFO] |  |     +- mysql:mysql-connector-java:jar:5.1.35:compile
[INFO] |  |     +- com.mybusiness.framework:mybusiness-fwk-logging:jar:1.4.148:compile
[INFO] |  |     +- commons-io:commons-io:jar:1.3.2:compile
[INFO] |  |     +- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] |  |     \- ma.glasnost.orika:orika-core:jar:1.4.5:compile
[INFO] |  |        +- org.javassist:javassist:jar:3.16.1-GA:compile
[INFO] |  |        +- com.thoughtworks.paranamer:paranamer:jar:2.3:compile
[INFO] |  |        +- com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:jar:1.2_jdk5:compile
[INFO] |  |        \- com.carrotsearch:java-sizeof:jar:0.0.4:compile
[INFO] |  +- com.mybusiness.myproject:myproject-core-commons:jar:0.0.1-SNAPSHOT:compile
[INFO] |  +- org.springframework:spring-web:jar:4.2.0.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-aop:jar:4.2.0.RELEASE:compile
[INFO] |  |  |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  |  +- org.springframework:spring-beans:jar:4.2.0.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-context:jar:4.2.0.RELEASE:compile
[INFO] |  |  |  \- org.springframework:spring-expression:jar:4.2.0.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-core:jar:4.2.0.RELEASE:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.5.3:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.5.3:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.5.3:compile
[INFO] |  +- org.jenkins-ci.plugins:testInProgress-client:jar:1.4:compile
[INFO] |  |  \- org.json:json:jar:20140107:compile
[INFO] |  +- org.slf4j:slf4j-log4j12:jar:1.7.7:compile
[INFO] |  |  \- log4j:log4j:jar:1.2.17:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO] |  +- org.springframework.security.oauth:spring-security-oauth2:jar:2.0.7.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-webmvc:jar:4.0.9.RELEASE:compile
[INFO] |  |  +- org.springframework.security:spring-security-core:jar:3.2.6.RELEASE:compile
[INFO] |  |  +- org.springframework.security:spring-security-config:jar:3.2.6.RELEASE:compile
[INFO] |  |  +- org.springframework.security:spring-security-web:jar:3.2.6.RELEASE:compile
[INFO] |  |  +- commons-codec:commons-codec:jar:1.6:compile
[INFO] |  |  \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] |  |     \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] |  \- org.apache.httpcomponents:httpclient:jar:4.5:compile
[INFO] |     +- org.apache.httpcomponents:httpcore:jar:4.4.1:compile
[INFO] |     \- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- org.glassfish:javax.faces:jar:2.2.8:compile
[INFO] \- org.atmosphere:atmosphere-runtime:jar:2.4.0-RC3:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.767s
[INFO] Finished at: Fri Oct 02 16:04:53 ART 2015
[INFO] Final Memory: 19M/341M
[INFO] ------------------------------------------------------------------------

mvn dependency:analyze-dep-mgt

Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building example-myproject Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.1:analyze-dep-mgt (default-cli) @ myproject-frontend ---
[INFO] Found Resolved Dependency / DependencyManagement mismatches:
[INFO]    Nothing in DepMgt.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.788s
[INFO] Finished at: Fri Oct 02 16:13:04 ART 2015
[INFO] Final Memory: 15M/216M
[INFO] ------------------------------------------------------------------------
jscherman
  • 5,839
  • 14
  • 46
  • 88
  • 1
    As to the concrete problem, you forgot to tell which server you're trying to deploy to. At least, this problem is recognizable when the server already provides JSF out the box. In any case, it surely already provides Servlet out the box (and so you should absolutely mark Servlet API as `provided` in `pom.xml`) – BalusC Oct 02 '15 at 14:57
  • @BalusC thanks! i marked it with scope 'provided'. but still happening the same... any idea? – jscherman Oct 02 '15 at 15:02
  • @BalusC sorry for the ignorance, but what would be "tell which server you're trying to deploy to"? i understand that is a web.xml config that i am missing but i cannot figure out which one is... – jscherman Oct 02 '15 at 15:17
  • I am using jetty. take a look to the edit i've just made for further details (pom.xml plugins). – jscherman Oct 02 '15 at 15:22
  • 1
    OK, that indeed doesn't ship JSF out the box. So that can be scratched from probable causes (although you really should fix that Servlet dependency to mark as `provided`). Next step would be verifying if the desired `faces-config.xml` has indeed ended up in the Maven-built WAR file. I.e. it is at the right place in the Maven project structure and it's present when you inspect the Maven-produced WAR file with a ZIP tool. – BalusC Oct 02 '15 at 15:22
  • I checked out the generated war file. I have the faces-config.xml in 'WEB-INF/faces-config.xml'. there is the place where it should be located, right? – jscherman Oct 02 '15 at 16:43
  • 1
    Yes. OK, a bad location/build can be scratched from probable causes. Now, just to exclude the obvious, are you seeing any warnings/errors in server/webapp's startup log which you couldn't identify? – BalusC Oct 02 '15 at 18:38
  • i've editted with jetty and tomcat ouput. i've noticed that tomcat do say something about oauth2Client bean so apparently it is actuallty taking faces-config.xml. Yet, i cannot assure that with tomcat works fine since it gives me another error when i open the page that i am trying to solve. Regarding jetty, i can't notice any warnings as you asked... – jscherman Oct 02 '15 at 18:53
  • 1
    Tomcat's log indicates that the runtime classpath is polluted with duplicate JSF and PrimeFaces JAR files. One of the consequences is indeed broken bean management facility. Can you reconfirm by inspecting the `/WEB-INF/lib` folder of the Maven-produced WAR file? – BalusC Oct 02 '15 at 18:56
  • I've put mvn dependency:tree. I don't see any collition... but maybe you see something – jscherman Oct 02 '15 at 19:09
  • 1
    Maybe Maven build went mad. Not sure. I'm nowhere close a Maven expert (yet?). At least, I see in the dependency tree that JSF API is incorrectly marked as `provided` (only the Servlet API should be), but that would have other consequences than visible in logs posted so far (e.g. CNFE on `FacesServlet`). Or was it really marked `provided` during those runs? This would then suggest that there's indeed a duplicated JSF API JAR elsewhere in the runtime classpath (e.g. server's own `/lib` folder or JRE's own `/lib` folder). – BalusC Oct 02 '15 at 20:42
  • I had marked JSF API with scope provided as that's how it was in the primefaces showcase example... but i've already deleted and nothing changed. any other idea? (thanks anyways for all) – jscherman Oct 05 '15 at 15:31
  • @BalusC there it goes something interesting. i deleted ManagedProperty and SessionScoped annotations from LoginController and i created it from faces-config and it worked. So apparently it does takes faces-config.xml and the problem doesn't comes from project's config. maybe the oauth2Client config is wrong? – jscherman Oct 06 '15 at 20:23
  • Ah, annotation scan went mad? Try latest Mojarra version, which is 2.2.12 as of now. Somewhere around 2.2.5-2.2.11 they altered/fixed annotation scanning several times. – BalusC Oct 07 '15 at 06:36

0 Answers0