Thursday, November 29, 2012

Session sharing issue with JBOSS application server

Problem statement -
Session sharing between web applications is not happening. Each web application (war) gets a separate session id and cookie. For each JBoss session, unique ATG session-scoped components (e.g. Order and Profile) are getting created instead of being shared by all web applications.

Environment details where this issue is reproduced
Application server - JBoss EAP 4.3.0 CP10
ATG - ATG 9.4
Java version - JDK_1_6_0_27

Explanation of above problem with example -
sample_application.ear has 2 wars
    common.war with "/" context
    pharmacy.war with "/pharmacy" context
instead of having one jsession id, 2 jsesson id's are getting created
And session objects like "profile" and "order" are not getting shared between these modules.

Here is the snapshot of 2 separate session id's created for each module



Here is the snapshot of these jsession id's in GenericSessionManager in Nucleus component browser.
http://localhost:8080/dyn/admin/nucleus/atg/dynamo/servlet/sessiontracking/GenericSessionManager/ 



Expected behavior - A single instance of a session scoped component should be available to all web applications participating in session sharing. Each web application should use the same session id.

This issue exists even though parentContextName is defined in web.xml in each module.
In general, if parentContextName is defined, ATG should maintain session sharing between wars.
<context-param>
  <param-name>atg.session.parentContextName</param-name>
  <param-value>/dyn</param-value>
</context-param>
<context-param>
  <param-name>atg.dafear.bootstrapContextName</param-name>
  <param-value>/dyn</param-value>
</context-param>

Reason
There are 2 issues related to this -
1) Issue in JBOSS - Seperate JSESSION is being created for each domain.
https://issues.jboss.org/browse/JBWEB-107
" Currently the JSESSIONID cookie domain is set to the domain name of the Host that emits the cookie (e.g. www.domain.com). This is an issue with customers using Aliases (e.g. secure.domain.com, zzz.domain.com, etc.), as the session is lost when switching between the main domain and any aliases. In these cases, it would be useful to be able to specify the domain to be "domain.com" so the same JSESSIONID cookie is used across the aliases and converges to the same session."

Fix is already mentioned in https://issues.jboss.org/browse/JBWEB-107
i) Breifly - Deploy customvalve.jar in  \jboss-eap-4.3\jboss-as\server\<servername>\deploy\jboss-web.deployer\
ii) And in jboss-eap-4.3/jboss-as/server/<servername>/deploy/jboss-web.deployer/server.xml, set cookie Domain to “.<your_domain>.com”
   <Valve className="com.redhat.jboss.support.ConfigureSessionCookieValve" cookieSecure="false" cookieDomain=".<your_domain>.com" />

2) If emptySessionPath attribute in server.xml is false, then each web application will have its own jsessionid cookie.
 http://tomcat.apache.org/tomcat-6.0-doc/config/ajp.html
"The issue is generally caused by the Tomcat/JBoss setting of the emptySessionPath attribute. This attribute defaults to true which allows all web applications to use the same jsessionid cookie (with cookie path of /). If this is set to false, each web application will receive its own jsessionid cookie (with a cookie path set to the context root of the web application)."

To fix this
The jboss-eap-4.3/jboss-as/server/<servername>/deploy/jboss-web.deployer/server.xml file and check the emptySessionPath setting. A setting of true will ensure that the jsessionid cookie will have a cookie path of / and all web-applications will use the same session id value.

Example -
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
        maxThreads="150" scheme="https" secure="true"
        emptySessionPath="true"
        clientAuth="false"
        strategy="ms"
        address="${jboss.bind.address}"
        keystoreFile="${jboss.server.home.dir}/conf/server.keystore"
        keystorePass="tc-ssl"
        truststoreFile="${jboss.server.home.dir}/conf/server.keystore"
        truststorePass="tc-ssl"
        sslProtocol="TLS"/>     

Note: Information related to "emptySessionPath" setting is provided by Oracle ATG Support.
After having above 2 settings this issue is resolved.

Hope this helps!!

Friday, May 25, 2012

Minimizing query execution time using oracle hints

Querying on a indexed columns generally improves query performance but in some cases if all columns in where clause are indexed columns degrades query performances. And this can be observed if table you are querying has humongous data (*many* rows). In that scenario, execution time of query on a table (which has many rows) will increase as the number of indexed columns in the where condition increase.

For example: Below are the columns present in dcspp_order table

Indexes that present in this table


Query 1: Querying dcspp_order with creation_date and state, only state is indexed column
set serveroutput on
variable n number
exec :n := dbms_utility.get_time;
SELECT count(*) FROM dcspp_order WHERE  creation_date>='01-Jan-02' and creation_date <='12-Dec-02' and state = 'INCOMPLETE';
exec dbms_output.put_line( ((dbms_utility.get_time-:n)/100) || ' seconds....' );

 The output -
  COUNT(*)
----------
         0
1 row selected.
35.07 seconds....
PL/SQL procedure successfully completed.

Execution plan for above query-
1 Every row in the table PROFILEV5.DCSPP_ORDER  is read.
2 For the rows returned by step 1, filter out rows depending on filter criteria.
3 The rows were sorted to support a group operation (MAX,MIN,AVERAGE, SUM, etc).
4 Rows were returned by the SELECT statement.

Query 2 : Querying dcspp_order with last_modified_date and state, both columns are indexed
set serveroutput on
variable n number
exec :n := dbms_utility.get_time;
SELECT count(*) FROM dcspp_order WHERE last_modified_date>='01-Jan-02' and last_modified_date <='12-Dec-02' and state = 'INCOMPLETE';
exec dbms_output.put_line( ((dbms_utility.get_time-:n)/100) || ' seconds....' );
The output -
  COUNT(*)
----------
         0

1 row selected.
224.43 seconds....
PL/SQL procedure successfully completed.

Execution Plan for above query -
1 One or more rows were retrieved using index PROFILEV5.IX_DCSPP_ORDER_01 .  The index was scanned in ascending order..
2 One or more rows were retrieved using index PROFILEV5.ORDER_LASTMOD_IDX .  The index was scanned in ascending order..
3 The result sets from steps 1, 2 were joined (hash).
4 A view definition was processed, either from a stored view PROFILEV5.index$_join$_001  or as defined by steps 3.
5 For the rows returned by step 4, filter out rows depending on filter criteria.
6 The rows were sorted to support a group operation (MAX,MIN,AVERAGE, SUM, etc).
7 Rows were returned by the SELECT statement.

As you can observe Query 2 execution time (224.43 secs) is more than Query 1 execution time (35.07 secs) , even though Query 2 has both indexed columns in the condition.

Why?
If you observe the execution plan of Query 1, STATE column index - PROFILEV5.IX_DCSPP_ORDER_01 is not considered that's because of condition also has a column creation_date which doesn't have any index. So there is a full table scan in this case. Now If you observe the execution plan of Query 2, since all the columns in the condition has indexes,  STATE column index PROFILEV5.IX_DCSPP_ORDER_01 and LAST_MODIFED_DATE column index PROFILEV5.ORDER_LASTMOD_IDX are considered while executing, first scans through STATE index and next scan through LAST_MODIFED_DATE index and then results from both are joined which is taking much time since there are hugh number of rows in dcspp_order table.

How to optimize Query 2 execution time?
 Using oracle hints we can ask to skip one index, which will avoid hash join.

Query 2 optimizing using oracle hints
set serveroutput on
variable n number
exec :n := dbms_utility.get_time;
SELECT /*+NO_INDEX(dcspp_order IX_DCSPP_ORDER_01)*/  count(*) FROM dcspp_order WHERE last_modified_date>='01-Jan-02' and last_modified_date <='12-Dec-02' and state = 'INCOMPLETE';
exec dbms_output.put_line( ((dbms_utility.get_time-:n)/100) || ' seconds....' );
output -
  COUNT(*)
----------
         0

1 row selected.
28.17 seconds....
PL/SQL procedure successfully completed.

Execution plan -
1 Every row in the table PROFILEV5.DCSPP_ORDER  is read.
2 For the rows returned by step 1, filter out rows depending on filter criteria.
3 The rows were sorted to support a group operation (MAX,MIN,AVERAGE, SUM, etc).
4 Rows were returned by the SELECT statement.

So execution time Query 2 is reduced from 224.43 seconds to 28.17 seconds.
We used NO_INDEX oracle hint to skip STATE column index to avoid hash join.

Hope this helps

Thursday, February 23, 2012

Issue with invalidating caches at regular intervals

After setting some values in an item & before calling updateItem on that item, if that particular repository cache is invalidated then the changes made to item in that transaction are lost/not updated.

And in logs you will see something like
Changes not updated for item in commit: <item-descriptor-name>:<id-of-item> changes={<property-name>=<value-that-being-set>}

For example -
Suppose there is www_person table in /com/person/PersonRepository

public boolean handleUpdate(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse) throws Exception {
MutableRepositoryItem personItem = personRepository.getItemForUpdate("100001");
personItem.setPropertyValue("lastname", "Mike");

// Invalidate cache at this point, as you can observe last value set is lost. 
logInfo("Last name"+(String) personItem.getPropertyValue("lastname"));

personRepository.updateItem(personItem);
return true;
}

Refer below screenshot - 

In logs -
**** Error      Thu Feb 23 18:21:12 CST 2012    1330042872864   /       Changes not updated for item in commit: person:100001 changes={lastname=Mike}

If you have some cron jobs which are invalidating repositories in regular intervals, then above type of errors may occur.

For example - If you have cron job for invalidating OrderRepository at regular intervals, then the values set to order item or commerce item or shipping item will be lost or not updated if invalidate cache is called before updateOrder/UpdateItem method.

ATG/Oracle support created a patch regarding this issue.

Hope this helps.

Tuesday, February 14, 2012

Performance using Cache

Below are some examples showing how having or not having cache, impacts performance.
To give a overall idea how ATG cache works please refer below diagram.(click to enlarge).


Note: To effectively use cache & to improve performance follow green path & avoid red.
If Cache is disabled
For example – “siteConfiguration” item-descriptor in SiteConfiguration Repository
  <item-descriptor name="siteConfiguration" cache-mode=" disabled" default="false">
              <table name="www_site_configuration" type="primary" id-column-name="APPLICATION_NAME">
                        <property name="configName" column-name="CONFIG_NAME" data-type="String"> </property>
                      ….  
Cache stats for this item in component browser
In Below example – querying for siteConfiguration.configName=”shopduringdowntime”
<%@ taglib uri="dsp" prefix="dsp"%>
<dsp:page>
<dsp:setvalue param="confName" value="shopduringdowntime"/>

<dsp:droplet name="/atg/dynamo/droplet/RQLQueryForEach">
  <dsp:param name="queryRQL" value="configName=:confName"/>
  <dsp:param name="repository" value="/repositories/siteConfiguration/SiteConfiguration"/>
  <dsp:param name="itemDescriptor" value="siteConfiguration"/>
  <dsp:oparam name="output">
     Config Value : <dsp:valueof param="element.configValue"/> <br>
  </dsp:oparam>
</dsp:droplet>

</dsp:page>

In logs –
First to get id (id-column-name) for the required item with given params (configName=”shopduringdowntime”)
**** debug      Mon Jan 30 16:09:53 CST 2012    1327961393403   /repositories/siteConfiguration/SiteConfiguration       [++SQLQuery++]
 SELECT t1.APPLICATION_NAME
   FROM www_site_configuration t1
  WHERE (t1.CONFIG_NAME = ?)
-- Parameters --
p[1] = {pd: configName} shopduringdowntime (java.lang.String)
[--SQLQuery--]

**** debug      Mon Jan 30 16:09:53 CST 2012    1327961393450   /repositories/siteConfiguration/SiteConfiguration       getItems(siteConfiguration: [quickshop])
Once we got the id load item (all properties) with that id
**** debug      Mon Jan 30 16:21:10 CST 2012    1327962070167   /repositories/siteConfiguration/SiteConfiguration       [++SQLSelect++]
  SELECT CONFIG_NAME,CONFIG_VALUE,APPLICATION_NAME,UPDATE_DTTM,CREATE_DTTM,CREATED_USER_ID,UPDATED_USER_ID,DESCRIPTION
   FROM www_site_configuration
  WHERE APPLICATION_NAME=?
-- Parameters --
p[1] = {pd} quickshop (java.lang.String)
[--SQLSelect--]

So total 2 queries are fired.  In this case, for every iteration 2 queries are fired.
If 2 iterations are there for same rql as below then 4 queries are fired.
<%@ taglib uri="dsp" prefix="dsp"%>
<dsp:page>
<dsp:setvalue param="confName" value="shopduringdowntime"/>

<%-- iteration 1 --%>
<dsp:droplet name="/atg/dynamo/droplet/RQLQueryForEach">
  <dsp:param name="queryRQL" value="configName=:confName"/>
  <dsp:param name="repository" value="/repositories/siteConfiguration/SiteConfiguration"/>
  <dsp:param name="itemDescriptor" value="siteConfiguration"/>
  <dsp:oparam name="output">
     Config Value : <dsp:valueof param="element.configValue"/> <br>
  </dsp:oparam>
</dsp:droplet>

<%-- iteration 2 --%>
<dsp:droplet name="/atg/dynamo/droplet/RQLQueryForEach">
  <dsp:param name="queryRQL" value="configName=:confName"/>
  <dsp:param name="repository" value="/repositories/siteConfiguration/SiteConfiguration"/>
  <dsp:param name="itemDescriptor" value="siteConfiguration"/>
  <dsp:oparam name="output">
     Config Value : <dsp:valueof param="element.configValue"/> <br>
  </dsp:oparam>
</dsp:droplet>

</dsp:page>

Transaction Cache
But if both are in same transaction like below –
<%@ taglib uri="dsp" prefix="dsp"%>
<dsp:page>
<dsp:setvalue param="confName" value="shopduringdowntime"/>

<%-- open transaction --%>
<dsp:droplet name="/atg/dynamo/transaction/droplet/Transaction">
  <dsp:param name="transAttribute" value="required"/>
  <dsp:oparam name="output">

<%-- iteration 1 --%>
<dsp:droplet name="/atg/dynamo/droplet/RQLQueryForEach">
  <dsp:param name="queryRQL" value="configName=:confName"/>
  <dsp:param name="repository" value="/repositories/siteConfiguration/SiteConfiguration"/>
  <dsp:param name="itemDescriptor" value="siteConfiguration"/>
  <dsp:oparam name="output">
     Config Value : <dsp:valueof param="element.configValue"/> <br>
  </dsp:oparam>
</dsp:droplet>

<%-- iteration 2 --%>
<dsp:droplet name="/atg/dynamo/droplet/RQLQueryForEach">
  <dsp:param name="queryRQL" value="configName=:confName"/>
  <dsp:param name="repository" value="/repositories/siteConfiguration/SiteConfiguration"/>
  <dsp:param name="itemDescriptor" value="siteConfiguration"/>
  <dsp:oparam name="output">
     Config Value : <dsp:valueof param="element.configValue"/> <br>
  </dsp:oparam>
</dsp:droplet>

 </dsp:oparam>
</dsp:droplet>
<%-- end transaction --%>

</dsp:page>

For iteration 1: 2 queries are fired.
But for iteration 2: only below query is fired
**** debug      Mon Jan 30 16:37:44 CST 2012    1327963064454   /repositories/siteConfiguration/SiteConfiguration       [++SQLQuery++]
  SELECT t1.APPLICATION_NAME
   FROM www_site_configuration t1
  WHERE (t1.CONFIG_NAME = ?)
-- Parameters --
p[1] = {pd: configName} shopduringdowntime (java.lang.String)
[--SQLQuery--]

Since above query is already cached in Transaction Cache, next query is not fired. So there by only 3 queries (instead of 4) are fired if both are in same transaction.

So If you have 10 same queries in different transaction in same thread, then total queries will be 10*2 = 20.
If you have 10 same queries in same transaction in same thread, then total queries will (1*2)+(9*1) = 11.

If Cache is enabled (& if query-cache is disabled)
For any cache mode (either simple/distributed/hybrid), by default item-cache-size is enabled (default is 1000) & query-cache-size is disabled (default is 0).
For example – “siteConfiguration” item-descriptor in SiteConfiguration Repository.
<item-descriptor name="siteConfiguration" cache-mode=" simple" default="false">
              <table name="www_site_configuration" type="primary" id-column-name="APPLICATION_NAME">
                        <property name="configName" column-name="CONFIG_NAME" data-type="String"> </property>
                      ….  
In Below example – querying for siteConfiguration.configName=”shopduringdowntime”.
<%@ taglib uri="dsp" prefix="dsp"%>
<dsp:page>
<dsp:setvalue param="confName" value="shopduringdowntime"/>

<dsp:droplet name="/atg/dynamo/droplet/RQLQueryForEach">
  <dsp:param name="queryRQL" value="configName=:confName"/>
  <dsp:param name="repository" value="/repositories/siteConfiguration/SiteConfiguration"/>
  <dsp:param name="itemDescriptor" value="siteConfiguration"/>
  <dsp:oparam name="output">
     Config Value : <dsp:valueof param="element.configValue"/> <br>
  </dsp:oparam>
</dsp:droplet>

</dsp:page>

First Iteration
In logs -
First to get id (id-column-name) for the required item with given params (configName=”shopduringdowntime”)
**** debug      Mon Jan 30 17:14:05 CST 2012    1327965245245   /repositories/siteConfiguration/SiteConfiguration       [++SQLQuery++]
  SELECT t1.APPLICATION_NAME
   FROM www_site_configuration t1
  WHERE (t1.CONFIG_NAME = ?)
-- Parameters --
p[1] = {pd: configName} shopduringdowntime (java.lang.String)
[--SQLQuery--]
Next query is to load item for that id
**** debug      Mon Jan 30 17:14:05 CST 2012    1327965245276   /repositories/siteConfiguration/SiteConfiguration       [++SQLQuery++]
  SELECT t1.APPLICATION_NAME,t1.DESCRIPTION,t1.UPDATE_DTTM,t1.CREATED_USER_ID,t1.CREATE_DTTM,t1.CONFIG_VALUE,t1.UPDATED_USER_ID,t1.CONFIG_NAME
   FROM www_site_configuration t1
  WHERE t1.APPLICATION_NAME = ?
-- Parameters --
p[1] = {pd} quickshop (java.lang.String)
[--SQLQuery--]

Next Iterations
Once below query is exected –
**** debug      Mon Jan 30 17:23:51 CST 2012    1327965831278   /repositories/siteConfiguration/SiteConfiguration       [++SQLQuery++]
  SELECT t1.APPLICATION_NAME
   FROM www_site_configuration t1
  WHERE (t1.CONFIG_NAME = ?)
-- Parameters --
p[1] = {pd: configName} shopduringdowntime (java.lang.String)
[--SQLQuery--]

When getItems(siteConfiguration: [quickshop]) is called, since “quickshop” item is already cached in item-cache,  another query is not required. So once item cached, for all next iterations querying for same item will have only 1 query (instead of 2, if query is disabled).

In above case

If you have 10 iterations without using item-cache, then total queries will be 10*2 = 20.
If you have 10 iterations using  item-cache, then total queries will (1*2)+(9*1) = 11.

Regarding Transaction cache while cache is enabled – Since items are already cached in item-cache having or not having transaction cache will result in same 1 query (above query to get id)

If Cache is enabled (& if query-cache is enabled)
If query-cache-size is also enabled (suppose size set is 1000) –
If you enable query-cache along with item-cache then the 1 query to get id’s is also not queried since that will be cached in query-cache until the query params are not changed.
For example – “siteConfiguration” item-descriptor in SiteConfiguration Repository.
 <item-descriptor name="siteConfiguration" cache-mode=" simple" default="false" item-cache-size="1000" query-cache-size="1000">
              <table name="www_site_configuration" type="primary" id-column-name="APPLICATION_NAME">
                        <property name="configName" column-name="CONFIG_NAME" data-type="String"> </property>
                      ….   

First Iteration
In logs -
First to get id (id-column-name) for the required item with given params (configName=”shopduringdowntime”)
**** debug      Mon Jan 30 17:46:14 CST 2012    1327967174714   /repositories/siteConfiguration/SiteConfiguration       [++SQLQuery++]
 SELECT t1.APPLICATION_NAME
   FROM www_site_configuration t1
  WHERE (t1.CONFIG_NAME = ?)
-- Parameters --
p[1] = {pd: configName} shopduringdowntime (java.lang.String)
[--SQLQuery--]

Next query is to load item for that id.
**** debug      Mon Jan 30 17:46:14 CST 2012    1327967174745   /repositories/siteConfiguration/SiteConfiguration       [++SQLQuery++]
  SELECT t1.APPLICATION_NAME,t1.DESCRIPTION,t1.UPDATE_DTTM,t1.CREATED_USER_ID,t1.CREATE_DTTM,t1.CONFIG_VALUE,t1.UPDATED_USER_ID,t1.CONFIG_NAME
   FROM www_site_configuration t1
  WHERE t1.APPLICATION_NAME = ?
-- Parameters --
p[1] = {pd} quickshop (java.lang.String)
[--SQLQuery--]

Next Iterations
No queries are fired, since above query is already cached.

In above case
If you have 10 iterations without using item-cache & query-cache, then total queries will be 10*2 = 20.
If you have 10 iterations using item-cache & query-cache, then total queries will (1*2)+(9*0) = 2.

Summary of above examples -
If cache is disabled & no transaction cache - for 10 iterations, 20 queries are fired.
If cache is disabled & using transaction cache - for 10 iterations, 11 queries are fired. (only for that transaction)
If item-cache is enabled & query-cache is disabled - for 10 iterations, 11 queries are fired.
If item-cache & query-cache enabled - for 10 iterations, 2 queries are fired.

Thursday, January 26, 2012

To develop sample webservice application using CXF

Regarding CXF -
"Apache CXF is an open source services framework. CXF helps you build and develop services using frontend programming APIs, like JAX-WS and JAX-RS. These services can speak a variety of protocols such as SOAP, XML/HTTP, RESTful HTTP, or CORBA and work over a variety of transports such as HTTP, JMS or JBI." -- http://cxf.apache.org/

Previously CXF is known as Xfire -
"User's looking to use XFire on a new project, should use CXF instead. CXF is a continuation of the XFire project and is considered XFire 2.0. It has many new features, a ton of bug fixes, and is now JAX-WS compliant! XFire will continue to be maintained through bug fix releases, but most development will occur on CXF now" -- http://xfire.codehaus.org/

If you are looking for sample webservice application using Xfire
refer - http://atgkid.blogspot.com/2012/01/to-develop-sample-webservice.html

Below are the steps to create a sample web service "AdditionWebService" (by using CXF) which takes input 2 numbers and returns sum of those numbers as response.
As mentioned in To develop sample webservice application using Xfire - Follow same steps for creating webservice project using eclipse & Java classes.

With CXF - refer http://cxf.apache.org/docs/writing-a-service-with-spring.html for more info
No need to have In /<Project-Name>/WebContent/META-INF/xfire/services.xml
Instead we need to have /<Project-Name>/WebContent/WEB-INF/cxf-servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxws:endpoint
 id="AddService"
 implementor="com.test.service.AdditionWebServiceImpl"
 address="/AddService" />
</beans>
And in /<Project-Name>/WebContent/WEB-INF/web.xml
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
         http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <display-name>TestWebService</display-name>

    <servlet>
        <servlet-name>cxf</servlet-name>
        <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>cxf</servlet-name>
        <url-pattern>/services/*</url-pattern>

    </servlet-mapping>

    <session-config>
        <session-timeout>60</session-timeout>
    </session-config>

</web-app>
dependencies & libraries needed for cxf
Download http://www.apache.org/dyn/closer.cgi?path=/cxf/2.5.1/apache-cxf-2.5.1.zip, once you extract you will find all libs mentioned below in \apache-cxf-2.5.1\lib

Thats it once you have done above steps, build war using export functionality in eclipse (refer To develop sample webservice application using Xfire)

Once war is created deploy & to generate wsdl go to http://localhost:8080/<context>/services/<address-mentioned-in-cfx-servlet.xml>?wsdl
For example - http://localhost:8080/TestWebService/services/AddService?wsdl


To test using SOAP UI -


Follow same steps mentioned in " To develop sample webservice application using Xfire" to develop Java client.

Wednesday, January 25, 2012

To develop sample webservice application using Xfire

To know more about xfire
http://xfire.codehaus.org/

Below are the steps to create a sample web service "AdditionWebService" (by using xfire) which takes input 2 numbers and returns sum of those numbers as response.

To create new webservice project
You need to have J2EE eclipse developer for below steps to follow
In eclipse go to - File->New->Project
search for web


select "Dynamic Web Project" , give Project Name, Next & Finish

Folder structure once the project is created.


In .classpath change <classpathentry kind="output" path="build/classes"/>
to
<classpathentry kind="output" path="WebContent/WEB-INF/classes"/>

Inorder to add JBOSS jar files to classpath
Create User library "JBOSS4.3"
Go to eclipse->Window->Preferences->Java->Build Path->User Libraries
Click on new -> (give any name) JBOSS4.3, OK
Select JBOSS4.3 and select "Add JARs" go to <JBOSS-HOME>client
For example -  C:\jboss-eap-4.3\jboss-as\client
select all jars and click open. Click ok

Now add that user library to build path of the project
Right click on the project, go to properties, in Java Build Path, In Libraries tab, click on "Add Library"
select User library, click next and select "JBOSS4.3" Click OK, Finish.


Create request & response bean

In /AdditionWebService/src/com/test/bean/AdditionRequest.java
package com.test.bean;

public class AdditionRequest {
    private int anumber;
    private int bnumber;
    public int getAnumber() {
      return anumber;
    }
    public int getBnumber() {
      return bnumber;
    }
    public void setAnumber(int anumber) {
      this.anumber = anumber;
    }
    public void setBnumber(int bnumber) {
      this.bnumber = bnumber;
    }
}
In /AdditionWebService/src/com/test/bean/AdditionResponse.java
package com.test.bean;

public class AdditionResponse {
    private int cnumber;

    public int getCnumber() {
      return cnumber;
    }

    public void setCnumber(int cnumber) {
      this.cnumber = cnumber;
    }
}
Create interface 
In /AdditionWebService/src/com/test/service/AdditionWebService.java
package com.test.service;

import com.test.bean.AdditionRequest;
import com.test.bean.AdditionResponse;

public interface AdditionWebService {
    public AdditionResponse addNumbers(AdditionRequest addRequest);
}

Implementation 
In /AdditionWebService/src/com/test/service/AdditionWebServiceImpl.java
package com.test.service;

import javax.jws.WebService;

import com.test.bean.AdditionRequest;
import com.test.bean.AdditionResponse;

@WebService
public class AdditionWebServiceImpl implements AdditionWebService {
   public AdditionResponse addNumbers(AdditionRequest addRequest) {
       AdditionResponse addResponse = new AdditionResponse();
       addResponse.setCnumber(addRequest.getAnumber()+addRequest.getBnumber());
       return addResponse;
   }
}

In /AdditionWebService/WebContent/WEB-INF/web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      id="WebApp_ID" version="2.5">
      <display-name>AdditionWebService</display-name>
      
      <!--  XFire servlet-related entries START -->
      <servlet>
            <servlet-name>XFire</servlet-name>
            <servlet-class>org.codehaus.xfire.transport.http.XFireConfigurableServlet</servlet-class>
      </servlet>
      <servlet-mapping>
            <servlet-name>XFire</servlet-name>
            <url-pattern>/services/*</url-pattern>
      </servlet-mapping>
      <!--  XFire servlet-related entries END -->
</web-app>
In /AdditionWebService/WebContent/META-INF/xfire/services.xml
<beans xmlns="http://xfire.codehaus.org/config/1.0">
  <service>
    <name>AddService</name>
    <namespace>addition</namespace>
    <serviceClass>com.test.service.AdditionWebService</serviceClass>
    <implementationClass>com.test.service.AdditionWebServiceImpl</implementationClass>
  </service> 
</beans>

Jars that needs to be downloaded for Xfire
http://xfire.codehaus.org/Dependency+Guide

You can download all jars mentioned in above link http://xfire.codehaus.org/Download
download distribution zip file and In xfire-1.2.6\lib you will find all required jars

Copy required jars mentioned in http://xfire.codehaus.org/Dependency+Guide to /AdditionWebService/WebContent/WEB-INF/lib

To create war & deploy to JBOSS server
Right click on project -> Export


Search for war


In Destination folder go to your deploy folder & click finish.

Once war is deployed goto http://localhost:8080/AdditionWebService/services/AddService?wsdl
to generate wsdl file. 


View source and copy to AddService.wsdl file
To test service using soapUI client 
Create new soap UI project


Sample request and response xml


To test with Java client
Generate client using wsdl 


Select output folder - 

Below files will be created. 


In /AddServiceClient/src/com/test/client/AddServiceClient.java

package com.test.client;

import addition.AddServiceLocator;
import addition.AddServicePortType;

import com.test.bean.AdditionRequest;
import com.test.bean.AdditionResponse;

public class AddServiceClient {
      private static AddServiceLocator service;
      private static AddServicePortType port;

      public static void main(String [] args)  {
            try {
                  
            // webservice end address     
            service = new AddServiceLocator();
            String webservice_address = "http://localhost:8080/AdditionWebService/services/AddService";
            service.setAddServiceHttpPortEndpointAddress(webservice_address);
            port = service.getAddServiceHttpPort();

            // create request
            Integer anumber = new Integer(3);
            Integer bnumber = new Integer(4);
            AdditionRequest addRequest = new AdditionRequest();
            addRequest.setAnumber(anumber);
            addRequest.setBnumber(bnumber);
            
            // calling webservice method
            AdditionResponse addResponse = port.addNumbers(addRequest);
            
            System.out.println("Addtion service response : "+addResponse.getCnumber());
            
            } catch (Exception e) {
                   e.printStackTrace();
            }
      }
}
Output - 
Addtion service response : 7

Tip for faster deployment & developement

Inorder to avoid building jar & ear on every change of class file. Follow below steps.
For example - if you have CRS in eclipse -
In /Store/EStore/META-INF/MANIFEST.MF
Add "classes" before all jars of "ATG-Class-Path" as in below figure.




Now if you re-build the ear using runAssembler
A new folder _Store.EStore_sclasses folder will be created.


Now in eclipse create a "linked folder"
File -> New -> Folder ->


Once you have this linked folder -
In .classpath file, point output folder to
<classpathentry kind="output" path="EStore/_Store.EStore_sclasses"/>


So that whenever eclipse build or compile a class is saved (if you have build automatically set),  .class files are directly stored in ear -
For example -
C:\ATG\ATG10.0.3\home\cimEars\atg_production_lockserver.ear\atglib\_Store.EStore_sclasses
Since "clasess" is kept before of all jars in ATG-Class-Path, classes in this folder are picked (lib/classes.jar is not considered) by this way you dont need to build jars & create ear again after modification of a java file(s).

Installing Commerce Reference Store

As many people asked for CRS installation details. I tried to cover as much as possible to give step by step instruction.

For CRS installation details refer below -
http://docs.oracle.com/cd/E22630_01/CRS.1002/pdf/ATGCRSInstall.pdf

Installations you need to have before proceeding further
ATG 10.0.3, JDK 1.6, BEA 10.3, oracle xe. (all are freeware, you dont need any license files)
This steps will also work for ATG9.x, JDK 1.5, BEA 10.0

Below is my Environment details -
DYNAMO_HOME - C:\ATG\ATG10.0.3\home
JAVA_HOME - C:\jdk1.6.0_23
BEA_HOME - BEA_HOME=C:\bea10.3
Installed oracle xe - C:\oraclexe\app\oracle\product\10.2.0\
For oracle jdbc drivers -
CLASSPATH=C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar;

Create a new weblogic domain "CRSV10"
Execute configuration wizard - C:\bea10.3\wlserver_10.3\common\bin\config.exe
When asked for Domain Name give CRSV10


And when asked for JDK give installed jdk 1.6


Thats it CRSV10 domain is created.

Go to C:\bea10.3\user_projects\domains\CRSV10\bin> and run startWebLogic.cmd
http://localhost:7001/console
Keep it running until the setup is completed.

Schema's that needs to be created before going further -
-- For Production site
-- for JNDI - ATGProductionDS - CORE schema
-- core user - crscorev10/password1
create user crscorev10 identified by password1 default tablespace users temporary tablespace temp;
grant connect, resource to crscorev10;
grant select any table to crscorev10;
grant create any table to crscorev10;
grant update any table to crscorev10;
grant delete any table to crscorev10;
grant alter any table to crscorev10;
grant create any view to crscorev10;

-- for JNDI - ATGSwitchingDS_A - for Switching A schema
-- switch A - crscatav10/password1
create user crscatav10 identified by password1 default tablespace users temporary tablespace temp;
grant connect, resource to crscatav10;
grant select any table to crscatav10;
grant create any table to crscatav10;
grant update any table to crscatav10;
grant delete any table to crscatav10;
grant alter any table to crscatav10;
grant create any view to crscatav10;

-- for JNDI - ATGSwitchingDS_B - for switching B schema
-- switch B - crscatbv10/password1
create user crscatbv10 identified by password1 default tablespace users temporary tablespace temp;
grant connect, resource to crscatbv10;
grant select any table to crscatbv10;
grant create any table to crscatbv10;
grant update any table to crscatbv10;
grant delete any table to crscatbv10;
grant alter any table to crscatbv10;
grant create any view to crscatbv10;

-- For Publishing site
-- for JNDI - ATGPublishingDS - Production Core schema
-- pub user - crspubv10/password1
create user crspubv10 identified by password1 default tablespace users temporary tablespace temp;
grant connect, resource to crspubv10;
grant select any table to crspubv10;
grant create any table to crspubv10;
grant update any table to crspubv10;
grant delete any table to crspubv10;
grant alter any table to crspubv10;
grant create any view to crspubv10;

Pre-define ATG servers & Weblogic servers & ports that needs to be created.
Just keep these values defined, so that at the time of cim installation, you need to provide these values.
For Production -
rmiport - 8860
drpport - 8850
file deployment port - 8810
file synchronization deploy server port - 8815
httpPort=7003
httpsPort=7004

atg server name - crs_production_v10
weblogic server name - crs_production_v10

EAR name - crs_production_v10.ear

For Publishing -
rmiport - 8861
drpport - 8851
file deployment port - 8811
file synchronization deploy server port - 8816
lock server port - 9010

httpPort=7005
httpsPort=7006

atg server name - crs_publishing_v10
weblogic server name - crs_publishing_v10

Ear name - crs_publishing_v10.ear

RUN CIM
Go to <ATG-Home>/home/bin
run cim.bat

At the time of "Product Selection" -
Note: If you already did executed cim.bat & something got messed up previously, you can still select "Production selection" & Continue & select.
Note: When * is selected at option & if you want to go with that option just press enter. Selecting the option again will toggle.
. If cim prompts for example hostname[localhost] > then press enter to select localhost as hostname or enter new value "myhost" to assign to hostname.

Below are the products & Addons I selected
-------PRODUCT MODULE CALCULATION start-----------------------------------------------
enter [h]elp, [m]ain menu, [q]uit to exit

Current Product Selection:

  ATG Platform and Content Administration
  ATG Search
  ATG Site Administration
  ATG Commerce Reference Store

Selected AddOns:

  ATG Search
  Merchandising UI
  Switching Datasource
  Include Search QueryConsole on Production
  Index by SKU
  Storefront Demo Application
  Full

Server Instance Types:
  Production Server
     DafEar.Admin DPS DSS B2CCommerce DCS.PublishingAgent
DCS.AbandonedOrderServices DAF.Search.Routing DCS.Search Store.Search
DAF.Search.Base.QueryConsole DCS.Search.Index.SKUIndexing
DCS.Search.Query.SKUIndexing Store.Storefront

  Publishing Server
     DCS-UI.Search DCS-UI.Versioned BIZUI PubPortlet DafEar.Admin
B2CCommerce.Versioned DCS.Versioned DCS-UI Store.EStore.Versioned
Store.Storefront SiteAdmin.Versioned DAF.Search.Versioned DAF.Search.Routing
SearchAdmin.AdminUI DCS.Search.Versioned Store.Search Store.Search.Index
SiteAdmin.Search DCS.Search.Index.SKUIndexing DCS.Search.Query.SKUIndexing
-------PRODUCT MODULE CALCULATION end-----------------------------------------------

1) Database Configuration -
For Database Configuration, you need configure
*[P]  Publishing
  [S]  Switching A
  [B]  Switching B
  [C]  Production Core
  [D]  Done

As CIM prompts, go with default settings, When asked for Connection details, give as below

-------CONNECTION DETAILS START---------------------------------------------
enter [h]elp, [m]ain menu, [q]uit to exit

Publishing
  Select Database Type

*[1]  Oracle Thin
  [2]  MS SQL
  [3]  iNet MS SQL
  [4]  DB2
  [5]  My SQL

Select one > 1

   Enter User Name [[crs10pub]] > crspubv10
   Enter Password [[*********]] > *********
   Re-enter Password > *********
   Enter Host Name [[localhost]] >
   Enter Port Number [[1521]] >
   Enter Database Name [[xe]] >
   Enter Database URL [[jdbc:oracle:thin:@localhost:1521:xe]]
>
   Enter Driver Path [[C:/oraclexe/app/oracle/product/10.2.0/server/jdbc/lib/ojdbc14.jar]] >
   Enter JNDI Name [[ATGPublishingDS]] >

-------CONNECTION DETAILS END------------------------------------------
Once, above step is done, Test connection, Create Schema, Import Initial Data
And repeat "Database Configuration" for Swithching A(crscatav10), Switching B(crscatbv10) & Core (crscorev10)
Once Database Configuration - Done

2) Server Instance Configuration -
Next step is "Server Instance Configuration"
2 instances one for Publishing and one for Production needs to be configured.
============ PUBLISHING SERVER CONFIGURATION start ================
*[P]  Publishing Server - 0 Instances Configured
  [S]  Production Server - 0 Instances Configured
  [D]  Done

*[P]  Publishing Server General Configuration - REQUIRED
  [I]  Instance Management - REQUIRED
  [C]  Modify Calculated Module List - OPTIONAL
  [S]  Scenario Manager - OPTIONAL
  [O]  Configure Another Server Instance Type

   Enter Production Lock Server Hostname [[crs_production]] >  localhost
   Enter Production Lock Server Port [[9012]] >
   Enter the Remote Production Search Instance Host Name [[crs_production]]>  localhost
   Enter the Remote Production Search Instance RMI Port Number [[8860]] >

  [P]  Publishing Server General Configuration - DONE
*[I]  Instance Management - REQUIRED
  [C]  Modify Calculated Module List - OPTIONAL
  [S]  Scenario Manager - OPTIONAL
  [O]  Configure Another Server Instance Type

*[A]  Add Server Instance
  [R]  Remove Server Instance
  [D]  Done
>
  Select Type of Server Instance To Create

*[1]  Publishing with a Server Lock Manager : Minimum 1 Required
  [2]  Publishing

Select one >
   Enter Server Instance Name :  [[atg_publishing_lockserver]] > crs_publishing_v10
   Enter HTTP Port [[7003]] > 7005
   Enter HTTPS Port [[7004]] > 7006
   Enter Site HTTP Port [[7003]] > 7005
   Enter RMI Port [[8860]] > 8861
   Enter DRP Port [[8850]] > 8851
   Enter File Deployment Port [[8810]] > 8811
   Enter File Synchronization Deploy Server Port [[8815]] > 8816
============ PUBLISHING SERVER CONFIGURATION end ================

============ PRODUCTION SERVER CONFIGURATION start ================

  [P]  Publishing Server - 1 Instance Configured - DONE
*[S]  Production Server - 0 Instances Configured
  [D]  Done
 >
*[P]  Production Server General Configuration - REQUIRED
  [I]  Instance Management - REQUIRED
  [C]  Modify Calculated Module List - OPTIONAL
  [S]  Scenario Manager - OPTIONAL
  [O]  Configure Another Server Instance Type
>
  [P]  Production Server General Configuration - DONE
*[I]  Instance Management - REQUIRED
  [C]  Modify Calculated Module List - OPTIONAL
  [S]  Scenario Manager - OPTIONAL
  [O]  Configure Another Server Instance Type
 >
*[A]  Add Server Instance
  [R]  Remove Server Instance
  [D]  Done
>
  Select Type of Server Instance To Create
*[1]  Production with a Server Lock Manager : Minimum 1 Required
  [2]  Production
Select one > 1
   Enter Server Instance Name :  [[atg_production]] > crs_production_v10
   Enter HTTP Port [[7003]] >
   Enter HTTPS Port [[7004]] >
   Enter Site HTTP Port [[7003]] >
   Enter RMI Port [[8860]] >
   Enter DRP Port [[8850]] >
   Enter File Deployment Port [[8810]] >
Enter Lock Server Hostname [[crs_production_v10]] > localhost
Enter Lock Server Port [[9012]] >
============ PRODUCTION SERVER CONFIGURATION end ================

Once "Server Instance Configuration" is done
Next would be "Application Assembly & Deployment"

3) Application Assembly & Deployment
-------DEPLOYMENT SERVER PRODUCTION start------------------------
*[C]  crs_production_v10 - Production
  [P]  crs_publishing_v10 - Publishing with a Server Lock Manager
  [D]  Done
>
   Enter Ear File Name for Production [[atg_production.ear]] > crs_production_v10.ear

Current runAssembler arguments :
-server crs_production_v10
Weblogic Admin Server must be running.

Top Level Module List:

DafEar.Admin DPS DSS B2CCommerce DCS.PublishingAgent
DCS.AbandonedOrderServices DAF.Search.Routing DCS.Search Store.Search
DAF.Search.Base.QueryConsole DCS.Search.Index.SKUIndexing
DCS.Search.Query.SKUIndexing Store.Storefront

*[D]  Deploy Production crs_production_v10.ear to Weblogic Online
  [R]  Register Datasources on Weblogic Online
  [A]  Add database driver to app server classpath
  [P]  Post Deployment Actions on Weblogic Online
  [E]  Edit runAssembler arguments
  [O]  Configure Another Server Instance
 > D

Once deployment of crs_production_v10.ear is done, go with next options like Register Datasource on Weblogic online, Add db driver to app server path,
& Post Deployment Actions on Weblogic online
-------DEPLOYMENT SERVER PRODUCTION start------------------------

-------DEPLOYMENT SERVER PUBLISHING start------------------------
  [C]  crs_production_v10 - Production - Done
*[P]  crs_publishing_v10 - Publishing with a Server Lock Manager
  [D]  Done

 Enter Ear File Name for Publishing with a Server Lock Manager [[atg_publishing_lockserver.ear]] > crs_publishing_v10.ear
Current runAssembler arguments :
-server crs_publishing_v10
Weblogic Admin Server must be running.

Top Level Module List:

DCS-UI.Search DCS-UI.Versioned BIZUI PubPortlet DafEar.Admin
B2CCommerce.Versioned DCS.Versioned DCS-UI Store.EStore.Versioned
Store.Storefront SiteAdmin.Versioned DAF.Search.Versioned DAF.Search.Routing
SearchAdmin.AdminUI DCS.Search.Versioned Store.Search Store.Search.Index
SiteAdmin.Search DCS.Search.Index.SKUIndexing DCS.Search.Query.SKUIndexing

*[D]  Deploy Publishing with a Server Lock Manager crs_publishing_v10.ear to
Weblogic Online
  [R]  Register Datasources on Weblogic Online
  [A]  Add database driver to app server classpath
  [P]  Post Deployment Actions on Weblogic Online
  [E]  Edit runAssembler arguments
  [O]  Configure Another Server Instance
 > d

Once deployment of crs_production_v10.ear is done, go with next options like Register Datasource on Weblogic online, Add db driver to app server path,
& Post Deployment Actions on Weblogic online
-------DEPLOYMENT SERVER PUBLISHING end------------------------
Once Above steps are done, exit CIM.

Checks & Validations before starting servers -

1) ATG servers that are created by CIM
Production server - C:\ATG\ATG10.0.3\home\servers\crs_production_v10
Publishing server - C:\ATG\ATG10.0.3\home\servers\crs_publishing_v10

2) Ear's that are created by CIM
Production ear - C:\ATG\ATG10.0.3\home\cimEars\crs_production_v10.ear
Publishing ear - C:\ATG\ATG10.0.3\home\cimEars\crs_publishing_v10.ear
Note: All ears are standalone ears

3) The runAssembler command used to create above ears by CIM is
For production ear -
runAssembler -server crs_production_v10  C:/ATG/ATG10.0.3/home/../home/cimEars/crs_production_v10.ear
 -m DafEar.Admin DPS DSS B2CCommerce DCS.PublishingAgent DCS.AbandonedOrderServices DAF.Search.Routing DCS.Search Store.Search DAF.Search.Base.QueryConsole DCS.Search.Index.SKUIndexing DCS.Search.Query.SKUIndexing Store.Storefront
For publishing ear -
runAssembler -server crs_publishing_v10  C:/ATG/ATG10.0.3/home/../home/cimEars/crs_publishing_v10.ear
 -m DCS-UI.Search DCS-UI.Versioned BIZUI PubPortlet DafEar.Admin B2CCommerce.Versioned DCS.Versioned DCS-UI Store.EStore.Versioned Store.Storefront SiteAdmin.Versioned DAF.Search.Versioned DAF.Search.Routing SearchAdmin.AdminUI DCS.Search.Versioned Store.Search Store.Search.Index SiteAdmin.Search DCS.Search.Index.SKUIndexing DCS.Search.Query.SKUIndexing

4) Weblogic servers that are created by CIM
In C:\bea10.3\user_projects\domains\CRSV10\config\config.xml
  <server>
    <name>crs_production_v10</name>
    <listen-port>7003</listen-port>
    <web-server>
      <web-server-log>
        <number-of-files-limited>false</number-of-files-limited>
      </web-server-log>
    </web-server>
    <listen-address></listen-address>
  </server>
  <server>
    <name>crs_publishing_v10</name>
    <listen-port>7005</listen-port>
    <web-server>
      <web-server-log>
        <number-of-files-limited>false</number-of-files-limited>
      </web-server-log>
    </web-server>
    <listen-address></listen-address>
  </server>

5) App deployments in Weblogic server done by CIM -
Note: By default <staging-mode>nostage</staging-mode> is not added in config.xml
Add <staging-mode>nostage</staging-mode> to each app-deployment, having this option
will not copy the ear to weblogic domain while starting which will consume time at server startup.
  <app-deployment>
    <name>crs_production_v10.ear</name>
    <target>crs_production_v10</target>
    <module-type>ear</module-type>
    <source-path>C:\ATG\ATG10.0.3\home\..\home\cimEars\crs_production_v10.ear</source-path>
    <security-dd-model>DDOnly</security-dd-model>
    <staging-mode>nostage</staging-mode>
  </app-deployment>
  <app-deployment>
    <name>crs_publishing_v10.ear</name>
    <target>crs_publishing_v10</target>
    <module-type>ear</module-type>
    <source-path>C:\ATG\ATG10.0.3\home\..\home\cimEars\crs_publishing_v10.ear</source-path>
    <security-dd-model>DDOnly</security-dd-model>
    <staging-mode>nostage</staging-mode>
  </app-deployment>
<

6) Before starting servers, make sure your lockmanagers are pointing to right host
In /c/ATG/ATG10.0.3/home/servers/crs_production_v10
./localconfig/atg/dynamo/service/ClientLockManager.properties:lockServerAddress=localhost
./localconfig/atg/dynamo/service/ClientLockManager_production.properties:lockServerAddress=localhost

In /cygdrive/c/ATG/ATG10.0.3/home/servers/crs_publishing_v10
./localconfig/atg/commerce/search/config/RemoteCatalogRankConfigAdapter.properties:remoteHost=localhost
./localconfig/atg/commerce/search/config/RemoteSearchUpdateAdapter.properties:remoteHost=localhost
./localconfig/atg/commerce/search/refinement/RemoteCatalogRefineConfigAdapter.properties:remoteHost=localhost
./localconfig/atg/dynamo/service/ClientLockManager.properties:lockServerAddress=localhost
./localconfig/atg/dynamo/service/ClientLockManager_production.properties:lockServerAddress=localhost

7) Make sure you have protocol.jar added to classpath, if not add it in
C:\bea10.3\user_projects\domains\CRSV10\bin\setDomainEnv.cmd
rem CIM - Prepending protocol.jar CLASSPATH
set CLASSPATH=C:/bea10.3/user_projects/domains/CRSV10/lib/protocol.jar;%CLASSPATH%
8) For faster server startup make sure that you have provided weblogic username/password in
C:\bea10.3\user_projects\domains\CRSV10\bin\startManagedWebLogic.cmd
set WLS_USER=weblogic
set WLS_PW=<weblogic password>
9) Make sure you have database drivers in your classpath.
CLASSPATH=C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar;

Starting weblogic servers
1) Starting production server
In command prompt -
Go to cd C:\bea10.3\user_projects\domains\CRSV10\bin
set JAVA_OPTIONS=-Datg.dynamo.server.name=crs_production_v10
startManagedWebLogic.cmd crs_production_v10
Once server is started.
http://localhost:7003/crs/storeus

As you can observe there wont be any images shown yet. They will be shown once you have a full deployment.



2) Starting publishing server
In command prompt -
Go to cd C:\bea10.3\user_projects\domains\CRSV10\bin
set JAVA_OPTIONS=-Datg.dynamo.server.name=crs_publishing_v10
startManagedWebLogic.cmd crs_publishing_v10
Once server is started.
http://localhost:7005/atg/bcc

=========== If you get errror START ====================
**** Error      Wed Jan 25 12:28:48 CST 2012    1327516128324   /atg/portal/framework/PortalObjectResolver      No root community folder for portal 'default'

You need to re-import BIZUI
Have below files
C:\ATG\ATG10.0.3\home\localconfig\atg\dynamo\service\jdbc\JTDataSource.properties
$class=atg.service.jdbc.MonitoredDataSource
dataSource=/atg/dynamo/service/jdbc/FakeXADataSource

C:\ATG\ATG10.0.3\home\localconfig\atg\dynamo\service\jdbc\FakeXADataSource.properties
$class=atg.service.jdbc.FakeXADataSource
URL=jdbc:oracle:thin:@localhost:1521:xe
user=crspubv10
password=password1
needsSeparateUserInfo=true
readOnly=false
driver=oracle.jdbc.xa.client.OracleXADataSource

In C:\ATG\ATG10.0.3>
C:\ATG\ATG10.0.3\BIZUI\install\importBizui.bat

before restart delete files - JTDataSource.properties &  FakeXADataSource.properties in localconfig.
=========== If you get errror END ====================

3) Full deployment -
Go to http://localhost:7005/atg/bcc
use login - admin/admin
Go to Content Adminstration->Admin Console

Go to Configuration tab -> Click on "Add Site"

Give Site Name as Production & see below options & Repository Mappings are selected.


Click on Agents tab, Click on "Add agent Site"

Give agent Name as "ProdAgent" and rmi port as rmi://localhost:8680/atg/epub/AgentTransport & press ">>". Please refer below screenshot & "Save Changes"


Click on Configuration tab & click on "Make Changes Live"


Go with "Do a full deployment" option & click on "Make Changes Live"

To Monitor deployment status, go to "Overview" tab & selection "production" site to check deployment status


Now check store
http://localhost:7003/crs/storeus


For login id's use "select * from dps_user" on crscorev10 schema
For example -
username - alex@example.com
password for all logins is "password"

Thats it, commerce reference store is ready for development.

Hope this helps!!