Blog from an ATG Developer

May 24, 2010

Pipeline Error

Filed under: ATG,Eclipse — madhulal @ 12:51 am

I was trying to add new link to one of the chains inmcommerce pipeline.
I created a properties file for the component(link), then added a java file by implementing the PipelineProcessor. Added the new link in the commercepipeline.xml in the the required space. I did a build and restarted my jboss server. while starting up the server, I was seeing an error in the console about the pipeline issue. I was getting the following error.

19:31:51,750 INFO [PipelineManager] Starting PipelineManager.
19:31:52,390 INFO [STDOUT] **** Error
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] Sun May 23 19:31:52 CDT 2010
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] 1274661112390
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] /
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] Unable to resolve component /atg/commerce/PipelineManager
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] java.lang.NullPointerException
19:31:52,390 INFO [STDOUT] **** Error
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] Sun May 23 19:31:52 CDT 2010
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] 1274661112390
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] /
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] at atg.service.pipeline.PipelineBuilder.build(PipelineBuilder.java:284)

19:31:52,390 INFO [STDOUT] **** Error
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] Sun May 23 19:31:52 CDT 2010
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] 1274661112390
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] /
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] at atg.service.pipeline.PipelineManager.createFromXML(PipelineManager.java:352)

19:31:52,390 INFO [STDOUT] **** Error
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] Sun May 23 19:31:52 CDT 2010
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] 1274661112390
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] /
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] at atg.service.pipeline.PipelineManager.doStartService(PipelineManager.java:273)

19:31:52,390 INFO [STDOUT] **** Error
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] Sun May 23 19:31:52 CDT 2010
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] 1274661112390
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] /
19:31:52,390 INFO [STDOUT]
19:31:52,390 INFO [STDOUT] at atg.nucleus.GenericService.startService(GenericService.java:496)

19:31:52,406 INFO [STDOUT] **** Error
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] Sun May 23 19:31:52 CDT 2010
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] 1274661112390
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] /
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] at atg.nucleus.NucleusNameResolver.startService(NucleusNameResolver.java:1371)

19:31:52,406 INFO [STDOUT] **** Error
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] Sun May 23 19:31:52 CDT 2010
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] 1274661112390
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] /
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] at atg.nucleus.NucleusNameResolver.configureAndStartService(NucleusNameResolver.java:1133)

19:31:52,406 INFO [STDOUT] **** Error
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] Sun May 23 19:31:52 CDT 2010
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] 1274661112390
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] /
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] at atg.nucleus.NucleusNameResolver.createFromName(NucleusNameResolver.java:787)

19:31:52,406 INFO [STDOUT] **** Error
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] Sun May 23 19:31:52 CDT 2010
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] 1274661112390
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] /
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] at atg.nucleus.NucleusNameResolver.createFromName(NucleusNameResolver.java:569)

19:31:52,406 INFO [STDOUT] **** Error
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] Sun May 23 19:31:52 CDT 2010
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] 1274661112390
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] /
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] at atg.nucleus.NucleusNameResolver.createFromName(NucleusNameResolver.java:550)

19:31:52,406 INFO [STDOUT] **** Error
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] Sun May 23 19:31:52 CDT 2010
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] 1274661112390
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] /
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] ….stack trace CROPPED after 10 lines.

19:31:52,406 INFO [STDOUT] **** Error
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] Sun May 23 19:31:52 CDT 2010
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] 1274661112390
19:31:52,406 INFO [STDOUT]
19:31:52,406 INFO [STDOUT] /
19:31:52,406 INFO [STDOUT]
19:31:52,484 INFO [ItemPricingEngine] Pricing Engine starting up
19:31:52,546 INFO [STDOUT] **** Error
19:31:52,546 INFO [STDOUT]
19:31:52,546 INFO [STDOUT] Sun May 23 19:31:52 CDT 2010
19:31:52,546 INFO [STDOUT]
19:31:52,546 INFO [STDOUT] 1274661112546
19:31:52,546 INFO [STDOUT]
19:31:52,546 INFO [STDOUT] /
19:31:52,546 INFO [STDOUT]
19:31:52,546 INFO [STDOUT] Unable to set configured property “/atg/commerce/order/OrderTools.pipelineManager” atg.nucleus.ConfigurationException: Unable to resolve component /atg/commerce/PipelineManager

I could not understand the problem. I was concentrating more at the xml expecting some typos or some “xml-combine” issues. I had many unsuccessful attempts to rectify the problem. Finally I wanted to check the java file. I used Eclipse’s new class wizard to create the new class for the pipleline “link” component. In the wizard we can specify the interfaces and super class from which the new class implements and extends respectively. We have to implement two of the methods in order to extend the “PipelineProcessor” interface.
1. getRetCodes()
2. runProcess(Object arg0, PipelineResult arg1)

So by default, Eclipse gave me a default method body for these two methods and my getRetCodes() method looked like the following.

public int[] getRetCodes() {
return null;
}

I changed the method to the following.

public int[] getRetCodes() {
int[] ret = { 1 };
return ret;
}

Surprisingly that solved the issue. I was fuming my eyes and brain on this issue for quite some time. So please make sure that you give proper implementation to the overriding methods.I hope somebody would benefit from this post.

Cheers.

April 24, 2010

New Complete Project

Filed under: ATG — madhulal @ 12:26 pm

This time, I would like to share a POC I had done for one of my clients in ATG9.0. This module has been modified to remove all the client requirements. Now this is the Eclipse project. You can directly import it to the Eclipse IDE. You can do a complete checkout without log in and the order will be persisted even for anonymous profile without completing the order. I have not added any profile related functionality concentrating more on the commerce side. Hope it helps.

Version: ATG 9.0
Type: Ecommerce
Database: Oracle
App Server: jBoss
IDE : Eclipse
Java version : 1.5

To set up, please modify the build.properties, username.properties and you system environment variables to specify the settings. Please create a new server instance in jboss copying the default folder. Build the application. Once you are done with the build copy the oracle-ds.xml file to deploy folder and oracle jdbc driver to the server lib folder.

Please let me know your thoughts on this. Meanwhile I will continue adding features into it.
Thanks for reading.

Download it here

June 24, 2009

Deleting items in a Map

Filed under: Java — madhulal @ 10:47 am
Tags: , ,

Suppose we want to delete some items from a map based on indices, which is passed as an array. We can’t delete them by iterating through the array, because each time when we delete an item, the hash map shrinks by one. So the new index will be different from what we expect. We can use the following code to perform the operation without any delays.

public void deleteItemFromMap(String[] indexArray){
List beanList = getMap();
MyBean myBean = null;

int index = 0;
int newIndex;

if(indexArray!=null){
for (String indexString : indexArray) {
newIndex = Integer.parseInt(indexString) – index;
myBean = beanList.remove(newIndex);
if(null != myBean){
index = index + 1;
}
}
}

}

June 8, 2009

A very good Java Decompiler

Filed under: Decompiler,Eclipse,Java — madhulal @ 12:25 pm
Tags: ,

JD|Java Decompiler is one of the best decompiler I have used. Visit them here.

This can be used as a stand alone application as well as an eclipse plugin. This works like achieve application in case of of jar files.
The site url to be used is http://java.decompiler.free.fr/jd-eclipse/update

Need help in installing it in MyEclipse?. Download the word(docx) file here.

Give it a shot.

May 22, 2009

White Space problem in ATG Application

Filed under: ATG,JSP — madhulal @ 9:11 am
Tags: , , ,

We had an issue in one of the previous projects. The problem is that the html page getting generated has more white spaces and the resulting html size is too much. We can avoid this thing by modifying the deployment descriptor.

<init-param>
<param-name>trimSpaces</param-name>
<param-value>true</param-value>
</init-param>

Also we can use the following pattern to reduce white spaces alternatively in dsp pages.

<dspel:page
><dspel:droplet name=”/test”
><dspel:oparam name=”output”
>Name: <dspel:valueof param=”test”
/></dspel:oparam
></dspel:droplet
></dspel:page>

Another approach is to use JSP comments instead of new lines.

<dspel:page><%–
–%><dspel:droplet name=”/test”><%–
–%><dspel:oparam name=”output”><%–
–%>Name: <dspel:valueof param=”test”/><%–
–%></dspel:oparam><%–
–%></dspel:droplet><%–
–%></dspel:page>

NB:- I know the code fragments provided in the topics are very low in readability. Please blame WordPress….

Reference:
1. http://betweengo.com/2008/08/22/trim-white-space-from-jsp/
2. http://www.caucho.com/resin-3.0/jsp/faq.xtp

May 21, 2009

XSS – Cross Site Scripting Security Issue

Filed under: Website Security — madhulal @ 11:49 am

Websites get complex day by day with lot of dynamic content to display. So the vulnerability is also proportionate. Cross Site Security Issue is one of them. Let me explain this in terms of what I had faced.

So in an e-Commerce site, we normally have an option to search. Now we search for a term say “ffddjkl” . There is no result associated with that search term. So we display a message indicating that similar to following.

There are no results associated with the term ffddjkl.

Now suppose you have given <EMBED SRC=”http://www.htmlcodetutorial.com/graphics/sounds/1812over.mid&#8221; AllowScriptAccess=”always”></EMBED>in the search text field. Obviously there is no results for this term. So we display the the above message, with the new search text. Here comes the vulnerability, when you get the search results page, the midi file gets started to play. So you get the security catch, right?

Here we use the following code segment to display the message.

<fmt:message key=”resourceBundleKey”>
<fmt:param value=”${param.searchText}”/>
</fmt:message>

To avoid the vulnerability, we should have something like this.

<fmt:message key=”resourceBundleKey”>
<fmt:param>
<c:out value=”${param.searchText}” escapeXml=”true”/>
</fmt:param>
</fmt:message>

When you have a tag that doesn’t allow you to set the value by tag body rather than by attribute, use the following.

<c:set var=”myEscapedVar” scope=”page”>
<c:out value=”${param.someRequestParameter}” escapeXml=”true”/>
</c:set>
<some:tag value=”${pageScope.myEscapedVar}”/>

For more information on XSS information, visit the http://www.cgisecurity.com/xss-faq.html
Reference: http://michaelstudman.com/fullfathomfive/articles/2004/05/31/el-and-cross-site-scripting-attacks-jsp-2-functions-to-the-rescue

May 14, 2009

Encryption in ATG

Filed under: ATG,Encryption — madhulal @ 11:39 am

The Out of the box implementation uses the MD5 encryption algorithm.  Suppose we need to have some other encryption algorithm over MD5. My requirement was to add SHA-256 over the already encrypted value with MD5. The following are the changes I had done to get it done.

The component which does the encryption is DigestPasswordHasher. We need to override the encryptPassword() method.

The attached is the code fragment used . The copy and paste of the code seems weird. So I am attaching the file.

See it here.

ATG User Input Sample Code

Filed under: ATG,Learning — madhulal @ 11:09 am

The attached file contains the code for getting the user inputs. The jsp file gets the input from user in various forms.

1. Text field
2,. Checkbox
3. Dropdowns
4. Radio buttons

The zip file contains the FormHandler other than the jsp file.
Download it

May 7, 2009

Linux Help2 – File system

Filed under: Linux-Unix — madhulal @ 1:13 pm

Linux File System

Read more about the file system here.
http://linuxconfig.org/Filesystem_Basics

May 6, 2009

Linux Help 1

Filed under: Linux-Unix — madhulal @ 10:42 am

My Windows Xp system had a virus attack. That was horrible. I lost all of my data.
So started thinking Linux as an alternative. As a first step I had ordered for free CD of Ubuntu. Do it here

The following are the the useful and interesting things I have come across.

Ubuntu Pocket Guide and Reference
http://www.ubuntupocketguide.com/index_main.html

Unique Penguin
http://www.100mb.nl/

Bash command index
http://www.ss64.com/bash/

Linux Crashed.( i know its rare, but it happened.)
Ctrl+Alt+Del won’t work.

Find and press Alt and PrtSc buttons together. Then type REISUB,while
holding the above two buttons. The system will restart.
http://en.wikipedia.org/wiki/Magic_SysRq_key

Security FAQ
http://www.linuxsecurity.com/docs/colsfaq.html

Software Directory for GNOME
http://www.gnomefiles.org/

Popular Live CD List
http://www.livecdlist.com/?pick=All&sort=Purpose&sm=0

Next Page »

Create a free website or blog at WordPress.com.