[jboss-jira] [JBoss JIRA] (WFLY-11116) Wildfly 12.0.0 Final Delay in Getting the Value Attributes of the Session Variables (Result in Null Pointer Exception)

Paul Ferraro (Jira) issues at jboss.org
Fri May 17 07:55:00 EDT 2019


    [ https://issues.jboss.org/browse/WFLY-11116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13734860#comment-13734860 ] 

Paul Ferraro commented on WFLY-11116:
-------------------------------------

Using the default configuration, any changes to the HttpSession made during the a given request will be committed after the response is flushed.  So, in your example, these changes will not be visible to other threads until the commit is complete.  This is where REPEATABLE_READ isolation is important.  Any request for that same HttpSession will block until the previous commit completes.

Relaxing the isolation to READ_COMMITTED, would allow other threads to read the session before that commit completes, but these read wold be dirty.

Alternatively, you can disable cache transactions altogether, in which case, every write to the session will execute in a separate transaction.  This allows multiple threads to read and write to the session concurrently, using last write wins semantics.  It sounds like this better fits your application's expectations.

> Wildfly 12.0.0 Final Delay in Getting the Value Attributes of the Session Variables (Result in Null Pointer Exception)
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: WFLY-11116
>                 URL: https://issues.jboss.org/browse/WFLY-11116
>             Project: WildFly
>          Issue Type: Bug
>          Components: Clustering
>    Affects Versions: 14.0.1.Final, 12.0.0.Final, 13.0.0.Final, 15.0.0.Final
>            Reporter: ziad saade
>            Assignee: Paul Ferraro
>            Priority: Critical
>
> I have two Servlets Book and BookPreview the attribute is set in Book Servlet as follow:
>  
> Book.java
> TestBean testBean=null;
> if(session.getAttribute("testBean")!=null)
>      testBean = (TestBean)session.getAttribute("testBean");
> else{
>      testBean=new TestBean();
>      session.setAttribute("testBean",testBean);
> }
> testBean.setAmount("10");
>  
> response.sendRedirect("BookPreview");
>  
>  
> The session attribute can be retrieved and the page is loaded normally and the Amount value is displayed however when submitting the form (Post Action in BookPreview.java) Null Pointer exception is generated.
>  
> BookPreview.java
>  
> TestBean testBean = (TestBean)session.getAttribute("testBean");
> String amount = testBean.getAmount; //Null pointer exception when submitting the form
>  
> <form method="Post" action="BookPreview">
>  
> </form>
>  
> TestBean.java
>  
> public class TestBean implements java.io.Serializable {
>  
>      private static final long serialVersionUID = 1L;
>      private String amount;
>  
>      public String getAmount() {
>           return amount;
>      }
>  
>      public void setAmount(String amount) {
>           this.amount = amount;
>      }
> }
>  
> Kindly advice how to fix the problem at the level of the server configuration.
> PS: I am not getting the exception when deploying the same application under other J EE application servers (Tomcat....)
>  
> Thanks and Best Regards



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list