Unexpected FacesException thrown during launch of JSF webapp on the browser

177 Views Asked by At

I'm new to JSF and was asked to migrate an old MyFaces 2.0 webapp (app1) from WebLogic Server 12.1.3 to Tomcat (I chose Tomcat 9 and OpenWebBeans 2.0.27). This was achieved only after being directed to upgrade MyFaces Core to version 2.3.10 (but with no major change in the webapp itself) following the assistance and clear instructions from user @tandraschko .

After an apparent error-free start-up of the webapp, launching the application on the browser (http://localhost:8080/app1/) resulted in a blank page (after correctly redirecting to http://localhost:8080/app1/xhtml/appsSuite.xhtml) with the logs revealing errors/exceptions.

After combing through SO, I wasn't able to find any post which could provide clues to address my issue. Since there is neither an NPE nor stack traces in the logs, I'm stuck.

I'd be grateful for any assistance or direction to help debug this unexpected Faces exception.

Configuration

  • MyFaces 2.0 (but with MyFaces Core 2.3.10)
  • CODI 1.0.5
  • PrimeFaces 4.0
  • OpenWebBeans 2.0.27 (CDI 2.0 but beans_1_0 in beans.xml)
  • Tomcat 9
  • Java 8

Exception

Side Question: Is it OK to ignore the WARNING below?

...
04-Jul-2022 17:26:01.689 INFO [main] org.apache.webbeans.lifecycle.AbstractLifeCycle.bootstrapApplication OpenWebBeans Container has started, it took [21749] ms.
...
04-Jul-2022 17:26:09.240 INFO [main] org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces ServletContext initialized.
...
04-Jul-2022 17:26:09.576 INFO [main] org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized MyFaces Core has started, it took [7885] ms.
04-Jul-2022 17:26:09.707 INFO [main] com.sun.jersey.api.core.PackagesResourceConfig.init Scanning for root resource and provider classes in the packages:
  com.company.app1.enterprise.service.health
04-Jul-2022 17:26:09.811 INFO [main] com.sun.jersey.api.core.ScanningResourceConfig.logClasses Root resource classes found:
  class com.company.app1.enterprise.service.health.HeartbeatService
04-Jul-2022 17:26:09.812 INFO [main] com.sun.jersey.api.core.ScanningResourceConfig.init No provider classes found.
04-Jul-2022 17:26:10.060 INFO [main] com.sun.jersey.server.impl.cdi.CDIComponentProviderFactoryInitializer.initialize CDI support is enabled
04-Jul-2022 17:26:10.090 INFO [main] com.sun.jersey.server.impl.application.WebApplicationImpl._initiate Initiating Jersey application, version 'Jersey: 1.18 11/22/2013 01:21 AM'
04-Jul-2022 17:26:12.281 WARNING [main] com.sun.jersey.spi.inject.Errors.processErrorMessages The following warnings have been detected with resource and/or provider classes:
  WARNING: A HTTP GET method, public java.lang.String com.company.app1.enterprise.service.health.HeartbeatService.pulse(java.lang.String), should not consume any entity.
04-Jul-2022 17:26:12.403 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [C:\apache-tomcat-9.0.63\webapps\app1.war] has finished in [59,791] ms
...
04-Jul-2022 17:26:14.760 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [62776] milliseconds
04-Jul-2022 17:29:44.055 INFO [http-nio-8080-exec-1] org.apache.myfaces.extensions.cdi.jpa.impl.JpaModuleStartupObserver.logJpaModuleConfiguration [Started] MyFaces CODI JPA-Module v1.0.5

04-Jul-2022 17:29:44.080 INFO [http-nio-8080-exec-1] org.apache.myfaces.extensions.cdi.core.impl.CoreStartupObserver.logCoreConfiguration [Started] MyFaces CODI (Extensions CDI) Core v1.0.5
Used CDI implementation: OpenWebBeans v2.0.27

project-stage: Production
project-stage class: org.apache.myfaces.extensions.cdi.core.api.projectstage.ProjectStage$Production

application-parameters:
   name:        org.apache.myfaces.config.annotation.LifecycleProvider
   value:       org.apache.myfaces.config.annotation.NoInjectionAnnotationLifecycleProvider

   name:        javax.faces.PROJECT_STAGE
   value:       Production

   name:        primefaces.THEME
   value:       casablanca

   name:        javax.faces.STATE_SAVING_METHOD
   value:       client

   name:        javax.servlet.jsp.jstl.fmt.localizationContext
   value:       resources.application

   name:        javax.faces.FACELETS_SKIP_COMMENTS
   value:       true

   name:        javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE
   value:       true

config implementation: org.apache.myfaces.extensions.cdi.core.api.config.CodiCoreConfig$$OwbNormalScopeProxy0
config implementation: org.apache.myfaces.extensions.cdi.core.api.config.CodiCoreConfig
   method:      isAdvancedQualifierRequiredForDependencyInjection
   value:       true

   method:      isConfigurationLoggingEnabled
   value:       true

   method:      isInvalidBeanCreationEventEnabled
   value:       false


04-Jul-2022 17:29:44.086 INFO [http-nio-8080-exec-1] org.apache.myfaces.extensions.cdi.scripting.impl.ScriptingModuleStartupObserver.logScriptingModuleConfiguration [Started] MyFaces CODI Scripting-Module v1.0.5

04-Jul-2022 17:29:44.117 INFO [http-nio-8080-exec-1] org.apache.myfaces.extensions.cdi.jsf2.impl.Jsf2ModuleStartupObserver.logJsfModuleConfiguration [Started] MyFaces CODI JSF-Module v1.0.5 for JSF 2.0
Used JSF implementation: MyFaces Core v2.3.10

config implementation: org.apache.myfaces.extensions.cdi.jsf.api.config.JsfModuleConfig$$OwbNormalScopeProxy0
config implementation: org.apache.myfaces.extensions.cdi.jsf.api.config.JsfModuleConfig
   method:      isInitialRedirectEnabled
   value:       true

   method:      isAlwaysKeepMessages
   value:       true

   method:      isUseViewConfigsAsNavigationCasesEnabled
   value:       true

   method:      isInvalidValueAwareMessageInterpolatorEnabled
   value:       true

config implementation: org.apache.myfaces.extensions.cdi.core.api.scope.conversation.config.WindowContextConfig$$OwbNormalScopeProxy0
config implementation: org.apache.myfaces.extensions.cdi.core.api.scope.conversation.config.WindowContextConfig
   method:      isAddWindowIdToActionUrlsEnabled
   value:       false

   method:      getWindowContextTimeoutInMinutes
   value:       60

   method:      isCloseWindowContextEventEnabled
   value:       false

   method:      isUrlParameterSupported
   value:       true

   method:      isUnknownWindowIdsAllowed
   value:       false

   method:      getMaxWindowContextCount
   value:       64

   method:      isCloseEmptyWindowContextsEnabled
   value:       false

   method:      isCreateWindowContextEventEnabled
   value:       false

   method:      isEagerWindowContextDetectionEnabled
   value:       true

config implementation: org.apache.myfaces.extensions.cdi.core.api.scope.conversation.config.ConversationConfig$$OwbNormalScopeProxy0
config implementation: org.apache.myfaces.extensions.cdi.core.api.scope.conversation.config.ConversationConfig
   method:      getConversationTimeoutInMinutes
   value:       30

   method:      isStartConversationEventEnabled
   value:       false

   method:      isCloseConversationEventEnabled
   value:       false

   method:      isConversationRequiredEnabled
   value:       true

   method:      isRestartConversationEventEnabled
   value:       false

   method:      isAccessBeanEventEnabled
   value:       false

   method:      isUnscopeBeanEventEnabled
   value:       false

   method:      isScopeBeanEventEnabled
   value:       false

MessageContextConfig class: org.apache.myfaces.extensions.cdi.message.impl.DefaultMessageContextConfig
   MessageInterpolator class: class org.apache.myfaces.extensions.cdi.jsf.impl.message.FacesMessageInterpolator
   MessageResolver class: class org.apache.myfaces.extensions.cdi.jsf.impl.message.JsfAwareApplicationMessagesMessageResolver
   MessageHandler class: class org.apache.myfaces.extensions.cdi.jsf.impl.message.JsfAwareMessageHandler
   LocaleResolver class: class org.apache.myfaces.extensions.cdi.jsf.impl.message.JsfAwareLocaleResolver
   FormatterFactory class: class org.apache.myfaces.extensions.cdi.message.impl.DefaultFormatterFactory

04-Jul-2022 17:29:44.121 INFO [http-nio-8080-exec-1] org.apache.myfaces.extensions.cdi.bv.impl.BeanValidationModuleStartupObserver.logBeanValidationModuleConfiguration [Started] MyFaces CODI Bean-Validation-Module v1.0.5
17:29:45.493 [http-nio-8080-exec-1] ERROR com.company.app1.enterprise.exception.app1ExceptionHandler - ExpHandler: current exception:class javax.faces.FacesException
17:29:45.495 [http-nio-8080-exec-1] ERROR com.company.app1.enterprise.exception.app1ExceptionHandler - ExpHandler: current exception component:null
17:29:45.497 [http-nio-8080-exec-1] ERROR com.company.app1.enterprise.exception.app1ExceptionHandler - ExpHandler: current exception phaseid:RENDER_RESPONSE(6)
17:29:45.506 [http-nio-8080-exec-1] ERROR com.company.app1.enterprise.exception.app1ExceptionHandler - ExpHandler: current exception: attributes{}

web.xml

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

    <context-param>
        <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Production</param-value>
    </context-param>
    <context-param> 
        <param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
        <param-value>true</param-value> 
    </context-param>
    <context-param>
        <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
        <param-value>resources.application</param-value>
    </context-param>
    <context-param>
        <param-name>primefaces.THEME</param-name>
        <param-value>casablanca</param-value>
    </context-param>

    <!-- Enable PostConstruct on JSF ManagedBeans on Jetty (and Tomcat as well?) -->
    <context-param>
        <param-name>org.apache.myfaces.config.annotation.LifecycleProvider</param-name>
        <param-value>org.apache.myfaces.config.annotation.NoInjectionAnnotationLifecycleProvider</param-value>
    </context-param>

    <listener>
        <listener-class>org.apache.webbeans.servlet.WebBeansConfigurationListener</listener-class>
    </listener>
    <listener>
        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
    </listener>


    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>0</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
    
    <servlet>
        <servlet-name>jersey-serlvet</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
        <init-param>
            <param-name>com.sun.jersey.config.property.packages</param-name>
            <param-value>com.company.app1.enterprise.service.health</param-value>
        </init-param>
        <init-param>
            <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
            <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>jersey-serlvet</servlet-name>
        <url-pattern>/health/*</url-pattern>
    </servlet-mapping>


    <session-config> <!-- set the default session time out to 60 minutes -->
        <session-timeout>60</session-timeout>
         <!-- set the Session Cookie as httpOnly -->
      <!--      <cookie-config>
          <http-only>true</http-only>
        </cookie-config> -->
        <!-- Added this for SPR HCSDM00273622 - Links to sign up new users not working properly -->
        <tracking-mode>COOKIE</tracking-mode>       
    </session-config>

    
    <filter>
        <filter-name>ParameterEscapeFilter</filter-name>
        <filter-class>com.company.app1.enterprise.filter.ParameterEscapeFilter</filter-class>
        <async-supported>true</async-supported>
    </filter>
    <filter-mapping>
        <filter-name>ParameterEscapeFilter</filter-name>
            <url-pattern>/*</url-pattern>
    </filter-mapping>
    
    <filter>
        <filter-name>primeFacesFileUploadFilter</filter-name>
        <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
        <async-supported>true</async-supported>
    </filter>
    <filter-mapping>
        <filter-name>primeFacesFileUploadFilter</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>

<filter>
  <filter-name>GzipFilter</filter-name>
  <filter-class>com.axeda.qpublic.filter.GZipServletFilter</filter-class>
  <async-supported>true</async-supported> 
</filter>
<filter-mapping>
    <filter-name>GzipFilter</filter-name>
    <url-pattern>*.js</url-pattern>
</filter-mapping>
    <filter-mapping>
        <filter-name>GzipFilter</filter-name>
        <url-pattern>*.css</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>GzipFilter</filter-name>
        <url-pattern>*.xhtml</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>GzipFilter</filter-name>
        <url-pattern>*.html</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>GzipFilter</filter-name>
        <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>GzipFilter</filter-name>
        <url-pattern>/</url-pattern>
    </filter-mapping>

    <resource-env-ref>
        <resource-env-ref-name>BeanManager</resource-env-ref-name>
        <resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
    </resource-env-ref>

    <mime-mapping> 
        <extension>xhtml</extension> 
        <mime-type>text/xhtml</mime-type> 
    </mime-mapping>

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>    
</web-app>

pom.xml (abridged)

<?xml version="1.0" encoding="UTF-8" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>TMapp1</groupId>
    <artifactId>app1</artifactId>
    <version>5.0</version>
    <packaging>war</packaging>

    <name>TM app1 Webapp</name>
    <url>http://maven.apache.org</url>

    <properties>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <owb.version>2.0.27</owb.version>
    </properties>

    <dependencies>
        <!-- app1 uses PrimeFaces 4.0 instead of 11.0.0 as primefaces-test 11.0.0 does. -->
        <!-- <dependency> -->
            <!-- <groupId>org.primefaces</groupId> -->
            <!-- <artifactId>primefaces</artifactId> -->
            <!-- <version>11.0.0</version> -->
        <!-- </dependency> -->

        <!-- javax.* APIs -->
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-atinject_1.0_spec</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-jcdi_2.0_spec</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-interceptor_1.2_spec</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-annotation_1.3_spec</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-validation_2.0_spec</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.3.6</version>
        </dependency>

        <!-- app1 uses 3.1.0 instead of 4.0.1 as primefaces-test 11.0.0 does. -->
        <!-- <dependency> -->
            <!-- <groupId>javax.servlet</groupId> -->
            <!-- <artifactId>javax.servlet-api</artifactId> -->
            <!-- <version>4.0.1</version> -->
            <!-- <scope>provided</scope> -->
        <!-- </dependency> -->
        <!-- app1 uses 2.2.4 instead of 3.0.0 as primefaces-test 11.0.0 does. -->
        <!-- <dependency> -->
            <!-- <groupId>javax.el</groupId> -->
            <!-- <artifactId>javax.el-api</artifactId> -->
            <!-- <version>3.0.0</version> -->
            <!-- <scope>provided</scope> -->
        <!-- </dependency> -->

        <!-- OpenWebBeans -->
        <dependency>
            <groupId>org.apache.openwebbeans</groupId>
            <artifactId>openwebbeans-impl</artifactId>
            <version>${owb.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.openwebbeans</groupId>
            <artifactId>openwebbeans-jsf</artifactId>
            <version>${owb.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.openwebbeans</groupId>
            <artifactId>openwebbeans-web</artifactId>
            <version>${owb.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.openwebbeans</groupId>
            <artifactId>openwebbeans-el22</artifactId>
            <version>${owb.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.bval</groupId>
            <artifactId>bval-jsr</artifactId>
            <version>2.0.6</version>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.24</version>
        </dependency>

        <!-- Used by: TODO: (unknown) -->
        <dependency>
            <groupId>commons-digester</groupId>
            <artifactId>commons-digester</artifactId>
            <version>1.8</version>
        </dependency>
        <dependency>
            <groupId>javax.ejb</groupId>
            <artifactId>javax.ejb-api</artifactId>
            <version>3.2.2</version>
        </dependency>
        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>javax.persistence-api</artifactId>
            <version>2.2</version>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <version>2.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-client</artifactId>
            <version>1.18</version>
        </dependency>

        <!-- MyFaces Core -->
        <dependency>
            <groupId>org.apache.myfaces.core</groupId>
            <artifactId>myfaces-api</artifactId>
            <version>2.3.10</version>
        </dependency>
        <dependency>
            <groupId>org.apache.myfaces.core</groupId>
            <artifactId>myfaces-impl</artifactId>
            <version>2.3.10</version>
        </dependency>

        <!-- start of apache-commons -->
        <!-- Used by: app1 -->
        <dependency>
            <groupId<!-- ... -->
        </dependency>
        <!-- end of apache-commons -->

        <dependency>
            <!-- Used by: TODO: app1 -->
            <groupId>org.apache.myfaces.extensions.cdi.bundles</groupId>
            <artifactId>myfaces-extcdi-bundle-jsf20</artifactId>
            <version>1.0.5</version>
        </dependency>

        <!-- primefaces? -->
        <!-- Used by: app1 -->
        <dependency> <!-- not used at compile time -->
            <groupId>org.atmosphere</groupId>
            <!-- ... -->
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>4.0</version>
        </dependency>

        <!-- Used by: app1 -->
        <dependency>
            <groupId>javax.el</groupId>
            <artifactId>javax.el-api</artifactId>
            <version>2.2.4</version>
        </dependency>
        
        <!-- start of jersey libs -->
        <dependency>
            <!-- ... -->
        </dependency>
        <!-- end of jersey libs -->

        <dependency>
            <!-- Used by: app1 -->
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>primefaces</id>
            <name>PrimeFaces Maven Repository</name>
            <url>https://repository.primefaces.org</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

    <build>
        <finalName>app1</finalName>
        <plugins>
            <!-- ... -->
        </plugins>
    
        <resources>
            <!-- ... -->
        </resources>
    </build>

    <profiles>
        <profile>
            <id>myfaces22</id>
            <!-- ... -->
        </profile>
        <profile>
            <id>myfaces23</id>
            <!-- ... -->
        </profile>
        <profile>
            <id>myfaces23next</id>
            <!-- ... -->
        </profile>
        <profile>
            <id>coverage</id>
            <!-- ... -->
        </profile>
    </profiles>
</project>
0

There are 0 best solutions below