jsfprimefacesjakarta-migrationprimeicons

PrimeFaces 13 - Primeicons not displayed when running on Tomcat 10.1.x (Jakarta)


I'm attempting to migrate an app from Tomcat 9 & PrimeFaces 13 to Tomcat 10.1.11 & Java 17. After all the heavy lifting I've got things working for the most part except for the PrimeFaces displaying of the PrimeIcon images (they're not being pulled down from the Tomcat instance).

Expected

In attempting to resolve the issue, I've created a sample project w/just the CommandButton page from the PrimeFaces v13 Showcase - this is what it should look like:

                        Working PrimeIcons

Actual

BUT, what I'm seeing in the Tomcat 10 -hosted page is:

                        Non-working PrimeIcons

The PrimeIcons css and related files are included in the PrimeFaces jar (verified via unzipping the jar), but when the index.xhtml request is received, two errors are logged in Tomcat's localhost log file:

05-Dec-2024 10:34:44.784 SEVERE [http-nio-80-exec-4] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [Faces Servlet] in context with path [/proto2] threw exception
    jakarta.el.PropertyNotFoundException: Property [primefaces:datascroller/images/loading.gif] not found on type [com.sun.faces.cdi.CdiExtension$$OwbNormalScopeProxy0]
        at jakarta.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:261)
        at jakarta.el.BeanELResolver.property(BeanELResolver.java:330)
        at jakarta.el.BeanELResolver.getValue(BeanELResolver.java:99)

05-Dec-2024 10:34:44.793 SEVERE [http-nio-80-exec-3] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [Faces Servlet] in context with path [/proto2] threw exception
    jakarta.el.PropertyNotFoundException: Property [primefaces:primeicons/primeicons.eot] not found on type [com.sun.faces.cdi.CdiExtension$$OwbNormalScopeProxy0]
        at jakarta.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:261)
        at jakarta.el.BeanELResolver.property(BeanELResolver.java:330)
        at jakarta.el.BeanELResolver.getValue(BeanELResolver.java:99)

By rolling back to the various javax.* packages rather than the jakarta.* and using Tomcat 9, the primeicon images are applied as expected, as shown in the 'Expected' image above, which was served by Tomcat 9.0.50 running Java 11

Any thoughts, suggestions, ideas are greatly appreciated.

Thomas

Source

index.xhtml:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:h="http://xmlns.jcp.org/jsf/html" 
      xmlns:f="http://xmlns.jcp.org/jsf/core" 
      xmlns:jsf="http://xmlns.jcp.org/jsf" 
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets" 
      xmlns:p="http://primefaces.org/ui" 
      xmlns:pt="http://xmlns.jcp.org/jsf/passthrough">

<f:view contentType="text/html;charset=UTF-8" encoding="UTF-8">
  <h:head>
  </h:head>

  <h:body>
    <style>
      button.ui-button {
        margin-right: .5rem;
      }
    </style>

    <div class="card">
      <h5>Rounded Icon Buttons</h5>
      <p:commandButton type="button" icon="pi pi-bookmark" styleClass="rounded-button ui-button-secondary" />
      <p:commandButton type="button" icon="pi pi-search" styleClass="rounded-button ui-button-success" />
      <p:commandButton type="button" icon="pi pi-user" styleClass="rounded-button ui-button-info" />
      <p:commandButton type="button" icon="pi pi-bell" styleClass="rounded-button ui-button-warning" />
      <p:commandButton type="button" icon="pi pi-heart" styleClass="rounded-button ui-button-help" />
      <p:commandButton type="button" icon="pi pi-times" styleClass="rounded-button ui-button-danger" />
      <p:commandButton type="button" icon="pi pi-check" styleClass="rounded-button" />

      <h5>Rounded Text Icon Buttons</h5>
      <p:commandButton type="button" icon="pi pi-check" styleClass="rounded-button ui-button-flat" />
      <p:commandButton type="button" icon="pi pi-bookmark" styleClass="rounded-button ui-button-secondary ui-button-flat" />
      <p:commandButton type="button" icon="pi pi-search" styleClass="rounded-button ui-button-success ui-button-flat" />
      <p:commandButton type="button" icon="pi pi-user" styleClass="rounded-button ui-button-info ui-button-flat" />
      <p:commandButton type="button" icon="pi pi-bell" styleClass="rounded-button ui-button-warning ui-button-flat" />
      <p:commandButton type="button" icon="pi pi-heart" styleClass="rounded-button ui-button-help ui-button-flat" />
      <p:commandButton type="button" icon="pi pi-times" styleClass="rounded-button ui-button-danger ui-button-flat" />
      <p:commandButton type="button" icon="pi pi-filter" styleClass="rounded-button ui-button-flat ui-button-plain" />

      <h5>Rounded and Outlined Icon Buttons</h5>
      <p:commandButton type="button" icon="pi pi-check" styleClass="rounded-button ui-button-outlined" />
      <p:commandButton type="button" icon="pi pi-bookmark" styleClass="rounded-button ui-button-secondary ui-button-outlined" />
      <p:commandButton type="button" icon="pi pi-search" styleClass="rounded-button ui-button-success ui-button-outlined" />
      <p:commandButton type="button" icon="pi pi-user" styleClass="rounded-button ui-button-info ui-button-outlined" />
      <p:commandButton type="button" icon="pi pi-bell" styleClass="rounded-button ui-button-warning ui-button-outlined" />
      <p:commandButton type="button" icon="pi pi-heart" styleClass="rounded-button ui-button-help ui-button-outlined" />
      <p:commandButton type="button" icon="pi pi-times" styleClass="rounded-button ui-button-danger ui-button-outlined" />
      <style>
        html body .custom.ui-button.ui-button-text-only .ui-icon-loading {
          opacity: 0;
        }
        
        html body .custom.ui-button.ui-button-text-only .ui-icon-loading:before {
          content: "\e94a";
        }
        
        html body .custom.ui-button,
        html body .custom.ui-button * {
          transition-property: all;
          transition-duration: .2s;
        }
        
        html body .custom.ui-button.ui-state-loading {
          opacity: 1;
          background: #888;
          border-color: #888;
        }
        
        html body .custom.ui-button.ui-state-loading.ui-button-text-only .ui-button-text {
          opacity: 1;
          padding-left: 2rem;
        }
        
        html body .custom.ui-button.ui-state-loading.ui-button-text-only .ui-icon-loading {
          opacity: 1;
          left: 0;
          margin-left: 0.5rem;
        }
      </style>
    </div>
  </h:body>
</f:view>
</html>

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns="https://java.sun.com/xml/ns/javaee" xsi:schemaLocation="https://java.sun.com/xml/ns/javaee https://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="NMPT" version="2.5">
  <login-config>
    <auth-method>BASIC</auth-method>
  </login-config>
  <display-name>Proto2 v${project.version}</display-name>
  <welcome-file-list>
    <welcome-file>index.xhtml</welcome-file>
  </welcome-file-list>
  <context-param>
    <param-name>primefaces.THEME</param-name>
    <param-value>saga</param-value>
  </context-param>
  <context-param>
      <param-name>primefaces.MOVE_SCRIPTS_TO_BOTTOM</param-name>
      <param-value>true</param-value>
  </context-param>
  
  <context-param>
    <param-name>jakarta.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
  </context-param>
  <context-param>
    <param-name>jakarta.faces.FACELETS_SKIP_COMMENTS</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>jakarta.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>jakarta.faces.PROJECT_STAGE</param-name>
    <param-value>Production</param-value>
  </context-param>
  <context-param>
    <param-name>jakarta.faces.CONFIG_FILES</param-name>
    <param-value>/WEB-INF/faces-config.xml</param-value>
  </context-param>
  
  <listener>
    <listener-class>org.apache.webbeans.servlet.WebBeansConfigurationListener</listener-class>
  </listener>
  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>

  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>
  
  <mime-mapping>
      <extension>ttf</extension>
      <mime-type>application/font-sfnt</mime-type>
  </mime-mapping>
  <mime-mapping>
      <extension>woff</extension>
      <mime-type>application/font-woff</mime-type>
  </mime-mapping>
  <mime-mapping>
      <extension>woff2</extension>
      <mime-type>application/font-woff2</mime-type>
  </mime-mapping>
  <mime-mapping>
      <extension>eot</extension>
      <mime-type>application/vnd.ms-fontobject</mime-type>
  </mime-mapping>
  <mime-mapping>
      <extension>eot?#iefix</extension>
      <mime-type>application/vnd.ms-fontobject</mime-type>
  </mime-mapping>
  <mime-mapping>
      <extension>svg</extension>
      <mime-type>image/svg+xml</mime-type>
  </mime-mapping>
  <mime-mapping>
      <extension>svg#latobold</extension>
      <mime-type>image/svg+xml</mime-type>
  </mime-mapping>
  <mime-mapping>
      <extension>svg#latoblack</extension>
      <mime-type>image/svg+xml</mime-type>
  </mime-mapping>
      <mime-mapping>
      <extension>svg#latolight</extension>
      <mime-type>image/svg+xml</mime-type>
  </mime-mapping>
  <mime-mapping>
      <extension>svg#latoregular</extension>
      <mime-type>image/svg+xml</mime-type>
  </mime-mapping>
  <mime-mapping>
      <extension>svg#fontawesomeregular</extension>
      <mime-type>image/svg+xml</mime-type>
  </mime-mapping>
</web-app>

pom.xml

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>dev.me</groupId>
  <artifactId>proto2</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>proto2</name>
  <description>test JSF project for working out PrimeFaces issues</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <primefaces.version>13.0.10</primefaces.version>
        <tomcat.version>10.1.11</tomcat.version>
        <log4j.version>2.20.0</log4j.version>
    </properties>
    
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>17</source>
                    <target>17</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.0</version>
              </plugin>
              <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>xml-maven-plugin</artifactId>
                <version>1.0.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>validate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <validationSets>
                        <validationSet>
                            <dir>src/main/webapp</dir>
                            <includes>
                                <include>**/*.xhtml</include>
                            </includes>
                        </validationSet>
                    </validationSets>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
    <dependencies>
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>${primefaces.version}</version>
            <classifier>jakarta</classifier>
        </dependency>
        <dependency>
            <groupId>com.googlecode.owasp-java-html-sanitizer</groupId>
            <artifactId>html-types</artifactId>
            <version>20220608.1</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>jakarta.faces</artifactId>
            <version>4.0.4</version>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet.jsp.jstl</groupId>
            <artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.web</groupId>
            <artifactId>jakarta.servlet.jsp.jstl</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>jakarta.enterprise</groupId>
            <artifactId>jakarta.enterprise.cdi-api</artifactId>
            <version>4.0.1</version>
        </dependency>
        <dependency>
            <groupId>jakarta.el</groupId>
            <artifactId>jakarta.el-api</artifactId>
            <version>5.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.openwebbeans</groupId>
            <artifactId>openwebbeans-jsf</artifactId>
            <version>4.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.openwebbeans</groupId>
            <artifactId>openwebbeans-el22</artifactId>
            <version>4.0.2</version>
        </dependency>
         <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>${log4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-1.2-api</artifactId>
            <version>${log4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-juli</artifactId>
            <version>${tomcat.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-servlet-api</artifactId>
            <version>${tomcat.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>4.0.5</version>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
            <version>4.0.2</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>4.0.5</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.17.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
            <version>4.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
            <version>1.12.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-digester3</artifactId>
            <version>3.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-fileupload2-jakarta-servlet6</artifactId>
            <version>2.0.0-M2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>4.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-math4-core</artifactId>
            <version>4.0-beta1</version>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>2.13.0</version>
        </dependency>
        <dependency>
            <groupId>commons-el</groupId>
            <artifactId>commons-el</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.17.0</version>
        </dependency>
    </dependencies>
</project>


Solution

  • Please upgrade to Mojarra 4.0.9 as it was a bug that was fixed in Mojarra!