• Entries (RSS)
  • Comments (RSS)

Find the version in WebSphere Commerce Developer

Posted by | Posted in WebSphere Commerce | Posted on 16-03-2010

Tagged Under : , , ,

Finding the version of WebSphere Commerce Developer.

Have you ever came across a situation like you want to know the version of WebSphere Commerce Product you are using and have no idea where to look for? I had. I know how to do this in WebSphere Commerce Developer 5.6.1 and the previous versions but not in WCS 6.

So to find the location of WebSphere Commerce Developer’s version, go to %WC_DEVELOPER_INSTALl_DIR%\properties\version\ and open file COMMERCE.product. In this file you can see a tag named version. This tag will have the version of WebSphere Commerce we are using.

WebSphere Commerce feature pack installation

Posted by | Posted in WebSphere Commerce | Posted on 14-03-2010

Tagged Under : , , ,

WebSphere Commerce Feature pack installation

WebSphere Commerce Feature pack installation is a straight forward job. Follow the below steps for installation of Feature packs in your machine. In order to install feature packs our WCS installation needs to be in some desired fix level. So the first thing is to apply the required fix levels in our WC installation.

We need WebSphere Commerce Update installer for installing WCS fix packs. So follow the below steps to install WebSphere Commerce update installer.

1. Download WebSphere Commerce Update installer from location

http://www.ibm.com/support/docview.wss?uid=swg24013502

2. Extract the contents and double click on install.exe and follow onscreen instructions. Please make sure that there is no space in your directory structure.

Too simple? Yeah we are done with the installation of WCS update installer. Now let us apply the fix packs to make our WCS installation to the required level.

3. Download the latest WCS fix pack from http://www-01.ibm.com/support/docview.wss?rs=3046&uid=swg21246009. I have downloaded fix pack 9 (6.0.0-WS-WCDeveloper-FP009.pak) from here.

4. Save the fix pack to %WCS_UPDATE_INSTALL_DIRECTORY%/maintenance directory.

5. Open WebSphere Commerce update installer.(Just double click on the update.bat from %WCS_UPDATE_INSTALL_DIRECTORY% )

6. Specify the WebSphere Commerce Developer installation directory, and click next.

7. Select Install Maintenance Package. Click Next.

8. Select the %WCS_UPDATE_INSTALL_DIRECTORY%/maintenance directory and click next.

9. Select the 6.0.0-WS-WCDeveloper-FP009.pak file and click next.

10. You are prompted to update the database. Select Yes to update your database automatically.

11. On the summary page, review the information and click Next.

12. Fix pack installation begin and the final screen will be displayed with a success message on the screen. If it failed please check the log files for trouble shooting. Click on Finish from this screen

13. Download the WebSphere Commerce feature pack package and extract to a temporary location

14. Double click on install.bat. The installation wizard opens. Click on Next

15. Accept the license agreement. Click on Next

16. Production selection page opens. Select the location where you have installed WebSphere Commerce Developer on this page. Click On Next

17. Installation summary page will be displayed. Click on Next

18. Click on Finish in installation result page

We have successfully installed the WCS feature pack in our machine.

WebSphere Commerce URLs

Posted by | Posted in WebSphere Commerce | Posted on 11-03-2010

Tagged Under : , ,

WebSphere Commerce URLs

This post is more to me. I usually find it difficult to remember different WebSphere Commerce URLs like commerce accelerator, org admin console etc. So I just want to keep all these URLs together in one place so that any time I can access it anytime I want :-)

Administration Console Logon
https://localhost:8002/webapp/wcs/admin/servlet/ToolsLogon?XMLFile=adminconsole.AdminConsoleLogon

WebSphere Commerce Accelerator Logon
https://localhost:8000/webapp/wcs/tools/servlet/ToolsLogon?XMLFile=common.mcLogon

Organization Administration Console Logon
https://localhost:8004/webapp/wcs/orgadmin/servlet/ToolsLogon?XMLFile=buyerconsole.BuyAdminConsoleLogon&storeId=0

DB Access
http://localhost/webapp/wcs/admin/servlet/db.jsp

Advanced B2B Direct starter store
https://localhost/webapp/wcs/stores/servlet/AdvancedB2BDirect/index.jsp

Consumer Direct starter store
https://localhost/webapp/wcs/stores/servlet/ConsumerDirect/index.jsp

Commerce Plaza starter store
http://localhost/webapp/wcs/stores/servlet/CommercePlaza/index.jsp

Supply chain starter store
http://localhost/webapp/wcs/stores/servlet/CommercePlaza/index.jsp

Madisons Web2 store
http://localhost/webapp/wcs/stores/servlet/Madisons2/index.jsp

CNTR0031W: Error starting CMP bean wcfull#WebSphereCommerceServerExtensionsData.jar

Posted by | Posted in WebSphere Commerce | Posted on 24-05-2009

Tagged Under : , , ,

CNTR0031W: Error starting CMP bean wcfull#WebSphereCommerceServerExtensionsData.jar#XXXX: 
 javax.naming.NameNotFoundException: Context: localhost/nodes/localhost/servers/server1, name: jdbc/Default: First component in name Default not found.  Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
	at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_resolve_complete_info(WsnOptimizedNamingImpl.java:968)
	at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.resolve_complete_info(WsnOptimizedNamingImplBase.java:1431)
	at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(Unknown Source)
	at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:3493)
	at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1521)
	..............................
 
JDBCPersister W CNTR0032W: Error creating CMP persister using datasource: jdbc/Default
BeanMetaData  E CNTR0035E: EJB container caught com.ibm.ejs.container.ContainerException: ; nested exception is: 
	com.ibm.websphere.cpi.CPIException: Persister creation failed.The bean's J2EEName is wcfull#WebSphereCommerceServerExtensionsData.jar#XXXX. The data source name is jdbc/Default.; nested exception is: 
	javax.naming.NameNotFoundException: Context: localhost/nodes/localhost/servers/server1, name: jdbc/Default: First component in name Default not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
	at com.ibm.ejs.container.BeanMetaData.completeInitialization(BeanMetaData.java:1299)
	at com.ibm.ws.runtime.component.EJBContainerImpl.createBeanMetaData(EJBContainerImpl.java:1039)
	at com.ibm.ws.runtime.component.EJBContainerImpl.createModuleMetaData(EJBContainerImpl.java:830)
	at com.ibm.ws.runtime.component.EJBContainerImpl.createMetaData(EJBContainerImpl.java:1575)
	at com.ibm.ws.runtime.component.MetaDataMgrImpl.createFactoryMetaData(MetaDataMgrImpl.java:115)
	......................

This was the exception I got when I tried to start my WebSphere Commerce Full Test environment after creating a new EJB. Even though the solution was very simple, for me it took some time to figure it out what exactly went wrong. If any of you facing the same problem, then here is the fix.

Open your ibm-ejb-jar-bnd.xmi file. Search for jdbc/Default. Here jdbc/Default is the name of the data source that was not found by the server. You will be able to see an entry like

	<defaultDatasource xmi:id="ResourceRefBinding_1242722240919" jndiName="jdbc/Default"/>

Just to remove the above line and your server will again start properly.

Oracle CLOB data type and Entity Beans in WebSphere Commerce Server

Posted by | Posted in WebSphere Commerce | Posted on 06-04-2009

Tagged Under : , ,

Oracle CLOB data type and Entity Beans in WebSphere Commerce Server.

We all know how to create an entity bean and access bean for a table that we have added newly if it contains String, Integer, Long etc data types. But when our new table has Oracle CLOB as the data type for one of the column, our access bean will not work properly. In this case in order to make our access bean working with CLOB/BLOB data type we need to edit the entity bean methods and use a session bean to store and retrieve the CLOB data. Follow the below steps to access an Oracle CLOB field from a CMP Entity bean. The trick is to use the JDBC calls to store and retrieve the CLOB data.

I am assuming that you have created a new entity bean (say NewTableBean) that has a field named ‘value’ which is of type Oracle CLOB. The data type for value field in our entity bean is a String.

1. The first step in making CLOB working for an entity bean is to create a session bean to perform our JDBC calls. When creating the session bean make sure that you have extended the session bean from com.ibm.commerce.base.helpers.BaseJDBCHelper

2. Add a method for retrieving the CLOB data using JDBC calls. The code for reading CLOB using JDBC is given below. In this case I named the method as findValueByPrimaryKey.

	public String findValueByPrimaryKey(Long primaryKey) 
			throws NamingException, SQLException {
		makeConnection();
 
		PreparedStatement ps = getPreparedStatement(
				"SELECT VALUE FROM XNEWTABLE WHERE NEWTABLE_ID = ?");
		ps.setLong(1, primaryKey.longValue());
 
		String stringTemp = null;
 
		try {
			ResultSet rs = executeQuery(ps, false);
 
			if (rs.next()) {
				Clob clobTemp = rs.getClob(1);
 
				if ((clobTemp == null) || ((int) clobTemp.length() == 0)) {
					stringTemp = null;
				} else {
					stringTemp = clobTemp.getSubString(1,
							(int) clobTemp.length());
				}
			}
		} finally {
			closeConnection();
		}
 
		return stringTemp;
	}

3. Add a method for updating the CLOB data using JDBC calls. The code for updating CLOB using JDBC is given below. In this case I have named my method as updateValueByPrimaryKey

	 public int updateValueByPrimaryKey(Long primaryKey,
		String value) throws NamingException, SQLException {
		int rowCount = -1;
		makeConnection();
 
		PreparedStatement stmt = getPreparedStatement(
				"UPDATE SET VALUE =? WHERE NEWTABLE_ID  =?");
		stmt.setLong(2, primaryKey.longValue());
 
		if (value == null) {
			stmt.setNull(1, Types.CLOB);
			rowCount = executeUpdate(stmt, false);
		} else {
			try {
				PreparedStatement stmt1 = getPreparedStatement(
						"UPDATE XNEWTABLE SET VALUE = empty_clob()  WHERE NEWTABLE_ID = ?");
				stmt1.setLong(1, primaryKey.longValue());
				stmt1.executeUpdate();
 
				PreparedStatement stmt2 = getPreparedStatement(
						"SELECT VALUE FROM XNEWTABLE WHERE NEWTABLE_ID=? FOR UPDATE");
				stmt2.setLong(1, primaryKey.longValue());
 
				ResultSet rs = stmt2.executeQuery();
 
				if (rs.next()) {
					Clob myClob = rs.getClob("VALUE");
					Writer writer = null;
					writer = ((oracle.sql.CLOB) myClob).getCharacterOutputStream();
 
					char[] aXMLDataData = value.toCharArray();
					writer.write(aXMLDataData);
					writer.flush();
					writer.close();
				} else {
					throw new ObjectNotFoundException();
				}
 
				rs.close();
			} catch (Exception e) {
				e.printStackTrace();
			}
 
			rowCount = 1;
		}
 
		return rowCount;
	}

Now we have both the methods for updating and reading the CLOB column is ready. The next step is to call these functions from our entity bean so that the CLOB columns also will be updated/retrieved when we use our access bean.

4. Open the entity bean class we have created and search for a method called _copyFromEJB. Replace the following code

	h.put("value", getType());

with this code.

	NewTableHelperSessionBean sbNewTable = new NewTableHelperSessionBean();
 
	try {
		h.put("value",
			sbNewTable.findValueByPrimaryKey(
				newTableId));
	} catch (NamingException e) {
		e.printStackTrace();
	} catch (SQLException e) {
		e.printStackTrace();
	}

Here NewTableHelperSessionBean is the session bean we have created for performing our CLOB JDBC operations.

The above code will make sure that our session bean code will be called when we access the CLOB field.

5. The next step is to call the session bean update method whenever we update our entity bean. For that open the entity bean class we have created and search for a method called _copyToEJB. Replace the following code

	 if (h.containsKey("value")) {
		setValue((localValue));
	}

With this one.

	NewTableHelperSessionBean sbNewTable = new NewTableHelperSessionBean();
 
	try {
		if (h.containsKey("value")) {
			sbNewTable.updateValueByPrimaryKey(newTableId,localValue);
		}
	} catch (NamingException e) {
		e.printStackTrace();
	} catch (SQLException e) {
		e.printStackTrace();
	}

This will make sure that whenever the user calls the commitCopyHeler our CLOB field will be properly updated by calling the new session bean method.

We are done with all the required changes to make our entity bean working even for a CLOB column type. Now generate the deployment and RMIC code and start using your access bean/ entity bean. Have fun.