Search This Blog

Monday, April 30, 2012

How to install local copy of WCS info center


Steps to install on Developer Box.

1.Open Rational application developer (WebSphere Commerce Developer).
2.Select Help > Software Updates
3.click the Add Site button from Available software tab
4.add following URL
Site gets added in available sites
5.Expand added site and select WebSphere Commerce Information Center Update and click Install button.
6.A install wizard will appear. Just say Next-- Next..
7. That’s all we have to do.

Sunday, April 29, 2012

Recover Database without Archive log


Apr152010

When we did a cloning/recover the database with noarchivelog mode, we got the problem that some datafile need to be recover. It will be difficulty since no archivelog that can help us to recover it. Otherwise we can copy all datafiles from offline backup of the source database. But it will takes time to copy/ftp/restore especially if the database size are hundreds GB or even TB. But there is a solution to recover the database with noarchivelog mode, please check this out :
When we did a cloning, startup nomount :           
$ sqlplus '/as sysdba' 
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Apr 13 13:54:43 2010 
Copyright (c) 1982, 2007, Oracle. All Rights Reserved. 
Connected to an idle instance. 
SQL> startup nomount pfile=initMYDB.ora
ORACLE instance started. 
Total System Global Area 5251268608 bytes
Fixed Size 2091368 bytes
Variable Size 1040189080 bytes
Database Buffers 4194304000 bytes
Redo Buffers 14684160 bytes 

Create New control File:
      
SQL> @createctl.sql 
Control file created. 
Since the cloning come from offline backup and the SID in target db as same as source db so
we don’t need to resetlogs, but the one of datafile need to recover : 
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/u01/system01.dbf' 
 Try To recover, but we don’t have the archivelog file that needed : 
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 5991183372639 generated at 04/13/2010 13:51:42 needed for
thread 1
ORA-00289: suggestion :
/u02/db/10.2.0/dbs/arch1_1125_714320021.dbf
ORA-00280: change 5991183372639 for thread 1 is in sequence #1125 
Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/system01.dbf' 
ORA-01112: media recovery not started 
Try to open resetlogs, we still got the same error  
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/system01.dbf' 
To fix this issue :
1. Shutdown immediate 
     
SQL> Shutdown immediate 
2. Remark the parameter in initMYDB.ora:   
    - UNDO_MANAGEMENT=AUTO - UNDO_TABLESPACE=OLD_UNDOTS
3. Add the parameter in initMYDB.ora :          
    - UNDO_MANAGEMENT=MANUAL - _ALLOW_RESETLOGS_CORRUPTION = TRUE - _ALLOW_ERROR_SIMULATION = TRUE
4. Startup database with new init.ora :          
$ sqlplus '/as sysdba' 
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Apr 13 16:06:56 2010 
Copyright (c) 1982, 2007, Oracle. All Rights Reserved. 
Connected to an idle instance. 
SQL> startup mount pfile=initMYDB.ora
ORACLE instance started. 
Total System Global Area 5251268608 bytes
Fixed Size 2091368 bytes
Variable Size 1040189080 bytes
Database Buffers 4194304000 bytes
Redo Buffers 14684160 bytes
Database mounted.
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 5991183372639 generated at 04/13/2010 13:51:42 needed for
thread 1
ORA-00289: suggestion :
/u02/db/10.2.0/dbs/arch1_1125_714320021.dbf
ORA-00280: change 5991183372639 for thread 1 is in sequence #1125 
Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/system01.dbf' 
ORA-01112: media recovery not started 
SQL> alter database open resetlogs; 
Database altered. 
5. Now the database already startup with Manual undo management.
6. Create new UNDO Tablespace 
  
SQL> Create UNDO tablespace NEW_UNDOTS datafile '/u02/undo01.dbf' size 2048M; 
7. Take offline the OLD Undo Tablespace :   

SQL> alter tablespace OLD_UNDOTS offline; 

8. Take online the NEW Undo Tablespace :   
SQL> alter tablespace NEW_UNDOTS ; 
9. Shutdown the database :       
SQL> shutdown immediate; 
10. Edit the initMYDB.ora :   
    + Remark the parameter :
    - UNDO_MANAGEMENT=MANUAL
    - _ALLOW_RESETLOGS_CORRUPTION = TRUE
    - _ALLOW_ERROR_SIMULATION = TRUE
        + Add and edit the parameter : 
    UNDO_MANAGEMENT=AUTO
    UNDO_TABLESPACE=NEW_UNDOTS  
      11. Create spfile from pfile ='<location of pfile>'

     12. Startup the database : 

SQL> startup 
13. The database will startup with the NEW Undo tablespace, change the default undo tablespace :  

SQL> alter system set undo_tablespace=NEW_UNDOTS; 
14. Then we can drop the OLD Undo tablespace :    
SQL> drop tablespace OLD_UNDOTS including contents and datafiles;

15. Good Luck ;)            

Monday, April 23, 2012

Changing ATP to NON-ATP inventory model

Following are steps to change WCS inventory from ATP to NON-ATP.

1. Change inventory system value on STORE table. For NON-ATP, inventory system value will be -2

2. NON-ATP mode need default shipmode at store level. For this update storedef table and put a default shipmode id... you can use query like below

update storedef set shipmode_id=12053;

3. Update store id and ffmcenter id in inventory table

4. update end date and shipmode id in SHPARRANGE

Restart server and see WCS is working on NON-ATP...

Saturday, April 7, 2012

Enacting customer in WCS

This is one of good capability provided by WCS where CSR user or In store user can enact as customer from store front.
WCS provides following two URL for enacting customer

  • RunAsUserSetInSession URL

  • RestoreOriginalUserSetInSession URL
RunAsUserSetInSession URL
This URL allows administrators with the proper authority to run subsequent commands in the same session under a specified customer's identity.
This URL allows administrators with the proper authority to run subsequent commands in the same session under a specified customer's identity. The access control framework checks that the current user belongs to one of the following roles:

  • Customer Service Representative (CSR)

  • Customer Service Supervisor (CSS)

  • Operations Manager

  • Sales Manager

  • Seller


URL structure
Parameter values
langId
The preferred language for the duration of the session; the supported languages for a store are found in the STORELANG table.
URL
The URL to be called when the command completes successfully. The default value is RunAsUserSetInSessionView.
storeId
The reference number of the store to which the user is logging on.
runAsUserId
The registered customer's user ID. This is the customer under whom subsequent requests will run.
Example 1
To switch to a specified customer's user ID (for example, 5) an administrator needs to execute the RunAsUserSetInSession URL with the runAsUserId parameter set to "5". Upon successfully running the RunAsUserSetInSession URL, RunAsUserSetInSessionView gets called. https:// myhostname/webapp/wcs/stores/servlet/RunAsUserSetInSession?runAsUserId=5
Example 2
The following example switches to user ID 5 and calls the specified URL (UserAccountView): https:// myhostname/webapp/wcs/stores/servlet/RunAsUserSetInSession?runAsUserId=5&URL=UserAccountView
Behavior
Ensure that the user who executes the command is of registerType 'A'.
The customer to which the command tries to switch (runAsUserId) is of registerType 'R' (registered user).
Saves the runAsUserId value in the command context to be stored in the session so that in subsequent requests or commands, the runAsUserId value can be restored.
If you have switched to a user ID using the RunAsUserSetInSession URL, you cannot switch to another user ID. You must first call RestoreOriginalUserSetInSession before you can make another RunAsUserSetInSession call.
If you have switched to another user ID, and when running the command, you want to retrieve the original identity, you can make a call to getCallerId on the CommandContext.
Exception conditions
Exception message key
Description
_ERR_MISSING_PARMS
The command throws this exception if the runAsUserId value is not specified.
_ERR_MEMBER_USER_ADMIN_TYPE
The command throws this exception if the current user is not of registerType 'A' (administrator).
_ERR_MEMBER_USER_REGISTERED_TYPE
The command throws this exception if the user that the command tries to switch under is not of registerType 'R' (registered).
If the forUser parameter is specified while the administrator session is populated with a customer's session information, an exception is generated.



RestoreOriginalUserSetInSession URL


This URL resets the session for subsequent commands so they revert back to the original administrator user ID after an administrator has established the runAsUser value in the session by running the RunAsUserSetInSession command.
Parameter values
langId
The preferred language for the duration of the session; the supported languages for a store are found in the STORELANG table.
URL
The URL to be called when the command completes successfully. The default value is RestoreOriginalUserSetInSessionView.
storeId
The reference number of the store.
Example 1
To revert back to the administrator's original user ID, the administrator runs the RestoreOriginalUserSetInSession URL. Upon successfully running this URL, the default view RestoreOriginalUserSetInSessionView is called. https://myhostname/webapp/wcs/stores/servlet/RestoreOriginalUserSetInSession?storeId=11001&URL=AjaxLogonForm&myAcctMain=1
Example 2
Upon successfully running this URL, the specified URL (UserAccountView) is called. https://myhostname/webapp/wcs/stores/servlet/RestoreOriginalUserSetInSession?storeId=11001&URL=AjaxLogonForm&myAcctMain=1
Behavior
Removes the runAsUserId value from the command context such that it is no longer stored in the session. Subsequent requests and commands are run under the original user ID.
If runAsUserId is not set, that is RunAsUserSetInSession was not previously run in the same session, this command leaves the current session unchanged.


By Default CSR or Store agent cannot modify customer current basket, becuase its locked by customer
There are two ways to resolve this locking issue
1. Disable locking
Add following line in WC-Server.xml
orderlockfeature enabled="false"

2. Customize order enacting flow using
User AdvancedOrderEditBeginCmd for taking lock and modify order
Finally User AdvancedOrderEditEndCmd to release lock..

In this duration customer will not be able to modify or place order because lock is with CSR agent.

Monday, April 2, 2012

ClassNotFound for WebSphereCommerceServerExtensionsLogic folder

This is the startup console and the server doesn't start properly after this error happens. If I comment the custom Registry class in wc-server.xml, the server starts properly with no errors.


1/31/08 11:39:37:718 EST 0000000a CommerceSrvr I RegistryManager initializeRegistryEntry CMN0007S: Initialization has started for "".1/31/08 11:39:37:718 EST 0000000a CommerceSrvr E RegistryManager initializeRegistryEntry CMN0112E: The following error has been detected while initializing "": java.lang.ClassNotFoundException: com.borders.commerce.singletons.java.lang.ClassNotFoundException: com.borders.commerce.singletons.at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java(Compiled Code))at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java(Compiled Code))at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))at java.lang.Class.forName1(Native Method)at java.lang.Class.forName(Class.java(Compiled Code))at com.ibm.commerce.registry.RegistryManager.initializeRegistryEntry(RegistryManager.java:124)at com.ibm.commerce.registry.RegistryManager.initializeRegistryEntry(RegistryManager.java:169)at com.ibm.commerce.registry.RegistryManager.initialize(RegistryManager.java:95)at com.ibm.commerce.server.WcsApp.registryInit(WcsApp.java:595)at com.ibm.commerce.server.WcsApp.initialize(WcsApp.java:440)at com.ibm.commerce.server.WebApp.init(WebApp.java:374)at com.ibm.commerce.struts.InitActionServlet.init(InitActionServlet.java:64)at javax.servlet.GenericServlet.init(GenericServlet.java:256)at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:274)at com.ibm.ws.webcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:1398)at com.ibm.wsspi.webcontainer.extension.WebExtensionProcessor.createServletWrapper(WebExtensionProcessor.java:86)at com.ibm.ws.webcontainer.webapp.WebApp.getServletWrapper(WebApp.java:788)at com.ibm.ws.webcontainer.webapp.WebApp.initializeTargetMappings(WebApp.java:515)at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:404)at com.ibm.ws.webcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:115)at com.ibm.ws.webcontainer.VirtualHost.addWebApplication(VirtualHost.java:128)at com.ibm.ws.webcontainer.WebContainer.addWebApp(WebContainer.java:924)at com.ibm.ws.webcontainer.WebContainer.addWebApplication(WebContainer.java:877)at com.ibm.ws.runtime.component.WebContainerImpl.install(WebContainerImpl.java:167)at com.ibm.ws.runtime.component.WebContainerImpl.start(WebContainerImpl.java:391)

Solution:
Right click WC > properties > JAVA EE Module Dependecies > Make sure for project WebSphereCommerceServerExtensionsLogic column JAR is checked and In Lib Dir column is unchecked.Reason: Issue comes because, WC searches for logic jar (which has all classes of logic) in lib directory of itself, which is not present.