You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by David Nordahl <da...@thinkology.org> on 2012/08/27 00:20:19 UTC

Re: Myfaces errors / FacesContext not found

I regenerated my project files without any xhtml files to remove that 
variable.

I've been trying to follow the guidelines at: 
http://myfaces.apache.org/extensions/scripting/exampleconfig.html

and am still having issues.  Is there a better 
documentation/configuration checklist I should follow?

I notice that it has an extra entry for a project's web.xml:

     <context-param>
         <description>
             Initializes the plugins for our scripting support
         </description>
<param-name>org.apache.myfaces.FACES_INIT_PLUGINS</param-name>
<param-value>org.apache.myfaces.extensions.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
     </context-param>

But I don't see any StartupServletContextPluginChainLoader anywhere in 
the my-faces library files included with TomEE or even in the current 
myfaces download itself and I get an ClassNotFound exception if I try to 
include this entry.

I notice in the TomEE logs it mentions a WEB-INF/faces-config.xml which 
I have defined, but also a
META-INF/standard-faces-config.xml  Perhaps this is required also?

Currently when I try to load my jsp test page, I get:

org.apache.jasper.JasperException: java.lang.RuntimeException: FacesContext not found

  


On 08/26/2012 12:54 PM, Romain Manni-Bucau wrote:
> Xhtml is not the default extension,
>
> Maybe redefine it
> Le 26 août 2012 19:53, "David Nordahl" <da...@thinkology.org> a écrit :
>
>> I'm not getting JSF tags rendered to HTML/XHTML. I'm using the SNAPSHOT. I
>> notice the errors "INFO: faces config file is null" even though I have the
>> file faces-config.xml in my WEB-INF folder from the root folder of my war
>> file.  The file contains:
>>
>> <?xml version='1.0' encoding='UTF-8'?>
>>
>> <faces-config version="2.1"
>>      xmlns="http://java.sun.com/**xml/ns/javaee<http://java.sun.com/xml/ns/javaee>
>> "
>>      xmlns:xsi="http://www.w3.org/**2001/XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>
>> "
>>      xsi:schemaLocation="http://**java.sun.com/xml/ns/javaee<http://java.sun.com/xml/ns/javaee>
>> http://java.sun.com/xml/ns/**javaee/web-facesconfig_2_1.xsd<http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd>
>> **">
>>      <application>
>>          <resource-bundle>
>>              <base-name>/Bundle</base-name>
>>              <var>bundle</var>
>>          </resource-bundle>
>>      </application>
>> </faces-config>
>>
>> But then later on it seems to load it as viewable in the attached log
>> file, but then just after that it repeats the above errors again.
>>
>> Then I have the errors:  "WARNING: No mappings of FacesServlet found.
>> Abort destroy MyFaces."
>>
>> But present in my web.xml file is:
>>
>>      <context-param>
>> <param-name>javax.faces.**PROJECT_STAGE</param-name>
>>          <param-value>Development</**param-value>
>>      </context-param>
>>      <servlet>
>>          <servlet-name>Faces Servlet</servlet-name>
>> <servlet-class>javax.faces.**webapp.FacesServlet</servlet-**class>
>>          <load-on-startup>1</load-on-**startup>
>>      </servlet>
>>      <servlet-mapping>
>>          <servlet-name>Faces Servlet</servlet-name>
>>          <url-pattern>/faces/*</url-**pattern>
>>      </servlet-mapping>
>>
>> Attached the log output.
>>
>>
>>
>>
>>
>>
>>


Re: Myfaces errors / FacesContext not found

Posted by David Nordahl <da...@thinkology.org>.
I will check out the examples, but perhaps I am moving in the right 
direction now:

I replaced jsf libraries in my project with the myfaces ones, and now I 
get the following errors compiling my jsps:

package com.sun.faces.taglib.jsf_core does not exist
     com.sun.faces.taglib.jsf_core.ViewTag _jspx_th_f_view_0 = 
(_jspx_resourceInjector != null) ? 
_jspx_resourceInjector.createTagHandlerInstance(com.sun.faces.taglib.jsf_core.ViewTag.class) 
: new com.sun.faces.taglib.jsf_core.ViewTag();

 From what I've read in forums, I think this means it is trying to use 
Sun RI instead of Myfaces?

I'm not sure where the directive to use MyFaces over RI is set.

This particular error is referencing the line in my jsps: <f:view> but 
the taglib I see used in examples for RI and Myfaces is both: <%@taglib 
uri="http://java.sun.com/jsf/core" prefix="f" %> but for prefix "t" I 
see an Apache URI used.


On 08/26/2012 06:11 PM, Vishwanath Krishnamurthi wrote:
> Hi David,
>
> We have about three examples on JSF. Could you compare against it to see
> what might be wrong ?
>
> https://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/jsf-managedBean-and-ejb
> or a similar one -
> https://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/jsf-cdi-and-ejb
>
> Had updated them only recently and they work on the current snapshot.
>
> For the current error that you have - "org.apache.jasper.**JasperException:
> java.lang.RuntimeException: FacesContext not found"
> it might be that the page you accessed was not routed via the FacesServlet.
> Could you double check the url-patterns added in the web.xml and the
> address by which you are accessing the page.
>
> Also check if your page does not mix xhtml content and jsp  specfic content
> (like page directives / taglib directives)  ?
>
> A few things that may not be related to this error - but worth checking:
>
> Ensure that you don't bundle jsf related jars
> i.e these are in provided scope
>
>   <dependency>
>        <groupId>org.apache.myfaces.core</groupId>
>        <artifactId>myfaces-api</artifactId>
>        <version>2.1.8</version>
>        <scope>provided</scope>
>      </dependency>
>      <dependency>
>        <groupId>org.apache.myfaces.core</groupId>
>        <artifactId>myfaces-impl</artifactId>
>        <version>2.1.8</version>
>        <scope>provided</scope>
>      </dependency>
>
>
> web.xml header is not in the old 2.4
>
> You shouldn't be requiring a StartupServletContextPluginCha**inLoader or
> have to worry about the standard-faces-**config.xml
>
> -Vishwa
>
> On Sun, Aug 26, 2012 at 11:20 PM, David Nordahl <da...@thinkology.org>wrote:
>
>> I regenerated my project files without any xhtml files to remove that
>> variable.
>>
>> I've been trying to follow the guidelines at: http://myfaces.apache.org/**
>> extensions/scripting/**exampleconfig.html<http://myfaces.apache.org/extensions/scripting/exampleconfig.html>
>>
>> and am still having issues.  Is there a better documentation/configuration
>> checklist I should follow?
>>
>> I notice that it has an extra entry for a project's web.xml:
>>
>>      <context-param>
>>          <description>
>>              Initializes the plugins for our scripting support
>>          </description>
>> <param-name>org.apache.**myfaces.FACES_INIT_PLUGINS</**param-name>
>> <param-value>org.apache.**myfaces.extensions.scripting.**servlet.**
>> StartupServletContextPluginCha**inLoader</param-value>
>>      </context-param>
>>
>> But I don't see any StartupServletContextPluginCha**inLoader anywhere in
>> the my-faces library files included with TomEE or even in the current
>> myfaces download itself and I get an ClassNotFound exception if I try to
>> include this entry.
>>
>> I notice in the TomEE logs it mentions a WEB-INF/faces-config.xml which I
>> have defined, but also a
>> META-INF/standard-faces-**config.xml  Perhaps this is required also?
>>
>> Currently when I try to load my jsp test page, I get:
>>
>> org.apache.jasper.**JasperException: java.lang.RuntimeException:
>> FacesContext not found
>>
>>
>>
>> On 08/26/2012 12:54 PM, Romain Manni-Bucau wrote:
>>
>>> Xhtml is not the default extension,
>>>
>>> Maybe redefine it
>>> Le 26 août 2012 19:53, "David Nordahl" <da...@thinkology.org> a écrit :
>>>
>>>   I'm not getting JSF tags rendered to HTML/XHTML. I'm using the SNAPSHOT.
>>>> I
>>>> notice the errors "INFO: faces config file is null" even though I have
>>>> the
>>>> file faces-config.xml in my WEB-INF folder from the root folder of my war
>>>> file.  The file contains:
>>>>
>>>> <?xml version='1.0' encoding='UTF-8'?>
>>>>
>>>> <faces-config version="2.1"
>>>>       xmlns="http://java.sun.com/****xml/ns/javaee<http://java.sun.com/**xml/ns/javaee>
>>>> <http://java.sun.**com/xml/ns/javaee <http://java.sun.com/xml/ns/javaee>
>>>> "
>>>>       xmlns:xsi="http://www.w3.org/****2001/XMLSchema-instance<http://www.w3.org/**2001/XMLSchema-instance>
>>>> <http:**//www.w3.org/2001/XMLSchema-**instance<http://www.w3.org/2001/XMLSchema-instance>
>>>> "
>>>>       xsi:schemaLocation="http://**j**ava.sun.com/xml/ns/javaee<http://java.sun.com/xml/ns/javaee>
>>>> <http**://java.sun.com/xml/ns/javaee <http://java.sun.com/xml/ns/javaee>
>>>> http://java.sun.com/xml/ns/****javaee/web-facesconfig_2_1.xsd<http://java.sun.com/xml/ns/**javaee/web-facesconfig_2_1.xsd>
>>>> **<http://java.sun.com/xml/ns/**javaee/web-facesconfig_2_1.xsd<http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd>
>>>> **>
>>>> **">
>>>>       <application>
>>>>           <resource-bundle>
>>>>               <base-name>/Bundle</base-name>
>>>>               <var>bundle</var>
>>>>           </resource-bundle>
>>>>       </application>
>>>> </faces-config>
>>>>
>>>> But then later on it seems to load it as viewable in the attached log
>>>> file, but then just after that it repeats the above errors again.
>>>>
>>>> Then I have the errors:  "WARNING: No mappings of FacesServlet found.
>>>> Abort destroy MyFaces."
>>>>
>>>> But present in my web.xml file is:
>>>>
>>>>       <context-param>
>>>> <param-name>javax.faces.****PROJECT_STAGE</param-name>
>>>>           <param-value>Development</****param-value>
>>>>       </context-param>
>>>>       <servlet>
>>>>           <servlet-name>Faces Servlet</servlet-name>
>>>> <servlet-class>javax.faces.****webapp.FacesServlet</servlet-****class>
>>>>           <load-on-startup>1</load-on-****startup>
>>>>       </servlet>
>>>>       <servlet-mapping>
>>>>           <servlet-name>Faces Servlet</servlet-name>
>>>>           <url-pattern>/faces/*</url-****pattern>
>>>>       </servlet-mapping>
>>>>
>>>> Attached the log output.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>


Re: Myfaces errors / FacesContext not found

Posted by Vishwanath Krishnamurthi <to...@gmail.com>.
Hi David,

We have about three examples on JSF. Could you compare against it to see
what might be wrong ?

https://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/jsf-managedBean-and-ejb
or a similar one -
https://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/jsf-cdi-and-ejb

Had updated them only recently and they work on the current snapshot.

For the current error that you have - "org.apache.jasper.**JasperException:
java.lang.RuntimeException: FacesContext not found"
it might be that the page you accessed was not routed via the FacesServlet.
Could you double check the url-patterns added in the web.xml and the
address by which you are accessing the page.

Also check if your page does not mix xhtml content and jsp  specfic content
(like page directives / taglib directives)  ?

A few things that may not be related to this error - but worth checking:

Ensure that you don't bundle jsf related jars
i.e these are in provided scope

 <dependency>
      <groupId>org.apache.myfaces.core</groupId>
      <artifactId>myfaces-api</artifactId>
      <version>2.1.8</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.myfaces.core</groupId>
      <artifactId>myfaces-impl</artifactId>
      <version>2.1.8</version>
      <scope>provided</scope>
    </dependency>


web.xml header is not in the old 2.4

You shouldn't be requiring a StartupServletContextPluginCha**inLoader or
have to worry about the standard-faces-**config.xml

-Vishwa

On Sun, Aug 26, 2012 at 11:20 PM, David Nordahl <da...@thinkology.org>wrote:

> I regenerated my project files without any xhtml files to remove that
> variable.
>
> I've been trying to follow the guidelines at: http://myfaces.apache.org/**
> extensions/scripting/**exampleconfig.html<http://myfaces.apache.org/extensions/scripting/exampleconfig.html>
>
> and am still having issues.  Is there a better documentation/configuration
> checklist I should follow?
>
> I notice that it has an extra entry for a project's web.xml:
>
>     <context-param>
>         <description>
>             Initializes the plugins for our scripting support
>         </description>
> <param-name>org.apache.**myfaces.FACES_INIT_PLUGINS</**param-name>
> <param-value>org.apache.**myfaces.extensions.scripting.**servlet.**
> StartupServletContextPluginCha**inLoader</param-value>
>     </context-param>
>
> But I don't see any StartupServletContextPluginCha**inLoader anywhere in
> the my-faces library files included with TomEE or even in the current
> myfaces download itself and I get an ClassNotFound exception if I try to
> include this entry.
>
> I notice in the TomEE logs it mentions a WEB-INF/faces-config.xml which I
> have defined, but also a
> META-INF/standard-faces-**config.xml  Perhaps this is required also?
>
> Currently when I try to load my jsp test page, I get:
>
> org.apache.jasper.**JasperException: java.lang.RuntimeException:
> FacesContext not found
>
>
>
> On 08/26/2012 12:54 PM, Romain Manni-Bucau wrote:
>
>> Xhtml is not the default extension,
>>
>> Maybe redefine it
>> Le 26 août 2012 19:53, "David Nordahl" <da...@thinkology.org> a écrit :
>>
>>  I'm not getting JSF tags rendered to HTML/XHTML. I'm using the SNAPSHOT.
>>> I
>>> notice the errors "INFO: faces config file is null" even though I have
>>> the
>>> file faces-config.xml in my WEB-INF folder from the root folder of my war
>>> file.  The file contains:
>>>
>>> <?xml version='1.0' encoding='UTF-8'?>
>>>
>>> <faces-config version="2.1"
>>>      xmlns="http://java.sun.com/****xml/ns/javaee<http://java.sun.com/**xml/ns/javaee>
>>> <http://java.sun.**com/xml/ns/javaee <http://java.sun.com/xml/ns/javaee>
>>> >
>>> "
>>>      xmlns:xsi="http://www.w3.org/****2001/XMLSchema-instance<http://www.w3.org/**2001/XMLSchema-instance>
>>> <http:**//www.w3.org/2001/XMLSchema-**instance<http://www.w3.org/2001/XMLSchema-instance>
>>> >
>>> "
>>>      xsi:schemaLocation="http://**j**ava.sun.com/xml/ns/javaee<http://java.sun.com/xml/ns/javaee>
>>> <http**://java.sun.com/xml/ns/javaee <http://java.sun.com/xml/ns/javaee>
>>> >
>>> http://java.sun.com/xml/ns/****javaee/web-facesconfig_2_1.xsd<http://java.sun.com/xml/ns/**javaee/web-facesconfig_2_1.xsd>
>>> **<http://java.sun.com/xml/ns/**javaee/web-facesconfig_2_1.xsd<http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd>
>>> **>
>>> **">
>>>      <application>
>>>          <resource-bundle>
>>>              <base-name>/Bundle</base-name>
>>>              <var>bundle</var>
>>>          </resource-bundle>
>>>      </application>
>>> </faces-config>
>>>
>>> But then later on it seems to load it as viewable in the attached log
>>> file, but then just after that it repeats the above errors again.
>>>
>>> Then I have the errors:  "WARNING: No mappings of FacesServlet found.
>>> Abort destroy MyFaces."
>>>
>>> But present in my web.xml file is:
>>>
>>>      <context-param>
>>> <param-name>javax.faces.****PROJECT_STAGE</param-name>
>>>          <param-value>Development</****param-value>
>>>      </context-param>
>>>      <servlet>
>>>          <servlet-name>Faces Servlet</servlet-name>
>>> <servlet-class>javax.faces.****webapp.FacesServlet</servlet-****class>
>>>          <load-on-startup>1</load-on-****startup>
>>>      </servlet>
>>>      <servlet-mapping>
>>>          <servlet-name>Faces Servlet</servlet-name>
>>>          <url-pattern>/faces/*</url-****pattern>
>>>      </servlet-mapping>
>>>
>>> Attached the log output.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>