Css – Error loading theme, cannot find “theme.css” resource of “primefaces-start” library

cssjsfprimefacesthemes

When I run my project on Tomcat server, it shows this error:

Error loading theme, cannot find "theme.css" resource of "primefaces-start" library

Here's the stack trace:

javax.servlet.ServletException: Error loading theme, cannot find "theme.css" resource of "primefaces-start" library
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:321)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)


root cause 

javax.faces.FacesException: Error loading theme, cannot find "theme.css" resource of "primefaces-start" library
    org.primefaces.renderkit.HeadRenderer.encodeTheme(HeadRenderer.java:130)
    org.primefaces.renderkit.HeadRenderer.encodeBegin(HeadRenderer.java:92)
    javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:824)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1641)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1646)
    com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:389)
    com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:309)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

How is this caused and how can I solve it?

Best Answer

This just means that the primefaces-start theme isn't being installed in the webapp.

As per the PrimeFaces themes homepage, you need to install it via either an additional Maven pom.xml entry, or if you're not using Maven, by manually downloading the theme JAR file from PrimeFaces repository in Maven.

The PrimeFaces start theme is available here, the currently latest version is 1.0.10. So just grab the JAR over there, the start-1.0.10.jar and drop it in /WEB-INF/lib folder the usual way.

Related Topic