Topic
5 replies Latest Post - ‏2012-11-16T17:47:59Z by jpurdum
SystemAdmin
SystemAdmin
8614 Posts
ACCEPTED ANSWER

Pinned topic Create command issue

‏2012-11-07T20:24:01Z |
Hi all, I hope anyone can answer to this question. I'm working with WCS 7.0.0.5 Enterprise edition and I need to call a custom View and add another user while i am logged in as a register user. So i am using admin command to add the user. Request properties contains all the required parameters and when i didn't pass the requestProperties it will give the exception in validateParameters().
UserRegistrationAddCmd userRegistrationAdminAddCmd = (UserRegistrationAddCmd)CommandFactory.createCommand("com.ibm.commerce.usermanagement.commands.UserRegistrationAddCmd", storeId);
userRegistrationAdminAddCmd.setRequestProperties(requestProperties);
userRegistrationAdminAddCmd.setCommandContext(commandContext);
userRegistrationAdminAddCmd.execute();

But I get always a NullPointerExcpetion like this:

11/8/12 1:08:21:022 PST 00000193 CommerceSrvr E com.ibm.commerce.command.ECCommandTarget executeCommand CMN0420E: The following command exception has occurred during processing: "java.lang.NullPointerException". java.lang.NullPointerException
at com.ibm.commerce.command.AbstractECTargetableCommand.getStoreId(AbstractECTargetableCommand.java:294)
at com.ibm.commerce.usermanagement.commands.UserRegistrationCmdImpl.setRequestProperties(UserRegistrationCmdImpl.java:4895)
at com.veripos.commerce.usermanagement.commands.VeriposPartnerUserUpdateCmdImpl.performExecute(VeriposPartnerUserUpdateCmdImpl.java:21)
at com.ibm.commerce.command.ECCommandTarget.executeCommand(ECCommandTarget.java:157)
at com.ibm.websphere.command.TargetableCommandImpl.execute(TargetableCommandImpl.java:139)
at com.ibm.websphere.command.CacheableCommandImpl.execute(CacheableCommandImpl.java:138)
at com.ibm.commerce.command.AbstractECTargetableCommand.execute(AbstractECTargetableCommand.java:217)
at com.veripos.commerce.usermanagement.commands.VeriposPartnerUserAddCmdImpl.performExecute(VeriposPartnerUserAddCmdImpl.java:101)
at com.ibm.commerce.command.ECCommandTarget.executeCommand(ECCommandTarget.java:157)

Any idea?
Thanks a lot in advance

Ovais
Updated on 2012-11-16T17:47:59Z at 2012-11-16T17:47:59Z by jpurdum
  • Raj.S
    Raj.S
    513 Posts
    ACCEPTED ANSWER

    Re: Create command issue

    ‏2012-11-08T05:44:09Z  in response to SystemAdmin
    Is the storeId value NULL ?

    Regards,
    Raj
  • Sreejith.kanneri
    Sreejith.kanneri
    81 Posts
    ACCEPTED ANSWER

    Re: Create command issue

    ‏2012-11-08T05:44:15Z  in response to SystemAdmin
    try looking into your command context object ( "commandContext") and see if it has the storeid set properly
  • SystemAdmin
    SystemAdmin
    8614 Posts
    ACCEPTED ANSWER

    Re: Create command issue

    ‏2012-11-08T15:41:01Z  in response to SystemAdmin
    commandContext is not null. I am able to get the storeId from commandContext before setting it into the command. I also try to set store Id to commandContext but it didn't help. Any other suggestions?
    • Sreejith.kanneri
      Sreejith.kanneri
      81 Posts
      ACCEPTED ANSWER

      Re: Create command issue

      ‏2012-11-09T04:54:59Z  in response to SystemAdmin
      did u go through the infocenter for the command it loginid and password are mandatory fields here.

      Please check all conditons here

      http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.api.doc/com/ibm/commerce/usermanagement/commands/UserRegistrationAddCmd.html?resultof=%22%55%73%65%72%52%65%67%69%73%74%72%61%74%69%6f%6e%41%64%64%43%6d%64%22%20%22%75%73%65%72%72%65%67%69%73%74%72%61%74%69%6f%6e%61%64%64%63%6d%64%22%20
  • jpurdum
    jpurdum
    7 Posts
    ACCEPTED ANSWER

    Re: Create command issue

    ‏2012-11-16T17:47:59Z  in response to SystemAdmin
    Did you define a local member variable for the store id in the command that calls the registration command? Instead of calling the protected "storeId" member directly from the super class (Unless you've also defined a local "storeId" member which could be the problem), call super.getStoreId() or super.getCommandContext().getStoreId().