ER/Box powered by Compiere
 
Font size:      

Initial Client Setup with User System

Short Description Issue Type

Initial Client Setup not possible with Sytem User

Program logic

Target Database Type Release

Derby

erbox_253b-*

Description

When running the Initial Client Setup as user System the screen will hang and database timeout exceptions will be logged to the console.

The reason is that an (expected) exception gets thrown, but the log entry cannot be written due to a database deadlock.

Detail:

The problem occurs when the role of the new client user is added to the user who initiated the Initial Client Setup (System) in MRole.afterSave(...):

...
//  Add Role to SuperUser
MUserRoles su = new MUserRoles(getCtx(), SUPERUSER_USER_ID, getAD_Role_ID(), get_TrxName());
su.save();
//  Add Role to User
if (getCreatedBy() != SUPERUSER_USER_ID)
{
  MUserRoles ur = new MUserRoles(getCtx(), getCreatedBy(), getAD_Role_ID(), get_TrxName());
  ur.save();
}
...

From here the User ID for the MUserRole is set:

public MUserRoles (Properties ctx, int AD_User_ID, int AD_Role_ID, String trxName)
{
  this (ctx, 0, trxName);
  setAD_User_ID(AD_User_ID);
  setAD_Role_ID(AD_Role_ID);
} //  MUserRoles
             

The call to setAD_User_ID goes to the underlying class X_AD_User_Roles:

public void setAD_User_ID (int AD_User_ID)
{
if (AD_User_ID < 1) throw new IllegalArgumentException ("AD_User_ID is mandatory.");
set_ValueNoCheck ("AD_User_ID", new Integer(AD_User_ID));
}             

Since the the User ID of the System user is 0 the highlighted exceptions is thrown. This happens regardless of the target database type.

When the exception is caught a MIssue entry is created in CLogErrorBuffer.publish(...):

...
if (DB.isConnected() 
  && !methodName.equals("saveError")
  && !methodName.equals("get_Value")
  && !methodName.equals("dataSave")
  && loggerName.indexOf("Issue") == -1
  && loggerName.indexOf("CConnection") == -1
  )
{
  m_issueError = false;
  MIssue.create(record);
  m_issueError = true;
}
...

This does not work for Derby because of database tables being locked.

Solution

Run the Initial Client Setup as user SuperUser.