Programming
Combining XML in ATG
by Frank Kim on Jan.12, 2010, under Programming
(Photo: Legospective by Guillermо)
ATG uses XML files sometimes instead of Java properties files for configuration. Combining them is not as straight-forward as with Java properties files but more flexible.
The XML File Combination section in the Nucleus: Organizing JavaBean Components chapter of the ATG Programming guide gives a good explanation. You can combine XML files using one of these methods.
- replace
- remove
- append
- append-without-matching
- prepend
- prepend-without-matching
In most cases you will append. In one case I wanted to update the id-spaces for orders but I had to first remove before appending because replace did not work in this case. This is how I did it.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <id-spaces> <id-space xml-combine="remove" name="order" seed="1" batch-size="10000" prefix="o"/> <id-space name="order" seed="100" batch-size="1" prefix="m"/> </id-spaces>
To see the result of XML combining you can use the Dynamo Administration Server’s Component Browser to go to the component and then click on the property which specifies the XML file(s).
For example to find the result of combining idspaces.xml’s you would go to http://localhost:8080/dyn/admin/nucleus/atg/dynamo/service/IdGenerator/?propertyName=initialIdSpaces.
To find the result of combining productCatalogs.xml’s you would go to http://localhost:8080/dyn/admin/nucleus/atg/commerce/catalog/ProductCatalog/?propertyName=definitionFiles.
Debug ATG running on JBoss with Eclipse
by Frank Kim on Jul.27, 2009, under Programming
With Eclipse debugging an ATG application running on JBoss is fairly straightforward.
- Configure JBoss to start up with Java options for debugging.
On UNIX you do this by uncommenting this line in <JBoss>/bin/run.conf.
#JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"
On Windows you do this by uncommenting this line in <JBoss>/bin/run.bat.
rem set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y %JAVA_OPTS%
- Create a remote Java application debug configuration using the port you specified in step 1. The default port is 8787.
For further reading please see Debugging Nucleus components in JBoss with Eclipse or Remote Debugging with Eclipse. There is also a very complete tutorial from O’Reilly Media called Configuring Eclipse for Remote Debugging.
java.io.FileNotFoundException for valid URL
by Frank Kim on Sep.14, 2005, under Java SE, Programming
In one of our ATG servlet’s we were making a normal HTTP call to a page located on our ATG Dynamo server.
url = new URL(urlString);
connection = (HttpURLConnection)url.openConnection();
reader = new InputStreamReader(connection.getInputStream());
However when trying to get the input stream we got a FileNotFoundException yet we were able to go to the same URL using a browser. Googling around we found this lovely thread about the same problem.
To summarize the thread, the problem was in our proxy settings which are set on Windows in localconfig/environment.bat and on UNIX in localconfig/environment.sh. An example of proxy settings on Windows is set PROXY_ARGS=-Dhttp.proxyHost=192.168.1.134 -Dhttp.proxyPort=8080.
The proxy server did not recognize our machines as valid clients so it rejected our requests. Once we changed the proxyHost argument to point to a valid server then this problem was fixed.
JSP Dynamo Request Retrieval
by Frank Kim on Aug.30, 2005, under Page Development, Programming
In JHTML pages, the request object is of class DynamoHttpServletRequest which has many methods that are not part of the HttpServletRequest interface including the very useful resolveName method for looking up components in Nucleus.
In JSP pages on ATG there is no guarantee that the request object is of class DynamoHttpServletRequest. According to the JSP specification the request object always implements the HttpServletRequest interface.
If you need to get the DynamoHttpServletRequest do something like this:
DynamoHttpServletRequest dynRequest = atg.servlet.ServletUtil.getDynamoRequest(request);
If you need to get a PortalServletRequest do something like this:
PortalServletRequest portalRequest = (PortalServletRequest) request.getAttribute(atg.portal.servlet.Attributes.PORTALSERVLETREQUEST);

