Ben
Ben

Reputation: 10288

JSF 2 Session Beans Problems

I have a JSF 2.1 (MyFaces) app running using several Session Beans (All the beans are session beans). The timeout is defined in web.xml as such:

<session-config>
    <session-timeout>3600</session-timeout>
</session-config>

Which translates to 1 hour.

The problem is that on normal usage I get the No Saved View... exception:

SEVERE: An exception occurred
javax.faces.application.ViewExpiredException: /mainPanel.jsfNo saved view state could be found for the view identifier: /mainPanel.jsf
    at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:128)

The beans are, currently, defined in faces-config.xml for compatibility with Eclipse's ide.

I'm not sure what could be causing this and it's definitely not timeout. Any ideas what could be the problem?

If there is any further information I can provide, let me know..

Thanks!

P.S - there is no jsf-2.1 tag

Update 1 I just figured 60 meant 1 minute! :-) That could be the problem. I will close the question if it turns out that way

Update 2 Thats wasn't it... Some more information That might be helpful:

  1. While the error is specifically for /mainPanel.jsf, this is actually a composition of xhtml's using <ui:include>
  2. It happends only when I click one specific point in the app. The code that runs as a result of the click is:

Jquery Code:

    $(document).ready(function() {

    $("#someTable tr:not(:first)").click(function(event) {

            var someValue = $(this).find("input:hidden").val();
            $('#currently_selected').val(someValue );
            $('#currently_selected').change();

        });
    });

JSF 2 Code:

<h:form prependId="false" class="hide">
    <h:inputText value="#{someBean.someBeanValue}">
        <f:ajax event="change" listener="#{someBean.someBeanValueChanged}" render=":anotherForm"
            onevent="ifCompleteSetWindowHash" />
    </h:inputText>
</h:form>

Upvotes: 1

Views: 2402

Answers (2)

lu4242
lu4242

Reputation: 2318

At first view it seems to be some side effect over javax.faces.ViewState hidden field. If this field is ovewritten, a ViewExpiredException will be thrown. Try to do the same you are doing with other different javascript code.

Anyway it is not related to your session-config parameter. The information provided here is insuficient to reproduce it. If the previous suggestion does not solve your problem, please create an issue on MyFaces Issue Tracker and attach an example. In this way you'll get it solved.

Upvotes: 1

maple_shaft
maple_shaft

Reputation: 10463

I believe the $ symbol is a reserved character for EL expressions in JSF (EDIT: As noted below, the '$' alone is not reserved, however third party component libararies may use various javascript libraries that could have a naming conflict with jQuery). Try changing your jQuery function calls to the explicit long form name and see if that makes a difference.

Eg. Instead of...

$(document).ready(function() {

Do this...

jQuery(document).ready(function() {

Upvotes: 0

Related Questions