Upgrade to JSF 2.0/Primefaces 3.1

UI Components for JSF
Post Reply
BarryC
Posts: 12
Joined: 20 Dec 2011, 00:00

29 Jan 2012, 18:38

Hi,
I am currently upgrading from Primefaces 2.1 and JSF1.2 to the latest versions. Everything works well except that on every initial restart of my server, on the first page that I redirect to I get either of these two errors. Once I refresh the page, it works fine as long as I don't restart the server. Why would the default extension be added to a request for these stylesheets? Is there something additional that I need to add to my web.xml?

Error Message = /primefaces.css.xhtml Not Found in ExternalContext as a Resource
Stack Trace =
com.sun.faces.context.FacesFileNotFoundException: /primefaces.css.xhtml Not Found in ExternalContext as a Resource
at com.sun.faces.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:232)
at com.sun.faces.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:273)
at com.sun.faces.facelets.impl.DefaultFaceletFactory.getMetadataFacelet(DefaultFaceletFactory.java:209)
at com.sun.faces.application.view.ViewMetadataImpl.createMetadataView(ViewMetadataImpl.java:114)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:233)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)

com.sun.faces.context.FacesFileNotFoundException: /theme.css.xhtml Not Found in ExternalContext as a Resource
at com.sun.faces.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:232)
at com.sun.faces.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:273)
at com.sun.faces.facelets.impl.DefaultFaceletFactory.getMetadataFacelet(DefaultFaceletFactory.java:209)
at com.sun.faces.application.view.ViewMetadataImpl.createMetadataView(ViewMetadataImpl.java:114)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:233)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)

Web.xml


<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>plain</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.enableControlSkinning</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>overcast</param-value>
</context-param>

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

29 Jan 2012, 22:11

1. Seems like a themes issue. Click below and read the blog, I think you need to download latest Themes JAR file (overcast). blog mentions last 2 releases of Themes JAR files 1.0.2 (I think) and 1.0.3 are used with Primefaces 3.0+ releases.

Themes 1.0.3 Released

2. Migration Guide to 3.0

3. There is a separate forum for PrimeFaces Themes. You might search there for an answer, as someone else maybe experienced and discussed the same issue you're having. FYI, I search forum via google such as follows:

forum.primefaces.org theme primefaces.css.xhtml Not Found in ExternalContext as a Resource

4. Is it necessary to keep richfaces in your project, too? Your title just mentions JSF 2.0 and Primefaces 3.1.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

BarryC
Posts: 12
Joined: 20 Dec 2011, 00:00

31 Jan 2012, 02:47

Yes. I am also using the latest release of RichFaces(4.1) because I use some Richfaces components. I pulled down the latest theme for overcast(1.03) when I updated and I still get this issue. I will search the themes forum for the issue.

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

31 Jan 2012, 04:51

BarryC wrote:Hi,
Error Message = /primefaces.css.xhtml Not Found in ExternalContext as a Resource
Stack Trace =
com.sun.faces.context.FacesFileNotFoundException: /primefaces.css.xhtml Not Found in ExternalContext as a Resource

com.sun.faces.context.FacesFileNotFoundException: /theme.css.xhtml Not Found in ExternalContext as a Resource

Web.xml


<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
It seems as though the DEFAULT_SUFFIX context parameter in your web.xml is causing it to add .xhtml to /primefaces.css and /theme.css. I don't have that in my web.xml, and honestly, this is the first time I seen that.

I have the following in my web.xml

Code: Select all

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

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

Lyrionus
Posts: 60
Joined: 31 Aug 2011, 09:09

31 Jan 2012, 10:30

Yep, and yours will add .jsf to your .js, .css and even .png That is normal JSF2.0 implementation. Every resource you add via there recourses gets the .jsf or .xhtml extension depending on your web.xml config.
JSF 2.0
Primefaces 3.2
Tomcat 7.0

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

31 Jan 2012, 17:21

Lyrionus wrote:Yep, and yours will add .jsf to your .js, .css and even .png That is normal JSF2.0 implementation. Every resource you add via there recourses gets the .jsf or .xhtml extension depending on your web.xml config.
Interesting, I just confirmed this via View Source on rendered HTML of my xhtml. So, why am I not experiencing the same error that BarryC is experiencing? My pages are working great.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

BarryC
Posts: 12
Joined: 20 Dec 2011, 00:00

15 Feb 2012, 21:50

I fixed this by using the default suffix of .jsf.

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

The error was happening for me after my login page, which was the first redirect generated by the jsf framework, so that may have something to do with it. It seems like it was a problem for both Primefaces and Richfaces if I wasn't using the default suffix.

Hope this helps someone else.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 30 guests