Thousands of guest users are created without associated orders

Technote (FAQ)


Question

Why are there thousands of guest users being created when no associated orders exist?

Answer

There are multiple types of users in WebSphere Commerce. They are generic, guest, and registered users. The generic user (-1002) is a common user that is used for operations that are not specific to a particular member. For example, for operations such as displaying a category or product, the user is allowed to execute the commands using the generic user id, minimizing resource usage.

If your database is being populated with users which have no associated orders, it is possible that the catalog pages (such as CategoryDisplay and ProductDisplay) are forcing the creation of new ids as users navigate the site.

The creation of new guest users is controlled by the isGeneric method of the ControllerCommand interface. This method returns a Boolean value which specifies whether or not the command can be invoked by the generic user. By default, this method returns a value of false.
That is, the invoker must be either a registered customer or a guest customer.

If your new controller command can be invoked by generic users or does not fetch or create resources associated with a user, you should override this method to return a value of true.

An example of a command that can be invoked by a generic user (isGeneric = true) is the ProductDisplay command, since it is not necessary to create a new user object for browsing. An example of a command for which a user must be either a guest or registered user (isGeneric = false) is the OrderItemAdd command.

The following is an example of a custom controller command that overrides the isGeneric() method to allow the execution of the command by generic users:

public class GetProductReviewsCmdImpl extends ControllerCommandImpl implements GetProductReviewsCmd
{
public void performExecute() throws ECException {
doSomething();
}

public boolean isGeneric() {
//This command can be run by a generic user
return true;
}
}

Using trace to verify if a command requires a new user to be created:

You can use WC_SERVER tracing to locate the commands that are forcing the creation of new users. For details on how to enable trace, refer to the configuring logging document in the Information Center. Once you have collected the trace, search for the statement "create anonymous User". At this statement, WebSphere Commerce is creating a new user:

[8/26/08 9:44:58:969 EDT] 0000004a WC_SERVER 3 Vmkrkk8SUOeOPRodgi%2fE4j6fukA%3d%0d%0a CommandHelper.negotiateUserId(boolean, Long) create anonymous User

Using the thread id for this statement, you can then search upwards in the trace for the statement "executeCommand". This reveals the command name that forced the creation of the new user.

[8/26/08 9:44:58:969 EDT] 0000004a WC_SERVER 3 Vmkrkk8SUOeOPRodgi%2fE4j6fukA%3d%0d%0a com.ibm.commerce.webcontroller.WebControllerHelper.executeCommand(ViewCommandContext,Map,String) invokeCommand com.companyxyz.browse.GetProductsReviewsCmd


Cross Reference information
Segment Product Component Platform Version Edition
Commerce WebSphere Commerce Professional Edition Customization / Application Development AIX, i5/OS, Linux, Solaris, Windows 6.0
Commerce WebSphere Commerce - Express Customization / Application Development i5/OS, Linux, Windows 6.0

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

WebSphere Commerce Enterprise
Customization / Application Development

Software version:

6.0

Operating system(s):

AIX, Linux, Solaris, Windows, i5/OS

Software edition:

All Editions

Reference #:

1316161

Modified date:

2008-09-15

Translate my page

Machine Translation

Content navigation