<?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; WebSphere Application Server Administration</title>
	<atom:link href="http://myarch.com/category/wasadmin/feed" rel="self" type="application/rss+xml" />
	<link>http://myarch.com</link>
	<description>Builds and bytes</description>
	<lastBuildDate>Sat, 28 Aug 2010 16:41:53 +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>WebSphere 7 Business Level Applications</title>
		<link>http://myarch.com/was7bla</link>
		<comments>http://myarch.com/was7bla#comments</comments>
		<pubDate>Tue, 02 Mar 2010 03:08:36 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[WebSphere]]></category>
		<category><![CDATA[WebSphere Application Server Administration]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=606</guid>
		<description><![CDATA[Application management, including deployment, has remained mostly unchanged since WAS  5. 

WAS 7, however, introduced a new concept -- "Business Level Applications" (BLA).  It would be more accurate to use the term "composite application" because this is what BLAs are -- it's a composition of  Java EE applications (WARs or EARs) or [...]]]></description>
			<content:encoded><![CDATA[<p>Application management, including deployment, has remained mostly unchanged since <span class="caps">WAS </span> 5. </p>

<p><span class="caps">WAS</span> 7, however, introduced a new concept -- "Business Level Applications" (BLA).  It would be more accurate to use the term "composite application" because this is what <span class="caps">BLA</span>s are -- it's a composition of  Java EE applications (WARs or <span class="caps">EAR</span>s) or other "assets".  </p>

<p>Unfortunately, the term "composite application" is already used in a <a href="http://www.ibm.com/developerworks/websphere/library/techarticles/1002_lau/1002_lau.html?ca=drs-">different context</a> by <span class="caps">IBM. </span></p>

<p>The word "asset" is another confusing and terribly overused term. In <span class="caps">WAS7 </span>it's  a "catch all" word for any kind of artifact, including jar, zip, and, with the introduction of <span class="caps">OSG</span>i support, an <span class="caps">OSG</span>i bundle (you need to have a <a href="https://www14.software.ibm.com/iwm/web/cc/earlyprograms/websphere/wasfposgiajp/">beta <span class="caps">OSGI </span>feature pack</a>   installed  to be able to use <span class="caps">OSG</span>i).</p>

<p><span class="caps">BLA</span>s are created by combining applications and assets together either using admin console or scripting. <span class="caps">BLA </span>configuration is saved under $profile_root/config/cells/$cell_name/blas. Assets are saved under $profile_root/config/cells/$cell_name/assets.</p>

<p>I can see two use cases for <span class="caps">BLA</span>s:</p>


<ul>
<li><span class="caps">BLA</span>s can be used to start and stop multiple Java EE applications at once. This might be useful if operationally several applications have to be treated together or if there are run-time dependencies between applications. This is especially the case if scripting is used; <code>AdminTask.startBLA</code> and <code>AdminTask.startBLA</code> provide an easy way to restart several "regular" applications.</li>
</ul>




<ul>
<li><span class="caps">BLA</span>s can be used to manage shared libraries. There is no way to deploy "traditional" shared libraries ("Environment/Shared Libraries") using Deployment Manager; you have to use scp or ftp to copy binaries to target servers. With <span class="caps">BLA </span>you can simply import "assets" (e.g., a jar file) using <code>AdminTask.importAsset</code> command. You can then reference the jar file using "SharedLibRelationship" option of AdminApp install/update commands. This will automatically create a classloader for this library (note--this might require server restart, at least for me it did).  Being able to use regular administration <span class="caps">API</span>s for managing shared libraries is certainly a welcome feature.</li>
</ul>



<p>Unfortunately, <span class="caps">BLA</span>s also have limitations:</p>


<ul>
<li>I was not able to find a way to create an asset consisting of multiple jars. This severely limits the usefulness of utilizing <span class="caps">BLA</span>s for managing shared libraries since a library will almost always consist of multiple jars. It is possible to import jars individually, but this is tedious and difficult to manage. </li>
</ul>




<ul>
<li>It is not possible to deploy multiple Java EE applications using <span class="caps">BLA</span>s. You still have to deploy applications individually. </li>
</ul>




<ul>
<li>There is no support for version information in <span class="caps">BLA </span>assets. This is unfortunate. I wish <span class="caps">IBM </span>though about integrating  <span class="caps">BLA </span>assets with Maven repositories and supporting true dependency management (e.g., version resolution, transitive dependencies, etc.). As of right now the only way to import multiple version of the same asset is to append a version number to the asset's file name.</li>
</ul>



<p>To summarize, the <span class="caps">BLA </span>idea has some promise but its current implementation is too limited to be truly useful.  I'm sure <span class="caps">IBM </span>will be evolving <span class="caps">BLA </span>in future <span class="caps">WAS </span>releases.</p>

<p>You can find more information about <span class="caps">BLA </span>in <a href="http://www.ibm.com/developerworks/websphere/techjournal/0905_edwards/0905_edwards.html">this article</a> and in <a href="http://www-01.ibm.com/support/docview.wss?rs=180&amp;%23038;uid=swg27017416">this webcast</a></p>]]></content:encoded>
			<wfw:commentRss>http://myarch.com/was7bla/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebSphere Adminstration: Getting Started with WebSphere Application Server Scripting</title>
		<link>http://myarch.com/getting-started-wsadmin</link>
		<comments>http://myarch.com/getting-started-wsadmin#comments</comments>
		<pubDate>Mon, 08 Feb 2010 03:52:03 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[WebSphere]]></category>
		<category><![CDATA[WebSphere Application Server Administration]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=597</guid>
		<description><![CDATA[If you're a WebSphere administrator or if you're trying to automate some tasks around the IBM WebSphere line of products, you'll inevitably be using WAS scripting (a.k.a. "wsadmin"). For the record, it is also possible to use Java and JMX-based APIs for automation, but it's is more complex and less documented. So  "wsadmin" scripting [...]]]></description>
			<content:encoded><![CDATA[<p>If you're a WebSphere administrator or if you're trying to automate some tasks around the <span class="caps">IBM</span> WebSphere line of products, you'll inevitably be using <span class="caps">WAS </span>scripting (a.k.a. "wsadmin"). For the record, it is also possible to use Java and <span class="caps">JMX</span>-based <span class="caps">API</span>s for automation, but it's is more complex and less documented. So  "wsadmin" scripting tool is the primary tool of trade for any WebSphere administrator.</p>

<p>There are several things that you need to do in order to be successful with wsadmin:</p>


<ul>
<li>Learn Python. Wsadmin uses Python as a language (JACL was deprecated a long time ago and should not be used) and relies on jython. Jython provides full implementation of Python language <a href="http://www.jython.org/docs/library/indexprogress.html">sans some libraries</a>. Needless to say that  good knowledge of Python is essential for developing wsadmin scripts. Most WebSphere admins have Java background. In my opinion (and speaking from personal experience), knowing Java does more harm than good for a Python developer. Java people usually speak Python "with accent" and have a hard time properly utilizing all python capabilities such as closures, list comprehensions and even modules and packages. It's no wonder, the two languages are very different. For example, in Java everything is a class and in most cases a class resides in its own file. In Python a module can encompass multiple classes and classes themselves are completely optional.  Learning how to properly use modules and classes takes some mental shift. </li>
</ul>




<ul>
<li>Invest in designing your scripts. I'm not even sure if "scripting" is the right word to use in this context. Scripts are usually relatively simple. Wsadmin scripts are anything but. A seemingly simple task of application deployment may require many lines of code if you want to do it right. Unless you're really trying to do something unsophisticated (e.g.,  <a href="/setting-heap-size">setting heap size</a>), you'll be developing a full-blown python application. Therefore, you'll need to think about its design. Python has excellent support for modules. You'll have at least one module in your application. Do not put any logic into the "main" file that you'll be calling from wsadmin. Instead, define appropriate functions and classes in your modules and call them from the main file.</li>
</ul>




<ul>
<li>Invest in setting up your development environment. Notepad or vi are not going to cut it. Remember, Python lacks compiler, so the only way to find out if your code is even syntactically correct is to execute it. That is, unless you use an <span class="caps">IDE, </span>such as <a href="http://pydev.org/">PyDev</a>. The latest version of PyDev is very good at detecting syntax errors and many other issues, such as uninitialized variables. It also has very decent (for a dynamic language) code completion.<br />
You will also need to setup your wsadmin shell script to supply python path (using <code>-javaoption &quot;-Dpython.path=your_path&quot;</code>). Do not forget to put python libraries (the ones that come with jython) on the python path. I prefer using <a href="/wsadmin-thin-client">thin administration client</a> as this is more flexible. I also <a href="/using-jython-221-with-wsadmin-tool">use 2.2.1 version of jython</a> since jython 2.1 that <a href="/was-70-is-still-on-jython-21">comes with wsadmin</a> is just too old and misses a lot of important language features.<br />
Another practical piece of advice is to never use "wsadmin -f" to test your scripts. Wsadmin takes eternity to come up, so running it every time you want to run your scripts is simply counterproductive. Instead, load it once and then run your script using Python "execfile" function. Don't forget to call <a href="http://docs.python.org/library/functions.html">reload</a> function for all modules that are part of your applications, otherwise you won't see the changes until your re-start wsadmin.</li>
</ul>




<ul>
<li>Help function is your best friend, so learn how to use it. I'm talking about the "help" function available for all key wsadmin modules (<a href="/admincontrol-vs-adminconfig">AdminConfig, AdminControl, etc</a>). Wsadmin <span class="caps">API</span>s, in my opinion, are poorly organized and difficult to learn. <a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.soafep.multiplatform.doc%2Finfo%2Fae%2Fae%2Frxml_taskoptions.html">Ten thousand options</a> available for AdminApp.install function is an example of that. Also,  "lists of lists" data structures used by AdminTask and AdminApp are truly baffling. In any event, I usually run a separate wsadmin window that I use solely for consulting "help". This is much faster than searching for the same information in InfoCenter.</li>
</ul>




<ul>
<li>Finally, you will need a testing environment. You can do some development using a standalone <span class="caps">WAS </span>installation but eventually you'll need to test your code against a Network Deployment environment with deployment manager and, ideally, multiple servers and multiple nodes. In other words, your test environment should resemble the target environments where you're going to run your scripts. There are many things that are impossible to test with just a standalone profile, one such example is <a href="/how-to-force-node-synchronization">node synchronization</a>.</li>
</ul>



<p>This post is part of the <a href="/category/wasadmin">series on WebSphere Application Server administration</a>. Please <a href="/feed">subscribe to this blog</a> if you'd like to receive updates. </p>]]></content:encoded>
			<wfw:commentRss>http://myarch.com/getting-started-wsadmin/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WebSphere Administration: Using Thin Administration Client</title>
		<link>http://myarch.com/wsadmin-thin-client</link>
		<comments>http://myarch.com/wsadmin-thin-client#comments</comments>
		<pubDate>Fri, 29 Jan 2010 04:46:34 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[WebSphere]]></category>
		<category><![CDATA[WebSphere Application Server Administration]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=581</guid>
		<description><![CDATA[Most people assume that in order to run WAS admin scripts, you need to have full WAS installation available on the client machine. This is not correct. Starting with WAS 6.1, it is possible to use the so-called administration thin client instead.

The thin client has many benefits:



The client consists of only two jars approximately 33MB [...]]]></description>
			<content:encoded><![CDATA[<p>Most people assume that in order to run <span class="caps">WAS </span>admin scripts, you need to have full <span class="caps">WAS </span>installation available on the client machine. This is not correct. Starting with <span class="caps">WAS</span> 6.1, it is possible to use the so-called <a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Ftxml_adminclient.html">administration thin client</a> instead.</p>

<p>The thin client has many benefits:</p>


<ul>
<li>The client consists of only two jars approximately 33MB in size, so you can set it up anywhere. With the traditional wsadmin client, you have to get <span class="caps">WAS </span>installed on your machine just so you can run wsadmin scripts. This is especially tedious if you have to deal with multiple versions of WebSphere products (and most large organizations have <span class="caps">WAS </span>versions in parallel). With the thin client you can just copy the two jars from an existing <span class="caps">WAS </span>installation onto a client machine.  The only catch is that <span class="caps">IBM JDK </span>(or, more precisely, a <span class="caps">JDK </span>containing <span class="caps">IBM </span>security provider -- on Sun and HP-UX <span class="caps">WAS </span>actually comes with the Sun <span class="caps">JDK</span>) is still required. You can copy it  from an existing install as well (I hope it doesn't violate any licensing terms). </li>
</ul>




<ul>
<li>Since the client's size is so small, you can add it to your version control or to your Maven repository. This makes the build more repeatable for developers (your build does include deploying to the application server and <a href="/build-to-test">running tests against it</a>, doesn't it?).</li>
</ul>




<ul>
<li>The shell script to run the thin client could be easily customized. For example, you may want to add some Java classes to wsadmin classpath. This will make it possible to invoke these classes from your wsadmin scripts. Or you <a href="/using-jython-221-with-wsadmin-tool">may want to use a more modern jython version</a> for your scripts. In fact <span class="caps">IBM </span>does't supply a shell script with the thin client, they just provide an <a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Ftxml_j2se.html">example</a> .</li>
</ul>



<p>You'll need to make sure that you update your client jars whenever the server installation is upgraded.</p>

<p>Oh, and if you're using WebSphere <span class="caps">ESB</span>/Process Server and want to utilize some of <span class="caps">WESB</span>-specific admin tasks (available from AdminTask object), you're out of luck; the thin client will not support those.</p>

<p>This post is part of the <a href="/category/wasadmin">series on WebSphere Application Server administration</a>. Please <a href="/feed">subscribe to this blog</a> if you'd like to receive updates. </p>]]></content:encoded>
			<wfw:commentRss>http://myarch.com/wsadmin-thin-client/feed</wfw:commentRss>
		<slash:comments>1</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>4</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 thought 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 thought 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>


 ]]></content:encoded>
			<wfw:commentRss>http://myarch.com/instant-was-redeploy/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WebSphere Administration: Setting Heap Size</title>
		<link>http://myarch.com/setting-heap-size</link>
		<comments>http://myarch.com/setting-heap-size#comments</comments>
		<pubDate>Mon, 30 Mar 2009 01:52:58 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[WebSphere]]></category>
		<category><![CDATA[WebSphere Application Server Administration]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=235</guid>
		<description><![CDATA[
Setting maximum heap size and changing other JVM parameters is a fairly common administration task. 
JVM configuration might be changing quite often during application development, usually as a result of performance testing.


Typically JVM parameters have to be updated for all application servers in a cell or at least for application servers that belong to a [...]]]></description>
			<content:encoded><![CDATA[<p>
Setting maximum heap size and changing other JVM parameters is a fairly common administration task. 
JVM configuration might be changing quite often during application development, usually as a result of performance testing.
</p>
<p>
Typically JVM parameters have to be updated for all application servers in a cell or at least for application servers that belong to a particular cluster. 
</p>
<p>
Conveniently, WebSphere Application Server (WAS) supports updating JVM parameters using its administration APIs, specifically, AdminConfig object.  This is illustrated by the script below.
</p>
<pre>
<code>
import sys

"""
Change JVM heap size for all application servers in a cell
"""
# New heap size is passed as a parameter to the script
max_heap_size=sys.argv[0]

# Get the string with config ids of all serves
server_confids=AdminConfig.list("Server")
# Iterate over all servers - config ids are separated by \n 
for server_confid in server_confids.split("\n"):
    server_confid=server_confid.strip()
    # obtain the type - types are APPLICATION_SERVER, DEPLOYMENT_MANAGER, NODE_AGENT, WEB_SERVER
    server_type=AdminConfig.showAttribute(server_confid, "serverType")
    # we're changing the heap size for application servers - we want to exclude node agents, etc.
    if server_type == "APPLICATION_SERVER":
        server_name=AdminConfig.showAttribute(server_confid, "name")
        # this is the query to get JavaVirtualMachine configuration object for a particular server
        jvm_path="/Server:%s/JavaProcessDef:/JavaVirtualMachine:/" % server_name
        jvm_confid=AdminConfig.getid(jvm_path)
        # "modify" accepts  a list of lists - each list contains name and value (odd choice I must say, why not use tuples?)
        AdminConfig.modify(jvm_confid, [["maximumHeapSize", max_heap_size]])

# Commit our changes to the repository        
AdminConfig.save()
</code>
</pre>
<p>
This post is part of the <a href="/category/wasadmin">series on WebSphere Application Server administration</a>. Please <a href="/feed">subscribe to this blog</a> if you'd like to receive updates. 
</p>
]]></content:encoded>
			<wfw:commentRss>http://myarch.com/setting-heap-size/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WebSphere Administration: Finding Cluster Members</title>
		<link>http://myarch.com/finding-cluster-members</link>
		<comments>http://myarch.com/finding-cluster-members#comments</comments>
		<pubDate>Mon, 16 Mar 2009 00:13:22 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[WebSphere]]></category>
		<category><![CDATA[WebSphere Application Server Administration]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=225</guid>
		<description><![CDATA[
There are many instances when it is necessary to find members (servers) that constitute a cluster. For example, to script starting and stopping an application, we need to know names of servers and nodes where the application is installed. Or we may want to restart all members of a cluster after some configuration change. 


As [...]]]></description>
			<content:encoded><![CDATA[<p>
There are many instances when it is necessary to find members (servers) that constitute a cluster. For example, to script starting and stopping an application, we need to know names of servers and nodes where the application is installed. Or we may want to restart all members of a cluster after some configuration change. 
</p>
<p>
As always, this is easy to do when you know what you're doing. A query-like activity in WAS environment usually heavily relies on AdminConfig object. Our example is no exception:
</p>
<pre>
<code>
import sys

"""
List application servers that belong to a particular cluster
Cluster name is passed as a parameter to the script
"""
cluster_name=sys.argv[0]

# Get configID of the cluster
cluster_conf_id = AdminConfig.getid("/ServerCluster:"+cluster_name )
if not cluster_conf_id:
    raise "Cluster %s does not exist!" % cluster_name

# Get confids of the cluster members
member_conf_ids = AdminConfig.showAttribute(cluster_conf_id, "members")
# AdminConfig returns the list in [], get rid of the brackets
member_conf_ids = member_conf_ids[1:-1]
print "Cluster %s has following members:" % cluster_name  
# split by space
for member_conf_id in member_conf_ids.split():
    # Obtain server name and node name
    member_name=AdminConfig.showAttribute(member_conf_id, "memberName")
    node_name=AdminConfig.showAttribute(member_conf_id, "nodeName")
    print node_name+"/"+member_name

</code>
</pre>
<p>
Now we can do a lot of useful things with <code>node_name</code> and <code>member_name</code> variables; for example, we can try to get an MBean of this server and check its state. Or we can attempt to restart it. I will cover this in one of the future posts.
</p>
<p>
This post is part of the <a href="/category/wasadmin">series on WebSphere Application Server administration</a>. Please <a href="/feed">subscribe to this blog</a> if you'd like to receive updates. 
</p>
]]></content:encoded>
			<wfw:commentRss>http://myarch.com/finding-cluster-members/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WebSphere Administration: How to Force Node Synchronization</title>
		<link>http://myarch.com/how-to-force-node-synchronization</link>
		<comments>http://myarch.com/how-to-force-node-synchronization#comments</comments>
		<pubDate>Thu, 12 Mar 2009 02:42:31 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[WebSphere]]></category>
		<category><![CDATA[WebSphere Application Server Administration]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=218</guid>
		<description><![CDATA[
It is often desirable to "push" configuration changes to nodes in the cell without having to wait for the periodic node sync process to kick in. This becomes a requirement if you want to run some kind of automated testing as part of your configuration/deployment process (which is a very good practice). For example, you [...]]]></description>
			<content:encoded><![CDATA[<p>
It is often desirable to "push" configuration changes to nodes in the cell without having to wait for the periodic node sync process to kick in. This becomes a requirement if you want to run some kind of automated testing as part of your configuration/deployment process (which is a very good practice). For example, you may have a build process which runs HTTPUnit tests immediately after the change. 
</p>
<p>
In this case, you really don't want to rely on any artificial "sleeps" and delays in your script, so triggering synchronization programmatically is the best option.
</p>
<p>
This is actually quite simple to accomplish, as illustrated by the following script:
<pre>
<code>
"""
Sync configuration changes with nodes
"""

# Commit changes to the configuration repository 
AdminConfig.save()

# Obtain deployment manager MBean
dm=AdminControl.queryNames("type=DeploymentManager,*")

# "syncActiveNodes" can only be run on the deployment manager's MBean, 
# it will fail in standalone environment
if dm:
    print "Synchronizing configuration repository with nodes. Please wait..."
    # Force sync with all currently active nodes
    nodes=AdminControl.invoke(dm, "syncActiveNodes", "true")
    print "The following nodes have been synchronized: "+str(nodes)
else:
    print "Standalone server, no nodes to sync"

</code>
</pre>
<p>
This post is part of the <a href="/category/wasadmin">series on WebSphere Application Server administration</a>. Please <a href="/feed">subscribe to this blog</a> if you'd like to receive updates. 
</p>]]></content:encoded>
			<wfw:commentRss>http://myarch.com/how-to-force-node-synchronization/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>WebSphere Administration: AdminControl vs AdminConfig</title>
		<link>http://myarch.com/admincontrol-vs-adminconfig</link>
		<comments>http://myarch.com/admincontrol-vs-adminconfig#comments</comments>
		<pubDate>Mon, 09 Mar 2009 04:17:05 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[WebSphere]]></category>
		<category><![CDATA[WebSphere Application Server Administration]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=199</guid>
		<description><![CDATA[AdminContol and AdminConfig are two key scripting objects that any WAS administrator must know by heart. 
The objects are available from wsadmin WAS administration tool. 
AdminConfig provides an interface to the WAS configuration repository available under profile_root/config. All AdminConfig services are provided by the Deployment Manager (assuming you're connecting remotely); there is no dependency on [...]]]></description>
			<content:encoded><![CDATA[<p>AdminContol and AdminConfig are two key scripting objects that any WAS administrator must know by heart. </p>
<p>The objects are available from <a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/welc6topscripting.html">wsadmin</a> WAS administration tool. </p>
<p>AdminConfig provides an interface to the WAS configuration repository available under profile_root/config. All AdminConfig services are provided by the Deployment Manager (assuming you're connecting remotely); there is no dependency on node agents.</p>
<p>AdminControl provides an interface to JMX managed beans (MBeans) in your WAS environment. In general, MBeans are only available for the resources that are running. For example, if an application server is down, the corresponding MBean will not be available.  </p>
<p>AdminConfig and AdminContol could complement each other nicely, especially when you need to find out the status of "things" in a WAS cell. To illustrate the point, here is a simple script that prints the status of all application servers within a cell:</p>
<pre>
<code>
"""
List all application servers in a cell and print their status (up or down)
"""

# Get the string with config ids of all serves
server_confids=AdminConfig.list("Server")
#Iterate over all servers - config ids are separated by \n
for server_confid in server_confids.split("\n"):
    server_confid=server_confid.strip()
    # obtain the type - types are APPLICATION_SERVER, DEPLOYMENT_MANAGER, NODE_AGENT, WEB_SERVER
    server_type=AdminConfig.showAttribute(server_confid, "serverType")

    # we are only interested in application servers
    if server_type == "APPLICATION_SERVER":
        # obtain the name of the server
        server_name=AdminConfig.showAttribute(server_confid, "name")
        print "Checking the state of the server %s of type %s" % (server_name, server_type) 

        #Now we can try to get the mbean of the server. We could've used AdminConfig.getObjectName() as
        #a shortcut, but for the sake of the example we'll use AdminControl explicitly

        # Query to search for mbeans - note the wildcard at the end to match the rest of mbean parameters
        # Note that we're simplifying a little bit since we're ignoring node names -
        # server names may not be unique within cell
        server_query="type=Server,name=%s,*" % server_name
        server_mbean=AdminControl.queryNames( server_query )
        # AdminContol returns None if there is no running mbean for this server
        if server_mbean:
            print "Server is up"
        else:
            print "Server is down!"
</code>
</pre>
<p>This post is part of the <a href="/category/wasadmin">series on WebSphere Application Server administration</a>. Please <a href="/feed">subscribe to this blog</a> if you'd like to receive updates. </p>
]]></content:encoded>
			<wfw:commentRss>http://myarch.com/admincontrol-vs-adminconfig/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Jython 2.2.1 with WSAdmin Tool</title>
		<link>http://myarch.com/using-jython-221-with-wsadmin-tool</link>
		<comments>http://myarch.com/using-jython-221-with-wsadmin-tool#comments</comments>
		<pubDate>Fri, 06 Feb 2009 03:40:34 +0000</pubDate>
		<dc:creator>Alexander Ananiev</dc:creator>
				<category><![CDATA[Ant]]></category>
		<category><![CDATA[WebSphere]]></category>
		<category><![CDATA[WebSphere Application Server Administration]]></category>

		<guid isPermaLink="false">http://myarch.com/?p=166</guid>
		<description><![CDATA[	In one of the previous posts I complained that wsadmin tool (which is the main WebSphere Application Server administration tool) still relies on Jython 2.1, which is quite old.

	The issue became critical when I realized that jython automatically re-compiles classes compiled with a different jython version. In my case, I was using Jython 2.2 for [...]]]></description>
			<content:encoded><![CDATA[	<p>In one of the previous posts I <a href="/was-70-is-still-on-jython-21" title="">complained</a> that wsadmin tool (which is the main WebSphere Application Server administration tool) still relies on Jython 2.1, which is quite old.</p>

	<p>The issue became critical when I realized that jython automatically re-compiles classes compiled with a different jython version. In my case, I was using Jython 2.2 for my Ant scripts and Jython 2.1 for wsadmin scripts. Some of the code was shared. This led to the situation of concurrent builds stepping on each other by dynamically re-compiling classes with different jython versions. The error looked something like that:</p>

<pre>
<code>
File "&lt;string&gt;", line 5, in ?
java.lang.ArrayIndexOutOfBoundsException: -4
at org.python.core.imp.createFromPyClass(Unknown Source)
</code>
</pre>

	<p>Bugs like that are always fun to troubleshoot.</p>

	<p>Going back to 2.1 was not an option for me since I use closures and &#8220;new classes&#8221; in quite a few places. So I tried putting jython 2.2.1 on wsadmin classpath and it worked without a hitch with <a href="/wsadmin-thin-client" title="">thin wsadmin client</a>. All my of wsadmin scripts work without a problem.</p>

	<p>Here is a <a href="/files/wsadmin/wsadmin_thin.bat" title="">sample wsadmin.bat file</a> that I use. This file utilizes thin client jars. Note how in line 85 my jython.jar (which is jython 2.2.1) is added to the classpath so it would override jython packages supplied with <span class="caps">WAS</span>.</p>

	<p>One possible downside of this approach is running into issues with <span class="caps">IBM</span> support in case if you need to open a <span class="caps">PMR</span> related to wsadmin scripting.</p>

 ]]></content:encoded>
			<wfw:commentRss>http://myarch.com/using-jython-221-with-wsadmin-tool/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
