<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MyArch &#187; Building software</title>
	<atom:link href="http://myarch.com/category/building-software/feed" rel="self" type="application/rss+xml" />
	<link>http://myarch.com</link>
	<description>Builds and bytes</description>
	<lastBuildDate>Mon, 30 Jan 2012 01:22:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>DPBuddy &#8212; Tool For DataPower Administrators and Developers</title>
		<link>http://myarch.com/dpbuddy-announcement</link>
		<comments>http://myarch.com/dpbuddy-announcement#comments</comments>
		<pubDate>Sat, 28 Aug 2010 16:28:06 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[Building software]]></category>
		<category><![CDATA[DataPower]]></category>
		<category><![CDATA[IT operations]]></category>
		<category><![CDATA[XML Appliances]]></category>
		<category><![CDATA[dpbuddy]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=677</guid>
		<description><![CDATA[We're pleased to announce the release of our new product, DataPower Buddy (dpbuddy). "dpbuddy" a free command-line tool for automating administration, management and deployment of IBM WebSphere DataPower appliances. The tool supports export/import, file transfer, backups and many other functions.

dpbuddy is implemented as a set of custom tasks for the popular build tool, Apache Ant.

Here [...]]]></description>
			<content:encoded><![CDATA[<p>We're pleased to announce the release of our new product, <a href="/dpbuddy">DataPower Buddy (dpbuddy)</a>. "dpbuddy" a free command-line tool for automating administration, management and deployment of <span class="caps">IBM</span> WebSphere DataPower appliances. The tool supports export/import, file transfer, backups and many other functions.</p>

<p>dpbuddy is implemented as a set of custom tasks for the popular build tool, <a href="http://ant.apache.org/">Apache Ant</a>.</p>

<p>Here is a quick example of dpbuddy in action: </p>


<pre>
<code>
&lt;dp:copy cleanDirectories=&quot;true&quot;&gt;
    &lt;dpFileset prefix=&quot;/apps/services&quot; 
               dir=&quot;services&quot; includes=&quot;**/*.wsdl **/*.xsd&quot;/&gt;
&lt;/dp:copy&gt;
</code>
</pre>


<p>This Ant task will remove remote directories if they exist, reproduce the local directory tree (all folders under "services") on the device and upload the necessary files based on the "includes" pattern.</p>

<p>dpbuddy is completely free; it can be downloaded from the <a href="/dpbuddy">dpbuddy product page</a></p>

<p>dpbuddy provides many cool features, including:</p>


<ul>
<li>Response from the device is presented in a human-readable form as opposed to raw <span class="caps">SOAP</span>/XML messages.  dpbuddy makes it easy to understand error and status messages.</li>
</ul>




<ul>
<li>Powerful remote "copy" command that automatically reproduces local directory tree on the device.</li>
</ul>




<ul>
<li>Tight integration with Ant. Ant variables can be used inside deployment policies and configuration files. </li>
</ul>




<ul>
<li>Easy-to-use alternative to deployment policies based on XPath. </li>
</ul>




<ul>
<li>Ability to remotely "tail" device logs. It is even possible to automatically get new log messages similarly to Unix "tail -f" command. "tail" task can also check for error patterns. </li>
</ul>




<ul>
<li>"Export" based on naming patterns. You don't need to know types ("classes") of DataPower objects; simply specify a regexp pattern and dpbuddy will export all objects matching this pattern.</li>
</ul>




<ul>
<li>Support for self-signed certificates. No need to add DataPower certificates to the <span class="caps">JDK </span>store.</li>
</ul>




<ul>
<li>Support for arbitrary <span class="caps">SOMA </span>requests. You can use Ant variables inside a request. </li>
</ul>




<ul>
<li>Parsing of all commands on the client. In case of <span class="caps">XML </span>errors, DataPower returns cryptic "internal error" message. The actual error then has to be extracted from the device logs. dpbuddy on the other hand validates management <span class="caps">XML </span>commands on the client and displays error messages right away. </li>
</ul>



<p>Go to <a href="/dpbuddy">dpbuddy product page</a> to learn more.</p>]]></content:encoded>
			<wfw:commentRss>http://myarch.com/dpbuddy-announcement/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ClassNotFoundException: A List of Dumb Things to Check</title>
		<link>http://myarch.com/classnotfound</link>
		<comments>http://myarch.com/classnotfound#comments</comments>
		<pubDate>Thu, 14 Jan 2010 05:12:50 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[Building software]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[WebSphere]]></category>
		<category><![CDATA[WebSphere Application Server Administration]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=549</guid>
		<description><![CDATA[	You deploy a new version of your application into production environment, hit the application&#8217;s URL  and get a 500 error with a long error stack and nasty &#8220;java.lang.ClassNotFoundException&#8221; in bold at the top.

	&#8220;Class Not Found&#8221; exceptions could be quite tricky to troubleshoot because of the complexity of Java Web applications and application servers they [...]]]></description>
			<content:encoded><![CDATA[	<p>You deploy a new version of your application into production environment, hit the application&#8217;s <span class="caps">URL </span> and get a 500 error with a long error stack and nasty &#8220;java.lang.ClassNotFoundException&#8221; in bold at the top.</p>

	<p>&#8220;Class Not Found&#8221; exceptions could be quite tricky to troubleshoot because of the complexity of Java Web applications and application servers they run on.  An average web application nowadays comes bundled with dozens of jar file (and probably thousands of classes). An average application server&#8217;s classpath is many pages long. Not to mention separately deployed libraries containing jar files shared by a group of applications. There should be little surprise that it is quite common for all these different jars and classloaders to clash with each other, get out of sync or become otherwise corrupt and mis-configured.</p>

	<p>The list below represents a subset of all the possible causes of &#8220;ClassNotFoundException&#8221;.  Hopefully this list could serve as a starting point for attacking the problem. The list was inspired by <a href="http://everythingsysadmin.com/dumb-things-to-check.html" title="">A List of Dumb Things to Check</a>.</p>

	<ul>
		<li>To start, determine a type of the offending class. Is it a an application class, a third-party library class, a class provided by the application server or a <span class="caps">JDK</span> class?  Determine the jar file that should contain the class. Determine where that jar should be located on the file system. Is it part of application installation, application server installation or some shared library installation? You may need to search for the class within multiple jars. Here is the command to do it (<a href="http://www.unix.com/shell-programming-scripting/21551-jar-file-search.html">source</a>): <code>  find . &lt;del&gt;name *.jar -print -exec jar -tvf {} ; | awk '/YOURSEARCHSTRING/ || /jar/ {print} ' </code> (note</del>-it won&#8217;t search within <span class="caps">EAR</span> and <span class="caps">WAR</span> files)</li>
		<li> Does the jar that&#8217;s supposed to contain the class exist on the file system?</li>
		<li> Are you able to &#8220;unjar&#8221; the jar using <code>jar -xvf</code>?  Does the jar indeed contain the package and class in question?</li>
		<li>Check the version of the jar if you can&#8217;t find the class there. To determine the version, look at the jar&#8217;s <span class="caps">MANIFEST</span>.MF. Usually (but, unfortunately, not  always) you will find some version information there. You can also compare the file size with the &#8220;baseline&#8221;.</li>
		<li>Does the account that the application server&#8217;s <span class="caps">JVM</span> was started with have read access to the jar? An application server usually runs under some sort of a system account. The jar might have been copied to the file system using a personal account from a different group.</li>
		<li>Have all application jars been updated during deployment? Are all the jars (including shared libraries) at the right version? Manual deployment process is quite common, so missing to update a jar is always a possibility.</li>
		<li>Is the class in question packaged with the application (e.g., under <span class="caps">WEB</span>-INF/lib) and being loaded by one of the parent classloaders? Most application servers utilize a classloader hierarchy where <span class="caps">WAR</span> file&#8217;s classloader is a child of <span class="caps">EAR</span> classloader which in turn is a child of the system (JVM) classloader. Parent classloaders can&#8217;t go down to request a class from a child classloader. The problem occurs if, for example, some jars were moved to a shared library but they still depend on classes packaged with the application.<br />
In order to diagnose this situation, you&#8217;ll need to have a good understanding of your application server&#8217;s classloader hierarchy.  <a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/crun_classload.html" title="">Here</a> is the information for WebSphere and  <a href="http://download.oracle.com/docs/cd/E15523_01/web.1111/e13706/classloading.htm" title="">here</a> is the WebLogic documentation on classloaders. <a href="http://josephamrithraj.wordpress.com/2010/02/24/class-loader-classnotfound-exception-in-websphere/" title="">Here</a> is another article covering WebSphere classloaders in depth.</li>
		<li>Is any of the jars packaged with the application also present on any of the parent classloader&#8217;s classpath? Running different versions of the same jar or library can cause all kinds of issues, including ClassNotFoundException.  Some app servers allow overriding default classloader behavior so that the jars packaged with the application are loaded first. This could fix the problem.</li>
		<li> If the jar with the class in question is part of a shared library (as opposed to packaged with the application), check if this library was made available to the application via the classloader configuration. For example, WebSphere configuration involves setting up a separate classloader for the library and explicitly associating it with the application.</li>
		<li>Is the version and patch level of the application server correct? Does it match your development environment? Look at the detailed version information for all the different components of your app servers and also get a list of installed patches. E.g., for WebSphere run <code>versionInfo -long</code> command.</li>
		<li> Is the application server running  under the right <span class="caps">JDK</span>? E.g., check if the server startup script relies on <span class="caps">JAVA</span>_HOME and see which <span class="caps">JDK</span> the <span class="caps">JAVA</span>_HOME points to.</li>
		<li>If the application runs in a cluster, does the problem occur on all nodes or just on some? Are you trying to troubleshoot the problem on the right node?</li>
		<li>If the classname is driven from a string, either in java source or some other file, have you spelled the class name correctly? (<a href="http://www.1060.org/blogxter/publish/5" title="">Steve Loughran</a>)</li>
	</ul>

	<p>Once again, this is by no means a complete list.  If anybody wants to contribute, please add a comment below and I&#8217;ll update the post.</p>


 ]]></content:encoded>
			<wfw:commentRss>http://myarch.com/classnotfound/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Automating Your Builds? Don&#8217;t Forget About Testing</title>
		<link>http://myarch.com/build-to-test</link>
		<comments>http://myarch.com/build-to-test#comments</comments>
		<pubDate>Sat, 05 Dec 2009 17:24:18 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[Building software]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=506</guid>
		<description><![CDATA[You're part of a development team that just started working on a brand new Java EE application and you're asked to put together a build script for this app. "Nothing can be easier" you think and you quickly put together a simple Ant script or a Maven POM file. Your build compiles Java code, runs [...]]]></description>
			<content:encoded><![CDATA[<p>You're part of a development team that just started working on a brand new Java EE application and you're asked to put together a build script for this app. "Nothing can be easier" you think and you quickly put together a <a href="http://techtracer.com/2007/04/16/the-great-ant-tutorial-a-great-jump-start/">simple Ant script</a> or a Maven POM file. Your build compiles Java code, runs JUnit tests and creates a WAR file for your app. Your job is done and you move on to more exciting and important tasks. </p>

<p>Unfortunately, your simple build, while being a good starting point, does not accomplish much. Contrary to what many developers think, the purpose of an automated build is not to automate production of executable code (be it a WAR file or an "exe"). Its purpose is to verify correctness of the code and to discover as many problems and defects as possible as quickly as possible. </p>

<p>It is common knowledge that it is much less costly to fix a defect during construction than during testing phase:</p>

<p><img src="/files/images/defect_cost.gif" alt="Cost to fix software defects" title="Cost to fix software defects" /></p>

<p>According to the chart above (source: <a href="http://software.isixsigma.com/library/content/c060719b.asp">Six Sigma</a> and  IBM Systems Sciences Institute) it is two times more costly to fix a bug during testing than during implementation. I think this difference is actually much higher. Our short-term (working) memory is extremely volatile. According to <a href="http://www.cs.umd.edu/class/fall2002/cmsc838s/tichi/attention.html">some studies</a>, the short term memory begins decaying after eighteen seconds. The cost of "context switching" for the brain <a href="http://www.codinghorror.com/blog/archives/000691.html">is very high</a>. In most organizations testing cycle takes at least a few weeks. This means that the bug that you just introduced will not be discovered for another few weeks at the earliest. When (or if!) it is finally discovered, most likely you'll be working on something entirely different. It will take at least a few hours for you just to recall all the details associated with the bug.</p>

<p>So the fact that your code compiles serves as a very weak indicator of code quality (although catching compilation problems early is important too, especially for large teams with high check-in volume). Automated testing must be done as part of every build. Most developers implement some automated testing using XUnit. In the majority of cases, these tests do not run against a deployed application, e.g., they do not hit a Web server. This kind of testing is useful, but it has its limitations. The main limitation is that we are not testing the application from the standpoint of its end users. For example, we're not testing AJAX logic running in a browser. Also, we're not testing the functionality that is dependent on an application server. Mock object frameworks help to a degree, but emulating application server's behavior could take some effort. Not to mention the fact that the "emulated" app server won't account for quirks of your "real" application server. In many cases there are subtle differences in app servers behavior, which is very often caused by differences in how classloader hierarchy is implemented. Reproducing these nuances using mock frameworks or even an embeddable servlet container, such as <a href="http://www.mortbay.org/jetty/">jetty</a>, is impossible.</p>

<p>The bottom line is that your automated build has to be able to deploy your application and run tests against it. Using a browser-based testing tool such as <a href="http://seleniumhq.org/">Selenium</a> will allow you to test your application as if it was used by end users, including testing of all your fancy AJAX features. Automating application deployments and testing does take some effort. Developing a comprehensive automated test suite could be a daunting tasks. But it is <a href="http://timothyfitz.wordpress.com/2009/02/10/continuous-deployment-at-imvu-doing-the-impossible-fifty-times-a-day/">certainly possible</a> and well worth it.</p>
]]></content:encoded>
			<wfw:commentRss>http://myarch.com/build-to-test/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PAnt Documentation Has Been Updated</title>
		<link>http://myarch.com/pant-documentation-has-been-updated</link>
		<comments>http://myarch.com/pant-documentation-has-been-updated#comments</comments>
		<pubDate>Mon, 30 Nov 2009 04:20:46 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[Ant]]></category>
		<category><![CDATA[Building software]]></category>
		<category><![CDATA[PAnt]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=502</guid>
		<description><![CDATA[We've just updated PAnt documentation to reflect changes implemented in PAnt 2.0. There are two significat changes: 



Support for Ant targets.
PAnt is now bundled with Ant Jython tasks that previously were available separately.




You can follow this guide to get started with PAnt.]]></description>
			<content:encoded><![CDATA[<p>We've just updated <a href="/pant">PAnt documentation</a> to reflect changes implemented in PAnt 2.0. There are two significat changes: </p>


<ul>
<li>Support for <a href="/pant2-targets">Ant targets</a>.</li>
<li>PAnt is now bundled with <a href="/ant-jython-task">Ant Jython tasks<a/> that previously were available separately.</li>
</ul>



<p>You can follow <a href="/pant-get-started">this guide</a> to get started with PAnt.</p>]]></content:encoded>
			<wfw:commentRss>http://myarch.com/pant-documentation-has-been-updated/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PAnt 1.5 is Released</title>
		<link>http://myarch.com/pant-15</link>
		<comments>http://myarch.com/pant-15#comments</comments>
		<pubDate>Tue, 14 Jul 2009 02:40:12 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[Ant]]></category>
		<category><![CDATA[Building software]]></category>
		<category><![CDATA[PAnt]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=308</guid>
		<description><![CDATA[	This is a major update to our popular python Ant wrapper.

	Notable changes in this release:

	
		Support for positional (as opposed to named) arguments, e.g., &#8220;pant.echo(&#8216;message&#8217;)&#8221;.
		Support for lists to express repeating elements.
		Support for &#8220;ant_&#8221; prefix to avoid conflicts with python keywords.
	

	More information is available from PAnt project page

	Please subscribe to our feed or follow us on twitter [...]]]></description>
			<content:encoded><![CDATA[	<p>This is a major update to our popular <a href="/pant">python Ant wrapper</a>.</p>

	<p>Notable changes in this release:</p>

	<ul>
		<li>Support for positional (as opposed to named) arguments, e.g., &#8220;pant.echo(&#8216;message&#8217;)&#8221;.</li>
		<li>Support for lists to express repeating elements.</li>
		<li>Support for &#8220;ant_&#8221; prefix to avoid conflicts with python keywords.</li>
	</ul>

	<p>More information is available from <a href="/pant">PAnt project page</a></p>

	<p>Please subscribe to our <a href="/feed">feed</a> or <a href="http://twitter.com/aananiev">follow us on twitter</a> to continue receiving updates about PAnt &#8211; new version is coming shortly.</p>
 ]]></content:encoded>
			<wfw:commentRss>http://myarch.com/pant-15/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eliminate the Need to Redeploy Your Web Files</title>
		<link>http://myarch.com/no-web-redeployment</link>
		<comments>http://myarch.com/no-web-redeployment#comments</comments>
		<pubDate>Sun, 10 May 2009 00:57:39 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[Building software]]></category>
		<category><![CDATA[Developer productivity]]></category>
		<category><![CDATA[WebSphere]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=256</guid>
		<description><![CDATA[	Some application servers require that location of the development workspace has to be different from the location of the deployed application. For example, you can easily point Tomcat to the root of your Web application using &#8220;docBase&#8221; of the &#8220;Context&#8221; element. But you&#8217;re out of luck with WebSphere Application Server (WAS). You have to go [...]]]></description>
			<content:encoded><![CDATA[	<p>Some application servers require that location of the development workspace has to be different from the location of the deployed application. For example, you can easily point Tomcat to the root of your Web application using &#8220;docBase&#8221; of the &#8220;Context&#8221; element. But you&#8217;re out of luck with WebSphere Application Server (WAS). You have to go through a separate application update process (using admin console or Rational Application Developer tooling) to synchronize your deployed application with the workspace. In my view, this update (a.k.a. &#8220;deployment&#8221;) step should never be required in a local development environment. It is one thing to have to deploy to a test or a production environment that consists of multiple servers that are segregated from the machine hosting the build artifacts. But in a situation when both the code and the application server are sitting on the same machine, the deployment step is redundant. We should be able to simply tell the app server where the code is and it can then do whatever is needed to load the code into <span class="caps">JVM</span>.</p>

	<p>Luckily, we can get pretty close to this vision with a few very simple (and free) tools.</p>

	<p>In my <a href="/instant-was-redeploy">previous post</a> I explained how to enable dynamic class reloading for WebSphere Application Server and avoid having to deploy your Java changes altogether. But what about changes to JSPs and other non-Java resources? How can we synchronize the directory used by the application server with the development workspace?</p>

	<p>Turns out, there is an Eclipse plugin that does exactly that. It&#8217;s <a href="http://andrei.gmxhome.de/filesync/index.html">Filesync plugin</a> developed by Andrei Loskutov.</p>

	<p>As the name implies, the plugin automatically synchronizes workspace directories with external directories by doing one-way copy of changed files. It allows to specify multiple directory pairs and also to define include/exclude patterns and even use variable substitution.</p>

	<p>To enable automatic updates of JSPs in the deployed application directory all you need to do is to define a folder pair that links web root in your workspace with the location of the exploded <span class="caps">WAS</span> directory in <span class="caps">WAS </span>(usually located under profile_root/installedApps/cell_name/app_name.ear/app_name.war).</p>

	<p>With <span class="caps">WAS</span> you need to watch for static &#8220;<%@ include %>&#8221; directives in your JSPs. <span class="caps">WAS</span> will not reload included files unless you also update including <span class="caps">JSP</span>. A workaround here is to turn everything into &#8220;jsp:include&#8221; actions or use <span class="caps">JSTL</span>&#8217;s &#8220;c:import&#8221;. There might be a slight performance penalty for doing that but improved productivity is well worth it.</p>

	<p>You can use Filesync plugin to synchronize your class files as well. This provides an alternative to the resource link-based approach that I described in the <a href="/instant-was-redeploy">previous post</a>. I still like using resource links better because they can be defined using Eclipse variables which makes it easier to share the configuration within a team. As far as I can tell, with Filesync you have to use absolute paths.</p>

	<p>Here&#8217;s how the filesync configuration screen looks like:<br />
<img src="/files/filesync/filesync.jpg" alt="Filesync configuration" /></p>

	<p>Another good use of Filesync is to pull jar files from an external directory. Projects typically have a repository-like location where all third-party jars are checked-in (or it could be a full-blown Maven repository). You can easily add an external jar to your classpath in Eclipse. But how to put it under &#8220;WEB-INF/lib&#8221; where it needs to end up for the application server? With filesync it can be done easily by adding yet another folder pair.</p>

	<p>In short, Filesync allows you to assemble your application &#8220;on the fly&#8221; without having to run an external build process. It also completely eliminates the need to explicitly update deployed applications.</p>


 ]]></content:encoded>
			<wfw:commentRss>http://myarch.com/no-web-redeployment/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Instantly Redeploy Your Classes to WebSphere Application Server</title>
		<link>http://myarch.com/instant-was-redeploy</link>
		<comments>http://myarch.com/instant-was-redeploy#comments</comments>
		<pubDate>Sun, 26 Apr 2009 22:56:10 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[Building software]]></category>
		<category><![CDATA[Developer productivity]]></category>
		<category><![CDATA[WebSphere]]></category>
		<category><![CDATA[WebSphere Application Server Administration]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=240</guid>
		<description><![CDATA[	Any developer wants to see the code changes instantaneously reflected in the application server.
However, when using WebSphere Application Server (WAS), developers usually have to go through the process of deploying an application to the server. Even though the deployment support is integrated into Rational Application Developer (RAD) or Eclipse WTP, it still introduces delays and [...]]]></description>
			<content:encoded><![CDATA[	<p>Any developer wants to see the code changes instantaneously reflected in the application server.<br />
However, when using WebSphere Application Server (WAS), developers usually have to go through the process of deploying an application to the server. Even though the deployment support is integrated into Rational Application Developer (RAD) or Eclipse <span class="caps">WTP</span>, it still introduces delays and impedes productivity. Not to mention that Eclipse <span class="caps">WTP</span> does not actually support <span class="caps">WAS 6</span>.1 runtimes, only 6.0.</p>

	<p>This is unfortunate because actually <span class="caps">WAS 6</span>.1 has  good support for <a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/trun_app_hotupgrade.html">dynamic reloading</a>. With dynamic reloading turned on, <span class="caps">WAS</span> monitors changes on the file system and automatically reloads the module (i.e., all classes loaded by the module&#8217;s classloader) when it detects a change. The reloading is almost instantaneous for simple modules. For complex modules with a lot of classes or initialization logic the reloading step could take a little bit of time but it is still faster than redeploying an entire application (you should check out <a href="http://www.zeroturnaround.com">Java Rebel</a> if you want a truly instantaneous deployment).</p>

	<p>With dynamic reloading all we need to do in order to make our changes available to the server is to update class files in the location where the deployed application resides. This is especially straightforward for web application and classes under <span class="caps">WEB</span>-INF/classes since <span class="caps">WAS</span> always explodes web application archives during deployment. In case of jar files (say the ones under <span class="caps">WEB</span>-INF/lib) the situation is a more complicated.</p>

	<p>Unfortunately, the location of the deployed application is usually different from the workspace where a developer makes changes. By default, deployed binaries are located under profile_root/installedApps/cell_name. While this location can be changed, the directory structure will still be somewhat different from how code is organized in the workspace.</p>

	<p>We could write a simple Ant script to copy changes, but this again introduces a special &#8220;pseudo-deployment&#8221; step. It would be nice if we could simply make a change in Eclipse, save it and let dynamic reloading kick in without any extra steps.</p>

	<p>Turns out that it is quite possible to make <span class="caps">WAS</span> and Eclipse behave this way.</p>

	<p>First, let&#8217;s configure <span class="caps">WAS</span>:</p>

	<ul>
		<li>Log in to <span class="caps">WAS</span> admin console and make sure that &#8220;Run in development mode&#8221; is checked for your sever. This is the default for standalone  installations.</li>
		<li>Deploy your application to <span class="caps">WAS</span> using <span class="caps">WAS</span> admin console.</li>
		<li>For convenience, you may want to specify a non-standard location for application binaries during installation to shorten the path, e.g., &#8220;was_installed_apps&#8221;. This step is optional.</li>
		<li>Go to &#8220;Enterprise applications/your_app/Class loading and update detection&#8221;.</li>
		<li>Make sure that &#8220;reload classes&#8221; is checked.</li>
		<li>Set reload interval to some reasonable number, say &#8220;3&#8221;. By default it&#8217;s set to &#8220;0&#8221; which means &#8220;never&#8221;. <span class="caps">IBM</span> recommends 3 seconds as an optimal interval, although I&#8217;ve been using 1 second without any issues (for relatively small modules though).</li>
		<li>Stop and start the application.</li>
	</ul>

	<p>Now let&#8217;s configure Eclipse. We will have to create a resource link pointing to the deployed application and configure the project to compile classes to the deployed location.</p>

	<ul>
		<li>Go to &#8220;Java Build Path&#8221; of the project. Click on &#8220;Browse&#8221; next to &#8220;Default output folder&#8221;.</li>
		<li>Click &#8220;Create New Folder&#8230;&#8221;, &#8220;Advanced&#8221;, check &#8220;Link to folder in the file system&#8221;.</li>
		<li>Click on &#8220;Browse&#8221; and locate the root of the exploded <span class="caps">WAR</span> file in the deployed application location. For example, for application &#8220;HelloWorldWeb&#8221; the path will be &#8220;profile_root/installedApps/cell_name/HelloWorldWeb.ear/HelloWorldWeb.war&#8221;. Give the link a meaningful name, e.g., &#8220;deployment&#8221;. Note: if you share .project and .classpath files with other developers, use Eclipse variables instead of the absolute path.</li>
		<li>Click OK. This will create a resource link that you can use to specify the output folder.</li>
		<li>Change the output folder to point to &#8220;project_name/link_name/WEB_INF/classes&#8221;, e.g., &#8220;HelloWorldWeb/deployment/WEB-INF/classes&#8221;. Click OK.</li>
		<li>Eclipse will recompile your project.</li>
		<li>From this point forward any class change will trigger dynamic reloading on the server.</li>
		<li>The resource link is also available in your package explorer, so you can browse and edit the deployed files. You need to be careful if you want to edit JSPs or other files that way as they will be overridden by the next full re-deployment.</li>
	</ul>

	<p>This techniques takes care of class files only. Dynamic reloading of <span class="caps">JSP</span> files is a different story.</p>

	<p>Note: This has been tested only with Eclipse 3.4 and <span class="caps">WAS 6</span>.1 and on modules with a relatively small code base. I&#8217;d be curious to know how effective this approach is for large modules.</p>


	<p><p style="font-size:smaller"><br />
This post is part of the <a href="/category/wasadmin">series on WebSphere Application Server administration</a>. Please <a href="/feed">subscribe to our blog</a> if you&#8217;d like to receive updates.<br />
</p><br />
<p style="font-size:smaller"><br />
<b>Note:</b>  We offer <a href="/services/middleware-operations-services"> professional services  in the area of WebSphere architecture, implementation and operations</a>.  If you&#8217;re looking for help with any of these tasks, please <a href="mailto:info@myarch.com"> let us know</a>.<br />
</p></p>


 ]]></content:encoded>
			<wfw:commentRss>http://myarch.com/instant-was-redeploy/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ant Task without Setters</title>
		<link>http://myarch.com/ant-task-without-setters</link>
		<comments>http://myarch.com/ant-task-without-setters#comments</comments>
		<pubDate>Wed, 25 Mar 2009 02:35:23 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[Ant]]></category>
		<category><![CDATA[Building software]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=230</guid>
		<description><![CDATA[	Ant uses reflection to pass data from XML to the Java class that implement an Ant task. For every attribute in XML, you have to define a setter in the Java task&#8217;s class.

	This works fine most of the time, however, in some cases there could be a need for a dynamic list of attributes. For [...]]]></description>
			<content:encoded><![CDATA[	<p>Ant uses reflection to pass data from <span class="caps">XML</span> to the Java class that implement an Ant task. For every attribute in <span class="caps">XML</span>, you have to define a setter in the Java task&#8217;s class.</p>

	<p>This works fine most of the time, however, in some cases there could be a need for a dynamic list of attributes. For example a task can pass attribute values to some external tool that has its own set of parameters that you don&#8217;t want to hardcode in Ant. Or you may simply like the flexibility of using dynamic attributes as opposed to predefined setters.</p>

In order to implement dynamic attributes, first you need to override &#8220;maybeConfigure&#8221; method in your Ant task and have it do nothing:
<pre>
<code>
public void maybeConfigure() throws BuildException {
}
</code>
</pre>


Then in your &#8220;execute&#8221; method you can access the map of attributes (that represents all attributes set in <span class="caps">XML</span>) as follows:
<pre>
<code>
RuntimeConfigurable configurator= getRuntimeConfigurableWrapper();
Map attributes=configurator.getAttributeMap();
String attr1=(String)attributes.get("attr1");
</code>
</pre>


 ]]></content:encoded>
			<wfw:commentRss>http://myarch.com/ant-task-without-setters/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exception Handling in WSAdmin Scripts</title>
		<link>http://myarch.com/exception-handling-in-wsadmin-scripts</link>
		<comments>http://myarch.com/exception-handling-in-wsadmin-scripts#comments</comments>
		<pubDate>Fri, 23 Jan 2009 04:20:59 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[Building software]]></category>
		<category><![CDATA[WebSphere]]></category>
		<category><![CDATA[WebSphere Application Server Administration]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=146</guid>
		<description><![CDATA[Using AdminTask in wsadmin often results in getting ugly stack traces. In fact, AdminTask always produces a full java stack trace even when the error is fairly innocuous (e.g., a resource name was mistyped). The stack trace in this situation is pretty useless; it could actually confuse operations staff as it might be interpreted as [...]]]></description>
			<content:encoded><![CDATA[<p>Using AdminTask in wsadmin often results in getting ugly stack traces. In fact, AdminTask always produces a full java stack trace even when the error is fairly innocuous (e.g., a resource name was mistyped). The stack trace in this situation is pretty useless; it could actually confuse operations staff as it might be interpreted as a problem in <span class="caps">IBM </span>code.</p>

<p>It is, in fact, quite easy to deal with this situation in Jython and suppress the annoying stack trace:</p>



<pre>
<code>
import sys
from com.ibm.ws.scripting import ScriptingException
...
    try:
        AdminTask....
    except ScriptingException:
        # note that we can't use &quot;as&quot; because of python 2.1 version, have to use sys
        print &quot;Error:\n&quot;+str(sys.exc_info()[1])
</code>
</pre>]]></content:encoded>
			<wfw:commentRss>http://myarch.com/exception-handling-in-wsadmin-scripts/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Building Windows NT</title>
		<link>http://myarch.com/building-nt</link>
		<comments>http://myarch.com/building-nt#comments</comments>
		<pubDate>Tue, 09 Dec 2008 01:52:36 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[Building software]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=118</guid>
		<description><![CDATA[	I&#8217;ve been reading a relatively old but nevertheless fascinating book called Showstopper about development of Windows NT. I was struck by the author&#8217;s account of NT&#8217;s build process, specifically its low degree of automation.

	NT was obviously a high-intensity, almost a death march kind of project and so the builds had to be churned out at [...]]]></description>
			<content:encoded><![CDATA[	<p>I&#8217;ve been reading a relatively old but nevertheless fascinating book called <a href="http://www.amazon.com/Show-Stopper-Breakneck-Generation-Microsoft/dp/0029356717/ref=sr_1_9?ie=UTF8&#038;s=books&#038;qid=1228778060&#038;sr=8-9" title="">Showstopper</a> about development of Windows NT. I was struck by the author&#8217;s account of NT&#8217;s build process, specifically its low degree of automation.</p>

	<p>NT was obviously a high-intensity, almost a death march kind of project and so the builds had to be churned out at a quick pace:<br />
<blockquote><br />
...the number of builds grew from a couple to a half dozen  some week&#8230;<br />
</blockquote></p>

	<p>This may not sound like much, but since NT was getting quite big and complex, it kept the guys in the build lab busy. The builds were so critical that at some point the technical lead of the project, <a href= "http://en.wikipedia.org/wiki/Dave_Cutler_(software_engineer)">Dave Cutler</a>, had to take over the build lab. This, however, did not improve the way builds were done. One of the members of the build team remembers:<br />
<blockquote><br />
He is not giving us the list, he&#8217;s basically saying, &#8216;Go to this directory and sync this file.&#8217; He&#8217;s saying,  &#8216;Pick up this file, do this, do that&#8217;.<br />
</blockquote><br />
The release process was pretty haphazard too according to another team member:<br />
<blockquote><br />
We have all these cowboy developers, just slinging code like crazy, calling out: &#8220;We need another build!&#8221;<br />
</blockquote><br />
And, of course, continuous integration was not invented yet:<br />
<blockquote><br />
We&#8217;d think we were all done for the day, then test the build and it wouldn&#8217;t boot. We&#8217;d run around looking for the programmer whose code broke it.<br />
</blockquote></p>

	<p>I don&#8217;t think this situation was unique to Microsoft back then. But I also think that the attitude toward CM and development process automation has changed over the last 16 years. Today, automated builds is pretty much the norm for all but the smallest projects. Continuous integration and automated testing is becoming widespread. There is a dizzying array of build systems, <a href="/yet-another-build-server" title="">build servers</a>, version control systems and other CM and development tools.</p>

	<p>There is a long way to go however. Implementing solid build/deployment and release management automation is still hard. Most large projects end up having to dedicate multiple highly skilled people to solving this problem. Home-grown script-based automation is still pretty much the state of the art. This is going to change. The tools will become more intelligent and advanced. I hope it won&#8217;t take another 16 years.</p>





 ]]></content:encoded>
			<wfw:commentRss>http://myarch.com/building-nt/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

