-
1. Re: Wildfly 12.0.0 Final Delay in Getting the Value Attributes of the Session Variables (Result in Null Pointer Exception)
pferraro Jul 28, 2018 4:06 PM (in response to zidoff)I need more context to be able to help. Where is this attribute set? i.e. where is the call to session.setAttribute("testBean", ...);
What type of object is TestBean? e.g. EJB, CDI bean, POJO, etc.
-
2. Re: Wildfly 12.0.0 Final Delay in Getting the Value Attributes of the Session Variables (Result in Null Pointer Exception)
zidoff Jul 31, 2018 4:34 AM (in response to pferraro)Hi Paul
Thanks for your reply
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 BookPreview.java) the 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;
}
}
if you need further details don't hesitate to contact me.
Thanks and Best Regards
-
3. Re: Wildfly 12.0.0 Final Delay in Getting the Value Attributes of the Session Variables (Result in Null Pointer Exception)
pferraro Jul 31, 2018 1:22 PM (in response to zidoff)I assume this a distributable web application? If so, can you paste your "web" cache-container configuration from the Infinispan subsystem, along with any jboss-web.xml customizations?
-
4. Re: Wildfly 12.0.0 Final Delay in Getting the Value Attributes of the Session Variables (Result in Null Pointer Exception)
zidoff Aug 1, 2018 3:19 AM (in response to pferraro)Hi Paul
Yes this is a distributed web application (EAR,WAR), but he process in question is being executed inside the same war no interaction with any other layer. I'm using the default cache-container configurations (no changes in the standalone-ha.xml or in the standalone-full-ha.xml files) and I don't have any jboss-web.xml file (neither in the deployment files nor in the Server Wildfly 12.0.0 Final).
Best Regards
-
5. Re: Wildfly 12.0.0 Final Delay in Getting the Value Attributes of the Session Variables (Result in Null Pointer Exception)
pferraro Aug 1, 2018 8:42 AM (in response to zidoff)That's puzzling. The behavior you've described sounds like the transaction isolation was lowered from REPEATABLE_READ to READ_COMMITTED. Otherwise, the subsequent session read (from your redirect) should block until previous request has completed. Can you verify whether this is the case?
I suggest modifying your default cache configuration within the "web" subsystem of the Infinispan subsystem to disable txs.
e.g.
<distributed-cache name="dist">
<file-store/>
</distributed-cache>
-
6. Re: Wildfly 12.0.0 Final Delay in Getting the Value Attributes of the Session Variables (Result in Null Pointer Exception)
zidoff Aug 2, 2018 1:01 PM (in response to pferraro)Dear Paul
While debugging the code the Session variable is always filled with the value until the post action is triggered, Note that I did the requested cache configurations under:
- standalone\configuration\standalone-full-ha.xml
- standalone\configuration\standalone-ha.xml
and the issue still reproducible.
Note the the issue is not always reproducible, most of the time it's reproducible. (Strange Behavior)
thanks and best regards
-
7. Re: Wildfly 12.0.0 Final Delay in Getting the Value Attributes of the Session Variables (Result in Null Pointer Exception)
pferraro Aug 3, 2018 6:59 AM (in response to zidoff)Why you are modify both the "ha" and "full-ha" profiles.? Which server profile are you actually using?
-
8. Re: Wildfly 12.0.0 Final Delay in Getting the Value Attributes of the Session Variables (Result in Null Pointer Exception)
zidoff Aug 3, 2018 7:48 AM (in response to pferraro)Sorry for the inconvenience, I'm running the standalone.xml Profile. and it contains the below tags, Advice about the exact configuration:
<subsystem xmlns="urn:jboss:domain:infinispan:5.0">
<cache-container name="server" default-cache="default" module="org.wildfly.clustering.server">
<local-cache name="default">
<transaction mode="BATCH"/>
</local-cache>
</cache-container>
<cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan">
<local-cache name="passivation">
<locking isolation="REPEATABLE_READ"/>
<transaction mode="BATCH"/>
<file-store passivation="true" purge="false"/>
</local-cache>
</cache-container>
<cache-container name="ejb" aliases="sfsb" default-cache="passivation" module="org.wildfly.clustering.ejb.infinispan">
<local-cache name="passivation">
<locking isolation="REPEATABLE_READ"/>
<transaction mode="BATCH"/>
<file-store passivation="true" purge="false"/>
</local-cache>
</cache-container>
<cache-container name="hibernate" module="org.infinispan.hibernate-cache">
<local-cache name="entity">
<transaction mode="NON_XA"/>
<object-memory size="10000"/>
<expiration max-idle="100000"/>
</local-cache>
<local-cache name="local-query">
<object-memory size="10000"/>
<expiration max-idle="100000"/>
</local-cache>
<local-cache name="timestamps"/>
</cache-container>
</subsystem>
Best Regards
-
9. Re: Wildfly 12.0.0 Final Delay in Getting the Value Attributes of the Session Variables (Result in Null Pointer Exception)
pferraro Aug 3, 2018 10:52 AM (in response to zidoff)That configuration should not allow any stale reads like those you've described.
However, I suggest the following configuration for your web cache-container:
<cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan">
<local-cache name="passivation">
<file-store passivation="true" purge="false"/>
</local-cache>
</cache-container>
-
10. Re: Wildfly 12.0.0 Final Delay in Getting the Value Attributes of the Session Variables (Result in Null Pointer Exception)
zidoff Aug 6, 2018 5:35 AM (in response to pferraro)Hi Paul
I did the requested configuration however the issue still reproduced, I will test the issue under Wildfly 13.0.0 Final and I will let you know the result:
If you still have other suggestions please let me know
Thanks and Best Regards
-
11. Re: Wildfly 12.0.0 Final Delay in Getting the Value Attributes of the Session Variables (Result in Null Pointer Exception)
zidoff Sep 28, 2018 4:53 AM (in response to zidoff)Hi Paul
Note that the issue is reproduced under Wildfly 13.0.0 Final
Kindly advice is you still have any Configuration suggestions to fix the problem.
Best Regards
-
12. Re: Wildfly 12.0.0 Final Delay in Getting the Value Attributes of the Session Variables (Result in Null Pointer Exception)
pferraro Sep 28, 2018 5:02 PM (in response to zidoff)zidoff Something isn't right. I've tried to reproduce your issue locally using the same code, but do not see the NPE using the default standalone.xml.
Therefore, I suspect something is wrong with your configuration. Please post the results of the following management operation via the CLI:
/subsystem=infinispan/cache-container=web:read-resource(recursive=true)
-
13. Re: Wildfly 12.0.0 Final Delay in Getting the Value Attributes of the Session Variables (Result in Null Pointer Exception)
zidoff Oct 1, 2018 9:55 AM (in response to pferraro)Dear Paul
Thanks for your reply
Find below the requested:
{
"outcome" => "success",
"result" => {
"aliases" => undefined,
"default-cache" => "passivation",
"eviction-executor" => undefined,
"jndi-name" => undefined,
"listener-executor" => undefined,
"module" => "org.wildfly.clustering.web.infinispan",
"replication-queue-executor" => undefined,
"start" => "LAZY",
"statistics-enabled" => false,
"distributed-cache" => undefined,
"invalidation-cache" => undefined,
"local-cache" => {"passivation" => {
"batching" => false,
"indexing" => "NONE",
"indexing-properties" => undefined,
"jndi-name" => undefined,
"module" => undefined,
"start" => "LAZY",
"statistics-enabled" => false,
"component" => {
"locking" => {
"acquire-timeout" => 15000L,
"concurrency-level" => 1000,
"isolation" => "REPEATABLE_READ",
"striping" => false
},
"transaction" => {
"locking" => "PESSIMISTIC",
"mode" => "BATCH",
"stop-timeout" => 10000L
},
"expiration" => {
"interval" => 60000L,
"lifespan" => -1L,
"max-idle" => -1L
}
},
"memory" => {"object" => {
"max-entries" => -1L,
"size" => -1L,
"strategy" => "NONE"
}},
"store" => {"file" => {
"fetch-state" => true,
"max-batch-size" => 100,
"passivation" => true,
"path" => undefined,
"preload" => false,
"properties" => undefined,
"purge" => false,
"relative-to" => "jboss.server.data.dir",
"shared" => false,
"singleton" => false,
"property" => undefined,
"write" => {"through" => {}}
}}
}},
"replicated-cache" => undefined,
"thread-pool" => {
"async-operations" => {
"keepalive-time" => 60000L,
"max-threads" => 25,
"min-threads" => 25,
"queue-length" => 1000
},
"expiration" => {
"keepalive-time" => 60000L,
"max-threads" => 1
},
"listener" => {
"keepalive-time" => 60000L,
"max-threads" => 1,
"min-threads" => 1,
"queue-length" => 100000
},
"persistence" => {
"keepalive-time" => 60000L,
"max-threads" => 4,
"min-threads" => 1,
"queue-length" => 0
},
"remote-command" => {
"keepalive-time" => 60000L,
"max-threads" => 200,
"min-threads" => 1,
"queue-length" => 0
},
"state-transfer" => {
"keepalive-time" => 60000L,
"max-threads" => 60,
"min-threads" => 1,
"queue-length" => 0
},
"transport" => {
"keepalive-time" => 60000L,
"max-threads" => 25,
"min-threads" => 25,
"queue-length" => 100000
}
},
"transport" => {"none" => {}}
}
}
Thanks and best Regards
-
14. Re: Wildfly 12.0.0 Final Delay in Getting the Value Attributes of the Session Variables (Result in Null Pointer Exception)
pferraro Oct 1, 2018 11:08 AM (in response to zidoff)I don't see any problem with your configuration. Have you tried reproducing the issue on the latest stable release, i.e. 14.0.1.Final?