[
https://issues.apache.org/jira/browse/OFBIZ-4289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400154#comment-13400154
]
Jacopo Cappellato commented on OFBIZ-4289:
------------------------------------------
Jacques, am I wrong orin this last patch the meaning of the
distributableApplication field is completely inverted?
I also still see the pattern:
{code}if (!variable) {//false} else {//true}{code}
rather than the easier to read:
{code}if (variable) {//true} else {//false}{code}
Also, but this is a minor note, when I suggested to group together all the code
related to distributable apple I was thinking to refactor the code in this way:
{code}
Security security = null;
try {
security = SecurityFactory.getInstance(delegator);
session.setAttribute("security", security);
} catch (SecurityConfigurationException e) {
Debug.logError(e, module);
}
Authorization authz = null;
try {
authz = AuthorizationFactory.getInstance(delegator);
session.setAttribute("authz", authz);
} catch (SecurityConfigurationException e) {
Debug.logError(e, module);
}
// set all request attributes here:
request.setAttribute("dispatcher", dispatcher);
request.setAttribute("delegator", delegator);
request.setAttribute("security", security);
request.setAttribute("authz", authz);
// set all session attributes here:
if (distributableApplication) {
// these attributes are nulled here because they are not
serializable and then recreated when the session is deserialized
session.setAttribute("dispatcher", null);
session.setAttribute("delegator", null);
session.setAttribute("security", null);
session.setAttribute("authz", null);
} else {
session.setAttribute("dispatcher", dispatcher);
session.setAttribute("delegator", delegator);
session.setAttribute("security", security);
session.setAttribute("authz", authz);
}
{code}
But yeah, all these code may be ignored if you find a mechanism to remove/add
before/after serialization/deserialization these objects: this would be the
right way to fix the issue.
> Login out on a cluster handled by DeltaManager causes a NPE
> -----------------------------------------------------------
>
> Key: OFBIZ-4289
> URL: https://issues.apache.org/jira/browse/OFBIZ-4289
> Project: OFBiz
> Issue Type: Bug
> Components: framework
> Affects Versions: Release Branch 4.0, Release Branch 09.04, Release Branch
> 10.04, Release Branch 11.04, SVN trunk
> Environment: Ubuntu
> Reporter: Jacques Le Roux
> Assignee: Jacques Le Roux
> Priority: Critical
> Labels: cluster, logout
> Fix For: Release Branch 10.04, Release Branch 11.04, SVN trunk
>
> Attachments: OFBIZ-4289_Login_out_on_a
> cluster_handled_by_DeltaManager_causes_a_NPE.patch, OFBIZ-4289_Login_out_on_a
> cluster_handled_by_DeltaManager_causes_a_NPE.patch, OFBIZ-4289_Login_out_on_a
> cluster_handled_by_DeltaManager_causes_a_NPE.patch, OFBIZ-4289_Login_out_on_a
> cluster_handled_by_DeltaManager_causes_a_NPE.patch, OFBIZ-4289_Login_out_on_a
> cluster_handled_by_DeltaManager_causes_a_NPE.patch, OFBIZ-4289_Login_out_on_a
> cluster_handled_by_DeltaManager_causes_a_NPE.patch, changeset_2510.diff
>
>
> It works locally but not on clusters. You simply get a NPE.
> h3. Problem
> * When we logout we cross an issue due to Tomcat sessions persistence.
> * Because we set distributable to true, to allow sessions failover,
> * and use and DeltaManager for replication.
> * Delegator and other main Classes (notably Dispatcher) are not
> serialized in OFBiz. This is the origin of the problem
> h3. Tried solutions
> By default DeltaManager save active sessions on disk. It uses a private
> String variable pathname for that (default to "SESSIONS.ser"). You can set it
> to null, to avoid session persistence, using a context.xml file in the
> WEB-INF folder with content like below. But I tried it in webtools app on
> staging qs001 (only) and it did not work (with distributable set to false).
> And we have no other means to set it from OFBiz (OOTB).
> {code}
> <Context>
> <Manager className="org.apache.catalina.session.DeltatManager"
> pathname="">
> </Manager>
> </Context>
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira