You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by jacobpan <ja...@gmail.com> on 2012/03/08 16:36:20 UTC

tomahawk t:saveState and HTTPSession

Hello,

I have added tomahawk t:saveState into my JSF code having page scope set as
request.

After adding tomahawk t:saveState I am getting error with HTTPSession 
like I am getting error with the following line

session = (HttpSession)context.getExternalContext().getSession(false);

What could be the reason for this?

Any help is highly appreciated.
-- 
View this message in context: http://old.nabble.com/tomahawk-t%3AsaveState-and-HTTPSession-tp33465710p33465710.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: tomahawk t:saveState and HTTPSession

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

The report doesn't sounds like something related to tomahawk t:saveState.
Are you invalidating the session (logout or something like that)? If the session
is invalidated and then it is manipulated, an IllegalStateException
could happen.
In that case, a redirect could solve the problem.

regards,

Leonardo Uribe

2012/3/8 Anton Gavazuk <an...@gmail.com>:
> Hi Jacob,
>
> I dont know if tomahawk is compatible with your version, even more - I dont
> know if this combination works fine in OC4J container which you are using -
> its something that you need to verify.
>
> Why do you need to get access to session in getter method? what are you
> looking for in session and what makes you think that saveState component is
> root cause of the issue?
>
> Thanks,
> Anton
>
> 2012/3/8 jacobpan <ja...@gmail.com>
>
>>
>> External content is used to make the session available like the following:
>>  session = (HttpSession)context.getExternalContext().getSession(false);
>>
>> I have added all extensions in web.xml, copied from myfaces site. My
>> web.xml
>> is pasted below.
>> My Tomahawk version is tomahawk-1.1.11 I guess it is compatible with JSF
>> 1.1, correct me if I am wrong.
>>
>> Web.xml
>>
>> <?xml version = '1.0' encoding = 'windows-1252'?>
>> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
>> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"
>> xmlns="http://java.sun.com/xml/ns/j2ee">
>>    <description>Empty web.xml file for Web Application</description>
>>    <filter>
>>        <filter-name>extensionsFilter</filter-name>
>>        <filter-class>
>> org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
>>        <init-param>
>>            <description>Set the size limit for uploaded files. Format: 10 -
>> 10 bytes 10k - 10
>>                KB 10m - 10 MB 1g - 1 GB
>>            </description>
>>            <param-name>uploadMaxFileSize</param-name>
>>            <param-value>100m</param-value>
>>        </init-param>
>>        <init-param>
>>            <description>Set the threshold size - files below this limit are
>> stored in
>>                memory, files above this limit are stored on disk. Format:
>> 10 - 10 bytes 10k -
>>                10 KB 10m - 10 MB 1g - 1 GB
>>            </description>
>>            <param-name>uploadThresholdSize</param-name>
>>            <param-value>100k</param-value>
>>        </init-param>
>>    </filter>
>>    <filter-mapping>
>>        <filter-name>extensionsFilter</filter-name>
>>        <url-pattern>*.jsf</url-pattern>
>>    </filter-mapping>
>>    <filter-mapping>
>>        <filter-name>extensionsFilter</filter-name>
>>        <url-pattern>/faces/*</url-pattern>
>>    </filter-mapping>
>>    <filter-mapping>
>>            <filter-name>extensionsFilter</filter-name>
>>            <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
>>    </filter-mapping>
>>    <context-param>
>>        <param-name>org.apache.myfaces.redirectTracker.POLICY</param-name>
>>
>>
>> <param-value>org.apache.myfaces.custom.redirectTracker.policy.FullRedirectTrackPolicy</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>
>>        <servlet-name>Login</servlet-name>
>>        <servlet-class>vms_proj.Login</servlet-class>
>>    </servlet>
>>    <servlet-mapping>
>>        <servlet-name>Faces Servlet</servlet-name>
>>        <url-pattern>/faces/*</url-pattern>
>>    </servlet-mapping>
>>    <servlet-mapping>
>>        <servlet-name>Login</servlet-name>
>>        <url-pattern>/login</url-pattern>
>>    </servlet-mapping>
>>    <session-config>
>>        <session-timeout>35</session-timeout>
>>    </session-config>
>>    <mime-mapping>
>>        <extension>html</extension>
>>        <mime-type>text/html</mime-type>
>>    </mime-mapping>
>>    <mime-mapping>
>>        <extension>txt</extension>
>>        <mime-type>text/plain</mime-type>
>>    </mime-mapping>
>>    <welcome-file-list>
>>        <welcome-file>index.html</welcome-file>
>>    </welcome-file-list>
>>    <jsp-config/>
>> </web-app>
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/tomahawk-t%3AsaveState-and-HTTPSession-tp33465710p33466274.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>

Re: tomahawk t:saveState and HTTPSession

Posted by Anton Gavazuk <an...@gmail.com>.
Hi Jacob,

I dont know if tomahawk is compatible with your version, even more - I dont
know if this combination works fine in OC4J container which you are using -
its something that you need to verify.

Why do you need to get access to session in getter method? what are you
looking for in session and what makes you think that saveState component is
root cause of the issue?

Thanks,
Anton

2012/3/8 jacobpan <ja...@gmail.com>

>
> External content is used to make the session available like the following:
>  session = (HttpSession)context.getExternalContext().getSession(false);
>
> I have added all extensions in web.xml, copied from myfaces site. My
> web.xml
> is pasted below.
> My Tomahawk version is tomahawk-1.1.11 I guess it is compatible with JSF
> 1.1, correct me if I am wrong.
>
> Web.xml
>
> <?xml version = '1.0' encoding = 'windows-1252'?>
> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"
> xmlns="http://java.sun.com/xml/ns/j2ee">
>    <description>Empty web.xml file for Web Application</description>
>    <filter>
>        <filter-name>extensionsFilter</filter-name>
>        <filter-class>
> org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
>        <init-param>
>            <description>Set the size limit for uploaded files. Format: 10 -
> 10 bytes 10k - 10
>                KB 10m - 10 MB 1g - 1 GB
>            </description>
>            <param-name>uploadMaxFileSize</param-name>
>            <param-value>100m</param-value>
>        </init-param>
>        <init-param>
>            <description>Set the threshold size - files below this limit are
> stored in
>                memory, files above this limit are stored on disk. Format:
> 10 - 10 bytes 10k -
>                10 KB 10m - 10 MB 1g - 1 GB
>            </description>
>            <param-name>uploadThresholdSize</param-name>
>            <param-value>100k</param-value>
>        </init-param>
>    </filter>
>    <filter-mapping>
>        <filter-name>extensionsFilter</filter-name>
>        <url-pattern>*.jsf</url-pattern>
>    </filter-mapping>
>    <filter-mapping>
>        <filter-name>extensionsFilter</filter-name>
>        <url-pattern>/faces/*</url-pattern>
>    </filter-mapping>
>    <filter-mapping>
>            <filter-name>extensionsFilter</filter-name>
>            <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
>    </filter-mapping>
>    <context-param>
>        <param-name>org.apache.myfaces.redirectTracker.POLICY</param-name>
>
>
> <param-value>org.apache.myfaces.custom.redirectTracker.policy.FullRedirectTrackPolicy</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>
>        <servlet-name>Login</servlet-name>
>        <servlet-class>vms_proj.Login</servlet-class>
>    </servlet>
>    <servlet-mapping>
>        <servlet-name>Faces Servlet</servlet-name>
>        <url-pattern>/faces/*</url-pattern>
>    </servlet-mapping>
>    <servlet-mapping>
>        <servlet-name>Login</servlet-name>
>        <url-pattern>/login</url-pattern>
>    </servlet-mapping>
>    <session-config>
>        <session-timeout>35</session-timeout>
>    </session-config>
>    <mime-mapping>
>        <extension>html</extension>
>        <mime-type>text/html</mime-type>
>    </mime-mapping>
>    <mime-mapping>
>        <extension>txt</extension>
>        <mime-type>text/plain</mime-type>
>    </mime-mapping>
>    <welcome-file-list>
>        <welcome-file>index.html</welcome-file>
>    </welcome-file-list>
>    <jsp-config/>
> </web-app>
>
>
> --
> View this message in context:
> http://old.nabble.com/tomahawk-t%3AsaveState-and-HTTPSession-tp33465710p33466274.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: tomahawk t:saveState and HTTPSession

Posted by jacobpan <ja...@gmail.com>.
External content is used to make the session available like the following:
 session = (HttpSession)context.getExternalContext().getSession(false);

I have added all extensions in web.xml, copied from myfaces site. My web.xml
is pasted below.
My Tomahawk version is tomahawk-1.1.11 I guess it is compatible with JSF
1.1, correct me if I am wrong.

Web.xml

<?xml version = '1.0' encoding = 'windows-1252'?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee">
    <description>Empty web.xml file for Web Application</description>
    <filter>  
        <filter-name>extensionsFilter</filter-name>  
        <filter-class>
org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>  
        <init-param>  
            <description>Set the size limit for uploaded files. Format: 10 -
10 bytes 10k - 10  
                KB 10m - 10 MB 1g - 1 GB  
            </description>  
            <param-name>uploadMaxFileSize</param-name>  
            <param-value>100m</param-value>  
        </init-param>  
        <init-param>               
            <description>Set the threshold size - files below this limit are
stored in  
                memory, files above this limit are stored on disk. Format:
10 - 10 bytes 10k -  
                10 KB 10m - 10 MB 1g - 1 GB  
            </description>  
            <param-name>uploadThresholdSize</param-name>  
            <param-value>100k</param-value>  
        </init-param>  
    </filter>       
    <filter-mapping>  
        <filter-name>extensionsFilter</filter-name>  
        <url-pattern>*.jsf</url-pattern>  
    </filter-mapping>       
    <filter-mapping>  
        <filter-name>extensionsFilter</filter-name>  
        <url-pattern>/faces/*</url-pattern>  
    </filter-mapping>       
    <filter-mapping>  
            <filter-name>extensionsFilter</filter-name>  
            <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>  
    </filter-mapping>  
    <context-param>
        <param-name>org.apache.myfaces.redirectTracker.POLICY</param-name>
       
<param-value>org.apache.myfaces.custom.redirectTracker.policy.FullRedirectTrackPolicy</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>
        <servlet-name>Login</servlet-name>
        <servlet-class>vms_proj.Login</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Login</servlet-name>
        <url-pattern>/login</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>35</session-timeout>
    </session-config>
    <mime-mapping>
        <extension>html</extension>
        <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>txt</extension>
        <mime-type>text/plain</mime-type>
    </mime-mapping>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    <jsp-config/>
</web-app>


-- 
View this message in context: http://old.nabble.com/tomahawk-t%3AsaveState-and-HTTPSession-tp33465710p33466274.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: tomahawk t:saveState and HTTPSession

Posted by Anton Gavazuk <an...@gmail.com>.
So you are using JSF RI 1.1 - can you verify that your tomahawk library is
compatible with JSF RI 1.1? Can you also verify that you have configured
all extensions in right way in web.xml? Also why do you call external
context in the  getSelectItemsVehicleSuppliers ?

2012/3/8 jacobpan <ja...@gmail.com>

>
> My JSF version 1.1 and I am running on Jdeveloper embedded OC4J 10.1.3
> version.
>
> Exception pasted below.
>
> Caused by: java.lang.IllegalStateException
>        at
>
> com.sun.faces.context.FacesContextImpl.assertNotReleased(FacesContextImpl.java:421)
>        at
>
> com.sun.faces.context.FacesContextImpl.getExternalContext(FacesContextImpl.java:136)
>        at ManagedBean.getSelectItemsVehicleSuppliers(ManagedBean.java:828)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at
>
> com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:99)
>
> 2012-03-08 19:02:59,556 ERROR
> (com.sun.faces.lifecycle.ProcessValidationsPhase;103)
> javax.faces.el.EvaluationException: Error getting property
> 'selectItemsVehicleSuppliers' from bean of type ManagedBean:
> java.lang.IllegalStateException
> javax.faces.el.EvaluationException: javax.faces.el.EvaluationException:
> Error getting property 'selectItemsSuppliers' from bean of type
> ManagedBean:
> java.lang.IllegalStateException
>        at
> com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:190)
>        at
> com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:143)
>        at
> javax.faces.component.UISelectItems.getValue(UISelectItems.java:110)
>        at
>
> javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:116)
>
>
> --
> View this message in context:
> http://old.nabble.com/tomahawk-t%3AsaveState-and-HTTPSession-tp33465710p33465970.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: tomahawk t:saveState and HTTPSession

Posted by jacobpan <ja...@gmail.com>.
My JSF version 1.1 and I am running on Jdeveloper embedded OC4J 10.1.3
version.

Exception pasted below.

Caused by: java.lang.IllegalStateException
	at
com.sun.faces.context.FacesContextImpl.assertNotReleased(FacesContextImpl.java:421)
	at
com.sun.faces.context.FacesContextImpl.getExternalContext(FacesContextImpl.java:136)
	at ManagedBean.getSelectItemsVehicleSuppliers(ManagedBean.java:828)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at
com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:99)

2012-03-08 19:02:59,556 ERROR
(com.sun.faces.lifecycle.ProcessValidationsPhase;103)
javax.faces.el.EvaluationException: Error getting property
'selectItemsVehicleSuppliers' from bean of type ManagedBean:
java.lang.IllegalStateException
javax.faces.el.EvaluationException: javax.faces.el.EvaluationException:
Error getting property 'selectItemsSuppliers' from bean of type ManagedBean:
java.lang.IllegalStateException
	at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:190)
	at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:143)
	at javax.faces.component.UISelectItems.getValue(UISelectItems.java:110)
	at
javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:116)


-- 
View this message in context: http://old.nabble.com/tomahawk-t%3AsaveState-and-HTTPSession-tp33465710p33465970.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: tomahawk t:saveState and HTTPSession

Posted by Anton Gavazuk <an...@gmail.com>.
Hi Jacob,

can you show the exception and specify your environment details (version of
JSF, container...)

2012/3/8 jacobpan <ja...@gmail.com>

>
> Hello,
>
> I have added tomahawk t:saveState into my JSF code having page scope set as
> request.
>
> After adding tomahawk t:saveState I am getting error with HTTPSession
> like I am getting error with the following line
>
> session = (HttpSession)context.getExternalContext().getSession(false);
>
> What could be the reason for this?
>
> Any help is highly appreciated.
> --
> View this message in context:
> http://old.nabble.com/tomahawk-t%3AsaveState-and-HTTPSession-tp33465710p33465710.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>