<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>IT Developer World &#187; WebSphere</title>
	<atom:link href="http://itdevworld.wordpress.com/tag/websphere/feed/" rel="self" type="application/rss+xml" />
	<link>http://itdevworld.wordpress.com</link>
	<description>IT Related thoughts</description>
	<lastBuildDate>Tue, 01 Dec 2009 01:33:06 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='itdevworld.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/1d1eb8f45f88efe16b1fb8474a943568?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>IT Developer World &#187; WebSphere</title>
		<link>http://itdevworld.wordpress.com</link>
	</image>
			<item>
		<title>WebSphere eXtreme Scale 6 book review</title>
		<link>http://itdevworld.wordpress.com/2009/11/16/websphere-extreme-scale-6-book-review/</link>
		<comments>http://itdevworld.wordpress.com/2009/11/16/websphere-extreme-scale-6-book-review/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 00:40:48 +0000</pubDate>
		<dc:creator>rafaelri</dc:creator>
				<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[data cache]]></category>
		<category><![CDATA[data grid]]></category>
		<category><![CDATA[DynaCache]]></category>
		<category><![CDATA[eXtreme Scale]]></category>
		<category><![CDATA[high performance]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[low latency]]></category>
		<category><![CDATA[Packt Publishing]]></category>
		<category><![CDATA[WebSphere]]></category>

		<guid isPermaLink="false">http://itdevworld.wordpress.com/?p=232</guid>
		<description><![CDATA[Anyone designing a high performance transaction processing system has already needed at least a caching solution for increasing response time on frequently used data. But sometimes these data might become bigger than usual, those are times when you need a sofisticate
solution, something that can automatically fetch data from a slower storage, offload when not necessary, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=232&subd=itdevworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Anyone designing a high performance transaction processing system has already needed at least a caching solution for increasing response time on frequently used data. But sometimes these data might become bigger than usual, those are times when you need a sofisticate</p>
<div id="attachment_233" class="wp-caption alignright" style="width: 131px"><a href="http://www.packtpub.com/ibm-websphere-extreme-scale-6?utm_source=itdevworld.wordpress.com&amp;utm_medium=bookrev&amp;utm_content=blog&amp;utm_campaign=mdb_001416" target="_blank"><img class="size-thumbnail wp-image-233 " title="WebSphere eXtreme Scale" src="http://itdevworld.files.wordpress.com/2009/11/websphere-extreme.jpg?w=121&#038;h=150" alt="WebSphere eXtreme Scale" width="121" height="150" /></a><p class="wp-caption-text">WebSphere eXtreme Scale Book</p></div>
<p>solution, something that can automatically fetch data from a slower storage, offload when not necessary, split its contents between various nodes, &#8230;</p>
<p>If you require something like this then you&#8217;ll notice that you need a DataGrid solution.</p>
<p>By now you&#8217;ll be asking yourself why I am on that subject? Recently I&#8217;ve been kindly invited to review a book about <a href="http://www.packtpub.com/ibm-websphere-extreme-scale-6?utm_source=itdevworld.wordpress.com&amp;utm_medium=bookrev&amp;utm_content=blog&amp;utm_campaign=mdb_001416" target="_blank">IBM WebSphere eXtreme Scale</a> from <a href="http://www.packtpub.com/" target="_blank">Packt Publishing</a>.</p>
<p>Apart from this, I work on a project where we were already evaluating WebSphere eXtreme Scale as a replacement for <a href="http://www.redbooks.ibm.com/redbooks/pdfs/sg247393.pdf" target="_blank">WebSphere DynaCache</a>.</p>
<p>If you are in a hurry and want to have a sneak peak on the book contents, take a look at the sample chapter (<a href="http://www.packtpub.com/files/7443-getting-started-with-ibm-websphere-sample-chapter-7-the-datagrid-api.pdf" target="_blank">Chapter 7: &#8220;The DataGrid API&#8221;</a>) available for free on Packt Publishing website.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itdevworld.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itdevworld.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itdevworld.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itdevworld.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itdevworld.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itdevworld.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itdevworld.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itdevworld.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itdevworld.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itdevworld.wordpress.com/232/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=232&subd=itdevworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://itdevworld.wordpress.com/2009/11/16/websphere-extreme-scale-6-book-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/292a48d9cbe4c198ce280095a4e3fecc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rafaelri</media:title>
		</media:content>

		<media:content url="http://itdevworld.files.wordpress.com/2009/11/websphere-extreme.jpg?w=121" medium="image">
			<media:title type="html">WebSphere eXtreme Scale</media:title>
		</media:content>
	</item>
		<item>
		<title>WebSphere Concepts: Cell, Node, Cluster, Server&#8230;</title>
		<link>http://itdevworld.wordpress.com/2009/05/03/websphere-concepts-cell-node-cluster-server/</link>
		<comments>http://itdevworld.wordpress.com/2009/05/03/websphere-concepts-cell-node-cluster-server/#comments</comments>
		<pubDate>Sun, 03 May 2009 01:20:12 +0000</pubDate>
		<dc:creator>rafaelri</dc:creator>
				<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[Cell]]></category>
		<category><![CDATA[Cluster]]></category>
		<category><![CDATA[concepts]]></category>
		<category><![CDATA[Deployment Manager]]></category>
		<category><![CDATA[dmgr]]></category>
		<category><![CDATA[Node]]></category>
		<category><![CDATA[Node Agent]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[WebSphere]]></category>

		<guid isPermaLink="false">http://itdevworld.wordpress.com/?p=180</guid>
		<description><![CDATA[Quick post&#8230; If you are not familiar with WebSphere at first you might get confused with its concepts: cell, deployment manager, node, node agent, cluster, server, &#8230;
First of all, lets start with the concept of a Cell:
A Cell is a virtual unit that is built of a Deployment Manager and one or more nodes. I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=180&subd=itdevworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:left;">Quick post&#8230; If you are not familiar with WebSphere at first you might get confused with its concepts: cell, deployment manager, node, node agent, cluster, server, &#8230;</p>
<p style="text-align:left;">First of all, lets start with the concept of a Cell:</p>
<p style="text-align:left;">A <strong>Cell</strong> is a virtual unit that is built of a <a href="#DeploymentManager">Deployment Manager </a>and one or more nodes. I guess a picture will help making things clearer:</p>
<p style="text-align:left;">
<div id="attachment_181" class="wp-caption aligncenter" style="width: 485px"><a href="http://itdevworld.files.wordpress.com/2009/05/websphere-cell.jpg"><img class="size-full wp-image-181" title="WebSphere Cell" src="http://itdevworld.files.wordpress.com/2009/05/websphere-cell.jpg?w=475&#038;h=327" alt="WebSphere Cell" width="475" height="327" /></a><p class="wp-caption-text">WebSphere Cell</p></div>
<p style="text-align:left;">But still there are a few concepts that need to be explained. The next obvious one is the Deployment Manager.</p>
<p style="text-align:left;">The <strong><a name="DeploymentManager">Deployment Manager</a></strong> is a process (in fact it is an special WebSphere instance) responsible for managing the installation and maintenance of Applications, Connection Pools and other resources related to a J2EE environment. It is also responsible for centralizing user repositories for application and also for WebSphere authentication and authorization.</p>
<p style="text-align:left;">The Deployment Manager communicates with the Nodes through another special WebSphere process, the <a href="#NodeAgent">Node Agent</a>.</p>
<p style="text-align:left;">The <strong><a name="Node">Node</a></strong> is another virtual unit that is built of a Node Agent and one or more <a href="#Server">Server</a> instances.</p>
<p style="text-align:left;">The <strong><a name="NodeAgent">Node Agent</a></strong> it the process responsible for spawning and killing server processes and also responsible for configuration synchronization between the Deployment Manager and the Node. Extra care must be taken when changing security configurations for the cell, since communication between Deployment Manager and Node Agent is ciphered and secured when security is enabled, Node Agent needs to have configuration fully resynchronized when impacting changes are made to Cell security configuration.</p>
<p style="text-align:left;"><strong><a name="Server">Servers</a></strong> are regular Java process responsible for serving J2EE requests (eg.: serving JSP/JSF pages, serving EJB calls, consuming JMS queues, etc).</p>
<p style="text-align:left;">And to finish, <strong>Clusters</strong> are also virtual units that groups <a href="#Server">Servers</a> so resources added to the Cluster are propagated to every Server that makes up the cluster, this will in fact affect usually more than a single <a href="#Node">Node</a> instance.</p>
<p style="text-align:left;">Lets finish this post with another diagram to illustrate all those concepts.</p>
<p style="text-align:left;">
<div id="attachment_183" class="wp-caption aligncenter" style="width: 542px"><a href="http://itdevworld.files.wordpress.com/2009/05/websphere-concepts.jpg"><img class="size-full wp-image-183" title="WebSphere Concepts" src="http://itdevworld.files.wordpress.com/2009/05/websphere-concepts.jpg?w=532&#038;h=388" alt="WebSphere Concepts" width="532" height="388" /></a><p class="wp-caption-text">WebSphere Concepts</p></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itdevworld.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itdevworld.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itdevworld.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itdevworld.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itdevworld.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itdevworld.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itdevworld.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itdevworld.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itdevworld.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itdevworld.wordpress.com/180/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=180&subd=itdevworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://itdevworld.wordpress.com/2009/05/03/websphere-concepts-cell-node-cluster-server/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/292a48d9cbe4c198ce280095a4e3fecc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rafaelri</media:title>
		</media:content>

		<media:content url="http://itdevworld.files.wordpress.com/2009/05/websphere-cell.jpg" medium="image">
			<media:title type="html">WebSphere Cell</media:title>
		</media:content>

		<media:content url="http://itdevworld.files.wordpress.com/2009/05/websphere-concepts.jpg" medium="image">
			<media:title type="html">WebSphere Concepts</media:title>
		</media:content>
	</item>
		<item>
		<title>WebSphere custom user repository</title>
		<link>http://itdevworld.wordpress.com/2009/03/28/websphere-custom-user-repository/</link>
		<comments>http://itdevworld.wordpress.com/2009/03/28/websphere-custom-user-repository/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 02:27:26 +0000</pubDate>
		<dc:creator>rafaelri</dc:creator>
				<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[Custom Repository]]></category>
		<category><![CDATA[DatabaseServerLoginModule]]></category>
		<category><![CDATA[DataObject]]></category>
		<category><![CDATA[DB]]></category>
		<category><![CDATA[DBAdapter]]></category>
		<category><![CDATA[JBoss]]></category>
		<category><![CDATA[LDAP]]></category>
		<category><![CDATA[SDO]]></category>
		<category><![CDATA[VMM]]></category>
		<category><![CDATA[WebSphere]]></category>
		<category><![CDATA[WIM]]></category>
		<category><![CDATA[wimconfig.xml]]></category>

		<guid isPermaLink="false">http://itdevworld.wordpress.com/?p=171</guid>
		<description><![CDATA[If you already used JBoss you probably used (or at least knew there is) the DatabaseServerLoginModule. But, if you happen to be using WebSphere things are a little bit different. WebSphere (I guess version 6 onwards) comes with the powerful concept of the federated repository. This feature allows multiples sources for authentication and authorization. The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=171&subd=itdevworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you already used JBoss you probably used (or at least knew there is) the <a href="http://docs.jboss.org/jbossas/jboss4guide/r1/html/index.html" target="_blank">DatabaseServerLoginModule</a>. But, if you happen to be using WebSphere things are a little bit different. WebSphere (I guess version 6 onwards) comes with the powerful concept of the federated repository. This feature allows multiples sources for authentication and authorization. The final layout inside WebSphere ressembles an LDAP tree, every Repository is suffixed with an identifier.</p>
<p>But, unfortunately, through the Web Administration interface you are limited to LDAP and the builtin FileBased WIM authentication.</p>
<p>Another thing that makes it even harder is that there isn&#8217;t much documentation about these extended repositories.</p>
<p>There is <a href="http://www.ibm.com/developerworks/websphere/techjournal/0508_benantar/0508_benantar.html" target="_blank">one post from IBM that suggests that there are alternatives</a>:</p>
<blockquote><p>The information used for the registry lookup is customizable and can be made totally flexible if a custom registry is developed using the WebSphere Application Server custom registry interface.</p>
</blockquote>
<p>But still there isn&#8217;t a single link from this article that points out how to achieve this. If you get the <a href="http://www.google.com.br/search?q=websphere+application+server+custom+registry" target="_blank">key words in this phrase and risk a Google search </a>you&#8217;d end up finding <a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v4r0/index.jsp?topic=/com.ibm.websphere.v4.doc/wasa_content/050202.html" target="_blank">how to do this on WebSphere 4</a>, that, by the way, was much limitted when compared to what is available on WebSphere 6.</p>
<p><a href="http://www.google.com.br/search?q=websphere+application+server+custom+registry+6.1" target="_blank">Refining this search</a> a little bit you&#8217;ll find what you are looking for, <a href="http://www.ibm.com/developerworks/websphere/library/samples/vmmsampleadapter.html" target="_blank">how to do this on WebSphere 6</a>. But you&#8217;ll only take this approach if you are willing to roll your own adapter, but be advised that this tutorial won&#8217;t cover every steps you need and this is the content of another post. There is a <a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.javadoc.doc/vmm/com/ibm/wsspi/wim/package-tree.html" target="_blank">complex interface</a> that needs to be implemented in order to fulfill the requirements of an WebSphere Repository. The complexity is derived from the fact that all method in this interface is based on <code><a href="http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.emf.ecore.sdo.doc/references/javadoc/commonj/sdo/class-use/DataObject.html" target="_blank">commonj.sdo.DataObject</a> class and this class maps an XML to a Java Object hierarchy making for now this implementation almost a guessing game since there isn't much public information regarding this interface contract.</code></p>
<p>But, returning to the original objective of the post that was to guide on how to make WebSphere authenticate users against a database, setup the <a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/topic/com.ibm.websphere.wim.doc.en/database.html" target="_blank">DBAdapter</a> using the <a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/txml_config_vmmca.html" target="_blank">guide that is found on this page</a>. If you want, check the <a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.wim.doc.en/adapters.html" target="_blank">list of WebSphere builtin adapters here</a>.</p>
<p>The last step is to create the tables for the database as described on <a href="http://www.ibm.com/developerworks/websphere/techjournal/0701_ilechko/0701_ilechko.html" target="_blank">step 3 of this post</a>. This post in fact describes various possibilities for user repositories available in WebSphere.</p>
<p>JBoss <a href="http://docs.jboss.org/jbossas/jboss4guide/r1/html/index.html" target="_blank">DatabaseServerLoginModule</a> adantages over WebSphere approach are its simplicity and flexibility but on the other hand, WebSphere Federated Repositories present a much more robust approach for handling user databases.</p>
<p>I&#8217;ll try to post some tips on how to roll your own Repository in the next few days.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itdevworld.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itdevworld.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itdevworld.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itdevworld.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itdevworld.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itdevworld.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itdevworld.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itdevworld.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itdevworld.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itdevworld.wordpress.com/171/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=171&subd=itdevworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://itdevworld.wordpress.com/2009/03/28/websphere-custom-user-repository/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/292a48d9cbe4c198ce280095a4e3fecc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rafaelri</media:title>
		</media:content>
	</item>
		<item>
		<title>Monitoring a secured WebSphere installation through JOPR/RHQ</title>
		<link>http://itdevworld.wordpress.com/2009/02/01/monitoring-a-secured-websphere-installation-through-joprrhq/</link>
		<comments>http://itdevworld.wordpress.com/2009/02/01/monitoring-a-secured-websphere-installation-through-joprrhq/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 22:34:19 +0000</pubDate>
		<dc:creator>rafaelri</dc:creator>
				<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[ITM]]></category>
		<category><![CDATA[JMX]]></category>
		<category><![CDATA[JOPR]]></category>
		<category><![CDATA[JVM]]></category>
		<category><![CDATA[RHQ]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tivoli]]></category>
		<category><![CDATA[Tivoli Agent Builder]]></category>
		<category><![CDATA[Tivoli Monitoring]]></category>
		<category><![CDATA[WebSphere]]></category>

		<guid isPermaLink="false">http://itdevworld.wordpress.com/?p=126</guid>
		<description><![CDATA[Monitoring an WebSphere installation with security enabled using JOPR/RHQ may seem at first simple and indeed it is if it weren&#8217;t for a few missing parts on the JOPR agent and MC4J library.
For those in a hurry that don&#8217;t want to wait till it gets incorporated into JOPR and MC4J I&#8217;ll try to summarize the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=126&subd=itdevworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Monitoring an WebSphere installation with security enabled using JOPR/RHQ may seem at first simple and indeed it is if it weren&#8217;t for a few missing parts on the JOPR agent and MC4J library.<br />
For those in a hurry that don&#8217;t want to wait till it gets incorporated into JOPR and MC4J I&#8217;ll try to summarize the changes and also provide the JMX Agent jar to be replaced. Apart from this, there is a need to import the server certificate for WAS SOAP Admin port into the JVM that JOPR is running (I hope there&#8217;ll be a certificate management feature in JOPR in the future to make this even simpler).<br />
Let&#8217;s get to the changes.<br />
First of all download RHQ code from SVN.</p>
<pre class="brush: cpp;">
svn co http://svn.rhq-project.org/repos/rhq/tags/RHQ_1_1_0_GA/
</pre>
<p>Use tag 1.1.0 since I made the changes on top of that version.<br />
Replace the following file on JMX plugin:<br />
JMXServerComponent</p>
<pre class="brush: java;">
/*
* RHQ Management Platform
* Copyright (C) 2005-2008 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package org.rhq.plugins.jmx;

import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.mc4j.ems.connection.ConnectionFactory;
import org.mc4j.ems.connection.EmsConnection;
import org.mc4j.ems.connection.local.LocalVMFinder;
import org.mc4j.ems.connection.local.LocalVirtualMachine;
import org.mc4j.ems.connection.settings.ConnectionSettings;
import org.mc4j.ems.connection.support.ConnectionProvider;
import org.mc4j.ems.connection.support.metadata.ConnectionTypeDescriptor;
import org.mc4j.ems.connection.support.metadata.J2SE5ConnectionTypeDescriptor;
import org.mc4j.ems.connection.support.metadata.LocalVMTypeDescriptor;

import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pluginapi.inventory.ResourceContext;

/**
* The generic JMX server component used to create and cache a connection to a local or
* remote JMX MBeanServer. This component is responsible for building an isolated connection/classloader
* to the managed resource's JMX MBeanServer. Each connection is isolated from other connections
* created by other instances of this component. This allows for it to do things like manage
* multiple JBossAS servers that are running on the same box, even if they are of different JBossAS
* versions. The same holds true for Hibernate applications - multiple connections can be created
* to different versions of the Hibernate MBean and due to the isolation of each connection, there
* are no version incompatibility errors that will occur.
*
* @author Greg Hinkle
* @author John Mazzitelli
*/
public class JMXServerComponent implements JMXComponent {
private static Log log = LogFactory.getLog(JMXServerComponent.class);

private EmsConnection connection;
private ConnectionProvider connectionProvider;

ResourceContext context;

public void start(ResourceContext context) throws Exception {
this.context = context;
log.info(&quot;Starting connection to JMX Server &quot; + context.getResourceKey());

try {
internalStart();
} catch (Exception e) {
log.warn(&quot;JMX Plugin connection failure&quot;, e);
// The new model is to always succeed in starting, but warn about the errors (we only do this the first request)
/*throw new Exception(&quot;Unable to connect to Java VM [&quot;
+ configuration.getSimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY).getStringValue()
+ &quot;]&quot;, e);*/
}

if (connection == null) {
log.warn(&quot;Unable to connect to JMX Server &quot; + context.getResourceKey());
}
}

protected void internalStart() throws Exception {
Configuration configuration = context.getPluginConfiguration();

String connectionTypeDescriptorClass = configuration.getSimple(JMXDiscoveryComponent.CONNECTION_TYPE)
.getStringValue();

if (LocalVMTypeDescriptor.class.getName().equals(connectionTypeDescriptorClass)) {
String commandLine = configuration.getSimple(JMXDiscoveryComponent.COMMAND_LINE_CONFIG_PROPERTY)
.getStringValue();

Map vms = LocalVMFinder.getManageableVirtualMachines();
if (vms != null) {
for (LocalVirtualMachine vm : vms.values()) {
if (vm.getCommandLine().equals(commandLine)) {
connectLocal(vm.getVmid());
}
}
}
} else if (JMXDiscoveryComponent.PARENT_TYPE.equals(connectionTypeDescriptorClass)) {
// We're embedded in another jmx server component without jmxremoting set so just use the parent's connection
this.connection = ((JMXComponent) context.getParentResourceComponent()).getEmsConnection();
this.connectionProvider = this.connection.getConnectionProvider();
} else if (J2SE5ConnectionTypeDescriptor.class.getName().equals(connectionTypeDescriptorClass)) {
// We're embedded in a J2SE VM with jmxremote defined (e.g. for jconsole usage)
String principal = null;
String credentials = null;
PropertySimple o = configuration.getSimple(JMXComponent.PRINCIPAL_CONFIG_PROP);
if (o != null) {
principal = o.getStringValue();
}
o = configuration.getSimple(JMXComponent.CREDENTIALS_CONFIG_PROP);
if (o != null) {
credentials = o.getStringValue();
}

ConnectionSettings settings = new ConnectionSettings();
J2SE5ConnectionTypeDescriptor desc = new J2SE5ConnectionTypeDescriptor();
settings.setConnectionType(desc);
settings.setServerUrl(configuration.getSimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY)
.getStringValue());
if (principal != null) {
settings.setPrincipal(principal);
}
if (credentials != null) {
settings.setCredentials(credentials);
}

prepareConnection(settings);

} else {
// This can handle internal connections (within the same vm as the plugin container) as well as
// any remote connections
ConnectionSettings settings = new ConnectionSettings();

String principal = null;
String credentials = null;
PropertySimple o = configuration.getSimple(JMXComponent.PRINCIPAL_CONFIG_PROP);
if (o != null) {
principal = o.getStringValue();
}
o = configuration.getSimple(JMXComponent.CREDENTIALS_CONFIG_PROP);
if (o != null) {
credentials = o.getStringValue();
}

settings.initializeConnectionType((ConnectionTypeDescriptor) Class.forName(connectionTypeDescriptorClass)
.newInstance());

settings.setConnectionType((ConnectionTypeDescriptor) Class.forName(connectionTypeDescriptorClass)
.newInstance());
settings.setServerUrl(configuration.getSimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY)
.getStringValue());

String installPath = configuration.getSimpleValue(JMXDiscoveryComponent.INSTALL_URI, null);
if (installPath != null) {
settings.setLibraryURI(configuration.getSimple(JMXDiscoveryComponent.INSTALL_URI).getStringValue());
}

if (principal != null) {
settings.setPrincipal(principal);
}
if (credentials != null) {
settings.setCredentials(credentials);
}
prepareConnection(settings);
}

this.connection.loadSynchronous(false);

}

public void stop() {
if (connection != null) {
connection.close();
connection = null;
}
}

protected void connectLocal(int vmid) {
// TODO GH: Refactor ems to also accept the vm itself
ConnectionSettings settings = new ConnectionSettings();
settings.setConnectionType(new LocalVMTypeDescriptor());
settings.setServerUrl(String.valueOf(vmid));
prepareConnection(settings);
}

protected void prepareConnection(ConnectionSettings settings) {
settings.getControlProperties().setProperty(ConnectionFactory.COPY_JARS_TO_TEMP, String.valueOf(Boolean.TRUE));
settings.getControlProperties().setProperty(ConnectionFactory.JAR_TEMP_DIR,
this.context.getTemporaryDirectory().getAbsolutePath());

addAdditionalJarsToConnectionSettings(settings);

ConnectionFactory cf = new ConnectionFactory();
cf.discoverServerClasses(settings);

this.connectionProvider = cf.getConnectionProvider(settings);
this.connection = this.connectionProvider.connect();
}

public EmsConnection getEmsConnection() {
return this.connection;
}

public AvailabilityType getAvailability() {
if (connectionProvider == null || !connectionProvider.isConnected()) {
try {
internalStart();
} catch (Exception e) {
log.debug(&quot;Still unable to reconnect resource: &quot; + context.getResourceKey() + &quot; due to error: &quot;
+ e.getMessage());
}
}

return ((connectionProvider != null) &amp;&amp; connectionProvider.isConnected()) ? AvailabilityType.UP
: AvailabilityType.DOWN;
}

public List discoverServices(ResourceType type, Configuration defaultPluginConfiguration) {
defaultPluginConfiguration.getSimple(&quot;objectName&quot;).getStringValue();

return null;
}

private void addAdditionalJarsToConnectionSettings(ConnectionSettings settings) {
// get the plugin config setting that contains comma-separated list of files/dirs to additional jars
// if no additional classpath entries are specified, we'll return immediately and not do anything to settings
Configuration pc = context.getPluginConfiguration();
PropertySimple prop = pc.getSimple(JMXDiscoveryComponent.ADDITIONAL_CLASSPATH_ENTRIES);
if (prop == null || prop.getStringValue() == null || prop.getStringValue().trim().length() == 0) {
return;
}
String[] paths = prop.getStringValue().trim().split(&quot;,&quot;);
if (paths == null || paths.length == 0) {
return;
}

// get the current set of class path entries - we are going to add to these
List entries = settings.getClassPathEntries();
if (entries == null) {
entries = new ArrayList();
}

// Get all additional classpath entries which can be listed as jar filenames or directories.
// If a directory has &quot;/*.jar&quot; at the end, all jar files found in that directory will be added
// as class path entries.
final class JarFilenameFilter implements FilenameFilter {
public boolean accept(File dir, String name) {
return name.endsWith(&quot;.jar&quot;);
}
}

for (String path : paths) {
path = path.trim();
if (path.length() &gt; 0) {
if (path.endsWith(&quot;*.jar&quot;)) {
path = path.substring(0, path.length() - 5);
File dir = new File(path);
File[] jars = dir.listFiles(new JarFilenameFilter());
if (jars != null &amp;&amp; jars.length &gt; 0) {
entries.addAll(Arrays.asList(jars));
}
} else {
File pathFile = new File(path);
entries.add(pathFile);
}
}
}

// now that we've appended our additional jars, tell the connection settings about the new list
settings.setClassPathEntries(entries);

return;
}
}
</pre>
<p>Also, download MC4J libraries patch it with the changed class below and replace it inside JMX plugin after it is built (sincerely as I don&#8217;t use maven I don&#8217;t know a cleaner way of replacing it prior to build).<br />
Below the changed code for WebsphereConnectionProvider:</p>
<pre class="brush: java;">
/*
* Copyright 2002-2004 Greg Hinkle
*
* Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.mc4j.ems.impl.jmx.connection.support.providers;

import org.mc4j.ems.impl.jmx.connection.support.providers.proxy.GenericMBeanServerProxy;

import javax.management.MBeanServer;
import javax.management.j2ee.Management;
import javax.naming.Context;
import javax.naming.NamingException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.URI;
import java.security.Security;
import java.util.Properties;

/**
* This Node acts as a connection to a WebSphere(tm) MBean Server (TMX4J based).
*
* @author Greg Hinkle (ghinkle@users.sourceforge.net), January 2004
* @version $Revision: 575 $($Author: ghinkl $ / $Date: 2006-05-21 23:38:53 -0300 (Dom, 21 Mai 2006) $)
*/
public class WebsphereConnectionProvider extends AbstractConnectionProvider {

protected GenericMBeanServerProxy statsProxy;
protected MBeanServer mbeanServer;
private Management mejb;

private static final String MEJB_JNDI = &quot;ejb/mgmt/MEJB&quot;;

protected void doConnect() throws Exception {
Context ctx = null;

ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();

Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());

try {

//System.setProperty(&quot;jmx.serial.form&quot;, &quot;1.0&quot;);

/* From a WS admin article
Properties clientProps = new Properties();
connectProps.setProperty(AdminClient.CONNECTOR_TYPE,
AdminClient.CONNECTOR_TYPE_SOAP);
connectProps.setProperty(AdminClient.CONNECTOR_HOST, &quot;localhost&quot;);
connectProps.setProperty(AdminClient.CONNECTOR_PORT, &quot;8879&quot;);

AdminClient adminClient = null;
try
{
adminClient = AdminClientFactory.createAdminClient(clientProps);
}
catch (ConnectorException e)
{
System.out.println(&quot;Exception creating admin client: &quot; + e);
}
*/

Class adminClientClass =
Class.forName(&quot;com.ibm.websphere.management.AdminClient&quot;, true, this.getClass().getClassLoader());
Class adminClientFactoryClass =
Class.forName(&quot;com.ibm.websphere.management.AdminClientFactory&quot;);

// TODO GH: LATEST! This works from a SUN VM...
// Autodetect the vm and suggest the correct factory
// Hashtable env = new Hashtable();
// env.put(Context.INITIAL_CONTEXT_FACTORY,
// &quot;com.sun.jndi.cosnaming.CNCtxFactory&quot;);
// env.put(Context.PROVIDER_URL, &quot;corbaname:iiop:localhost:2809/NameServiceServerRoot&quot;);
//env.put(Context.PROVIDER_URL, &quot;iiop://localhost:2809/NameServiceServerRoot&quot;);
// ctx = new InitialContext(env);
//this.mejb = retrieveMEJB(ctx);

/*
Properties orbprops = new Properties();
orbprops .put(&quot;org.omg.CORBA.ORBClass&quot;, &quot;com.ibm.CORBA.iiop.ORB&quot;);
orbprops .put(&quot;com.ibm.CORBA.ORBInitRef.NameService&quot;,
&quot;corbaloc:iiop:localhost:2809/NameService&quot;);
orbprops .put(&quot;com.ibm.CORBA.ORBInitRef.NameServiceServerRoot&quot;,
&quot;corbaloc:iiop:localhost:2809/NameServiceServerRoot&quot;);
ORB _orb = ORB.init((String[])null, orbprops );

org.omg.CORBA.Object obj = _orb.resolve_initial_references(&quot;NameService&quot;);
NamingContextExt initCtx = NamingContextExtHelper.narrow(obj);
Object objref = initCtx.resolve_str(&quot;java:comp/env/ejb/mgmt/MEJB&quot;);
ManagementHome home =
(ManagementHome)PortableRemoteObject.narrow(objref,ManagementHome.class);
this.mejb = home.create();
*/

//props.put(Context.SECURITY_PRINCIPAL, connectionSettings.getPrincipal());
//props.put(Context.SECURITY_CREDENTIALS, connectionSettings.getCredentials());

Properties props = new Properties();
URI serverUrl = new URI(connectionSettings.getServerUrl());

if (serverUrl.getScheme().equalsIgnoreCase(&quot;http&quot;) || serverUrl.getScheme().equalsIgnoreCase(&quot;https&quot;)) {
System.setProperty(&quot;javax.net.debug&quot;, &quot;ssl,handshake,data,trustmanager&quot;);
//Security.addProvider(new sun.security.provider.Sun());
System.setProperty(&quot;java.protocol.handler.pkgs&quot;,&quot;com.sun.net.ssl.internal.www.protocol&quot;);
//System.setProperty(&quot;ssl.SocketFactory.provider&quot;, &quot;javax.net.ssl.SSLSocketFactory&quot;);
props.put(
getConstant(adminClientClass, &quot;CONNECTOR_TYPE&quot;),
getConstant(adminClientClass, &quot;CONNECTOR_TYPE_SOAP&quot;));
} else {
props.put(
getConstant(adminClientClass, &quot;CONNECTOR_TYPE&quot;),
getConstant(adminClientClass, &quot;CONNECTOR_TYPE_RMI&quot;));
}
String username = connectionSettings.getPrincipal();
String password = connectionSettings.getCredentials();
boolean security = ((username != null) &amp;&amp; (!&quot;&quot;.equals(username)));
if (security) {
props.setProperty(getConstant(adminClientClass, &quot;CONNECTOR_SECURITY_ENABLED&quot;), Boolean.toString(security));
props.setProperty(getConstant(adminClientClass, &quot;USERNAME&quot;), username);
props.setProperty(getConstant(adminClientClass, &quot;PASSWORD&quot;), password);
}

props.put(
getConstant(adminClientClass, &quot;CONNECTOR_HOST&quot;),
serverUrl.getHost());
props.put(
getConstant(adminClientClass, &quot;CONNECTOR_PORT&quot;),
String.valueOf(serverUrl.getPort()));

Method createMethod =
adminClientFactoryClass.getMethod(&quot;createAdminClient&quot;, Properties.class);

Object adminClient =
createMethod.invoke(null, props);

this.statsProxy = new GenericMBeanServerProxy(adminClient);
this.mbeanServer = statsProxy.buildServerProxy();

//this.mejb = retrieveMEJB(ctx);

// TODO GH: Customize exception and error messages to help
// with typical problems (jsse jars missing, passwords, etc.)
} finally {
Thread.currentThread().setContextClassLoader(contextClassLoader);
}
}

public String getConstant(Class clazz, String name) throws Exception {
Field field = clazz.getField(name);
return (String) field.get(null);
}

// public Management getMEJB() {
// return mejb;
// }

private Management retrieveMEJB(Context ic) {
try {
java.lang.Object objref = ic.lookup(MEJB_JNDI);
// ManagementHome home =
// (ManagementHome)PortableRemoteObject.narrow(objref,ManagementHome.class);
// Management mejb = home.create();
return mejb;
} catch(NamingException ne) {
// ErrorManager.getDefault().notify(ne);
// } catch(RemoteException re) {
// ErrorManager.getDefault().notify(re);
} catch(Exception ce) {
// ErrorManager.getDefault().notify(ce);
}
return null;
}
public MBeanServer getMBeanServer() {
return this.mbeanServer;
}

public long getRoundTrips() {
return statsProxy.getRoundTrips();
}

public long getFailures() {
return statsProxy.getFailures();
}

}
</pre>
<p>Now, since the changes I made to the JMX plugin still don&#8217;t cover adding WebSphere libs to classpath it still necessary to add it manually, so copy the following jars from WebSphere to the Agent lib directory:</p>
<ul>
<li>AppServer/lib/bootstrap.jar</li>
<li>AppServer/deploytool/itp/plugins/com.ibm.websphere.v61_6.1.200/ws_runtime.jar</li>
<li>AppServer/runtimes/com.ibm.ws.admin.client_6.1.0.jar</li>
<li>AppServer/plugins/com.ibm.ws.security.crypto_6.1.0.jar</li>
</ul>
<p>Now the last part, the JVM that is running your agent needs the server certificate for the SOAP Admin port of your WebSphere installation. If you are using Firefox browse to your server on Admin Port you can check it clicking on the server instance under &#8220;Application Servers&#8221; and then expanding the Ports element and looking for the <strong>&#8220;SOAP_CONNECTOR_ADDRESS&#8221;</strong> entry. It is usually <strong>8880</strong>. Double click on the padlock icon located on the bottom right corner, click display certificate then export it using the default format (<em>X.509 Certificate (PEM)</em>). Remember where you saved it for the next step.<br />
Now run the following command (pointing to the JVM that will run your agent):</p>
<pre class="brush: cpp;">
%JAVA_HOME%\jre\bin\keytool -import -alias somealias -file c:/temp/yourcertificate.crt -keystore %JAVA_HOME%\jre\lib\security\cacerts
</pre>
<p>Replace the %JAVA_HOME% with your JVM directory (or use the command as is in case the environment variable is set).</p>
<p>Now you are ready to setup the component inside JOPR.<br />
For those that don&#8217;t want to build it manually, I&#8217;m providing the patched rhq-jmx-plugin-1.1.0.GA.jar attached in this <a href='http://itdevworld.files.wordpress.com/2009/01/patched-rhq-jmx-plugin-110ga.pdf'>PDF</a>.</p>
<p>Note that the steps cited above for the certificate also applies if you are using IBM Tivoli Monitoring 6.2 (fp1 and onwards) together with a custom agent built using <a href="http://publib.boulder.ibm.com/infocenter/tivihelp/v15r1/topic/com.ibm.itm.doc/sc32-180322.htm">Tivoli Agent Builder</a>. If you miss those steps you&#8217;ll see security error messages on the JMX agent log.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itdevworld.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itdevworld.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itdevworld.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itdevworld.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itdevworld.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itdevworld.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itdevworld.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itdevworld.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itdevworld.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itdevworld.wordpress.com/126/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=126&subd=itdevworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://itdevworld.wordpress.com/2009/02/01/monitoring-a-secured-websphere-installation-through-joprrhq/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/292a48d9cbe4c198ce280095a4e3fecc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rafaelri</media:title>
		</media:content>
	</item>
		<item>
		<title>WebSphere UOW TransactionManagerLookup for Hibernate</title>
		<link>http://itdevworld.wordpress.com/2009/01/23/websphere-uow-transactionmanagerlookup-for-hibernate/</link>
		<comments>http://itdevworld.wordpress.com/2009/01/23/websphere-uow-transactionmanagerlookup-for-hibernate/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 11:56:10 +0000</pubDate>
		<dc:creator>rafaelri</dc:creator>
				<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[setRollbackOnly]]></category>
		<category><![CDATA[TransactionManager]]></category>
		<category><![CDATA[UOW]]></category>
		<category><![CDATA[WebSphere]]></category>

		<guid isPermaLink="false">http://itdevworld.wordpress.com/?p=122</guid>
		<description><![CDATA[For those interested in experimenting the latest Transaction Management API from WebSphere (available on newer 6.0 and 6.1 versions), I&#8217;ll place the code here of a draft implementation I made (partly based on original WebSphereExtendedTransactionLookup, WebSphere documentations [1][2][3][4] and Spring&#8217;s Transaction Manager for WAS).
I hope someday it gets integrated into Hibernate mainstream code but while [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=122&subd=itdevworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>For those interested in experimenting the latest Transaction Management API from WebSphere (available on newer 6.0 and 6.1 versions), I&#8217;ll place the code here of a draft implementation I made (partly based on original WebSphereExtendedTransactionLookup, WebSphere documentations <a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.javadoc.doc/public_html/api/com/ibm/websphere/jtaextensions/ExtendedJTATransaction.html">[1]</a><a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.javadoc.doc/public_html/api/com/ibm/websphere/uow/UOWSynchronizationRegistry.html">[2]</a><a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.javadoc.doc/public_html/spi/com/ibm/wsspi/uow/UOWManager.html">[3]</a><a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/cjta_extjta.html">[4]</a> and <a href="https://fisheye.springframework.org/browse/~raw,r=305/spring-framework/trunk/org.springframework.transaction/src/main/java/org/springframework/transaction/jta/WebSphereUowTransactionManager.java">Spring&#8217;s Transaction Manager for WAS</a>).<br />
I hope someday it gets integrated into Hibernate mainstream code but while it isn&#8217;t I&#8217;ll place here so more people may test it and improve it (reducing the burden over Hibernate team).</p>
<pre class="brush: java;">
package org.hibernate.transaction;

import java.lang.reflect.Method;
import java.util.Properties;

import javax.naming.NamingException;
import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
import javax.transaction.InvalidTransactionException;
import javax.transaction.NotSupportedException;
import javax.transaction.RollbackException;
import javax.transaction.Status;
import javax.transaction.Synchronization;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import javax.transaction.xa.XAResource;

import org.hibernate.HibernateException;
import org.hibernate.util.NamingHelper;
import org.omg.CORBA.SystemException;

/**
 * @author rafaelri
 * Support for proprietary interfaces for registering synchronizations in WebSphere 6.1+
 */
public class WebSphereUOWTransactionLookup implements TransactionManagerLookup {

	private static final String UOW_MANAGER_JNDI = &quot;java:comp/websphere/UOWManager&quot;;
	private static final String UOW_SYNCHRONIZATION_MANAGER_JNDI = &quot;java:comp/websphere/UOWSynchronizationRegistry&quot;;
	public TransactionManager getTransactionManager(Properties props)
	throws HibernateException {
		return new TransactionManagerAdapter(props);
	}

	public String getUserTransactionName() {
		return &quot;java:comp/UserTransaction&quot;;
	}

	public static class TransactionManagerAdapter implements TransactionManager {

		private final Object uowManager;
		private final Class uowManagerClass;
		private final Object uowSynchronizationRegistry;
		private final Class uowSynchronizationRegistryClass;
		private final Method registerSynchronizationMethod;
		private final Method setRollbackOnlyMethod;

		private final Properties properties;
		private final Method getLocalIdMethod;

		private TransactionManagerAdapter(Properties props) {
			this.properties = props;
			try {
				uowManager = NamingHelper.getInitialContext(props).lookup( UOW_MANAGER_JNDI );
				uowManagerClass = Class.forName(&quot;com.ibm.ws.uow.UOWManager&quot;);
				setRollbackOnlyMethod = uowManagerClass.getMethod(
						&quot;setRollbackOnly&quot;,
						new Class[] {}
					);

				uowSynchronizationRegistry = NamingHelper.getInitialContext(props).lookup( UOW_SYNCHRONIZATION_MANAGER_JNDI );
				uowSynchronizationRegistryClass = Class.forName(&quot;com.ibm.websphere.uow.UOWSynchronizationRegistry&quot;);

				registerSynchronizationMethod = uowSynchronizationRegistryClass.getMethod(
						&quot;registerInterposedSynchronization&quot;,
						new Class[] { Synchronization.class }
					);
				Class extendedJTATransactionClass = Class.forName(&quot;com.ibm.websphere.jtaextensions.ExtendedJTATransaction&quot;);
				getLocalIdMethod = extendedJTATransactionClass.getMethod( &quot;getLocalId&quot;, null );

			}
			catch (ClassNotFoundException cnfe) {
				throw new HibernateException(cnfe);
			}
			catch (NoSuchMethodException nsme) {
				throw new HibernateException(nsme);
			} catch (NamingException ne) {
				throw new HibernateException(ne);
			}
		}

		public void begin() throws NotSupportedException, SystemException {
			throw new UnsupportedOperationException();
		}

		public void commit() throws RollbackException, HeuristicMixedException,
				HeuristicRollbackException, SecurityException,
				IllegalStateException, SystemException {
			throw new UnsupportedOperationException();
		}

		public int getStatus() throws SystemException {
			throw new UnsupportedOperationException();
		}

		public Transaction getTransaction() throws SystemException {
			return new TransactionAdapter(properties);
		}

		public void resume(Transaction txn) throws  InvalidTransactionException,
				IllegalStateException, SystemException {
			throw new UnsupportedOperationException();
		}

		public void rollback() throws IllegalStateException, SecurityException,
				SystemException {
			throw new UnsupportedOperationException();
		}

		public void setRollbackOnly() throws IllegalStateException,
				SystemException {
			try {
				setRollbackOnlyMethod.invoke(
					uowManager,
					new Object[] { }
				);
			}
			catch (Exception e) {
				throw new HibernateException(e);
			}
		}

		public void setTransactionTimeout(int i) throws SystemException {
			throw new UnsupportedOperationException();
		}

		public Transaction suspend() throws SystemException {
			throw new UnsupportedOperationException();
		}

		public class TransactionAdapter implements Transaction {

			private final Object extendedJTATransaction;

			private TransactionAdapter(Properties props) {
				try {
					extendedJTATransaction = NamingHelper.getInitialContext(props)
						.lookup(&quot;java:comp/websphere/ExtendedJTATransaction&quot;);

				}
				catch (NamingException ne) {
					throw new HibernateException(ne);
				}
			}

			public void registerSynchronization(final Synchronization synchronization)
					throws RollbackException, IllegalStateException,
					SystemException {

				try {
					registerSynchronizationMethod.invoke(
							uowSynchronizationRegistry,
							new Object[] { synchronization }
						);
				}
				catch (Exception e) {
					throw new HibernateException(e);
				}

			}

			public int hashCode() {
				return getLocalId().hashCode();
			}

			public boolean equals(Object other) {
				if ( !(other instanceof TransactionAdapter) ) return false;
				TransactionAdapter that = (TransactionAdapter) other;
				return getLocalId().equals( that.getLocalId() );
			}

			private Object getLocalId() {
				try {
					return getLocalIdMethod.invoke(extendedJTATransaction, null);
				}
				catch (Exception e) {
					throw new HibernateException(e);
				}
			}

			public void commit() throws RollbackException, HeuristicMixedException,
					HeuristicRollbackException, SecurityException,
					IllegalStateException, SystemException {
				throw new UnsupportedOperationException();
			}

			public boolean delistResource(XAResource resource, int i)
					throws IllegalStateException, SystemException {
				throw new UnsupportedOperationException();
			}

			public boolean enlistResource(XAResource resource)
					throws RollbackException, IllegalStateException,
					SystemException {
				throw new UnsupportedOperationException();
			}

			public int getStatus() throws SystemException {
				return new Integer(0).equals( getLocalId() ) ?
						Status.STATUS_NO_TRANSACTION : Status.STATUS_ACTIVE;
			}

			public void rollback() throws IllegalStateException, SystemException {
				throw new UnsupportedOperationException();
			}

			public void setRollbackOnly() throws IllegalStateException,
					SystemException {
				try {
					setRollbackOnlyMethod.invoke(
						uowManager,
						new Object[] { }
					);
				}
				catch (Exception e) {
					throw new HibernateException(e);
				}
			}
		}

	}

}
</pre>
<p>Please, if you use it and find any bugs, comments or suggestions, leave a comment on this post.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itdevworld.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itdevworld.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itdevworld.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itdevworld.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itdevworld.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itdevworld.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itdevworld.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itdevworld.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itdevworld.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itdevworld.wordpress.com/122/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=122&subd=itdevworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://itdevworld.wordpress.com/2009/01/23/websphere-uow-transactionmanagerlookup-for-hibernate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/292a48d9cbe4c198ce280095a4e3fecc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rafaelri</media:title>
		</media:content>
	</item>
		<item>
		<title>Websphere PMI: enabling and viewing data</title>
		<link>http://itdevworld.wordpress.com/2008/12/10/websphere-pmi-enabling-and-viewing-data/</link>
		<comments>http://itdevworld.wordpress.com/2008/12/10/websphere-pmi-enabling-and-viewing-data/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 00:57:32 +0000</pubDate>
		<dc:creator>rafaelri</dc:creator>
				<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[eclipse tptp]]></category>
		<category><![CDATA[JCA]]></category>
		<category><![CDATA[jdbc]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[performance monitoring infrastructure]]></category>
		<category><![CDATA[pmi]]></category>
		<category><![CDATA[profiling]]></category>
		<category><![CDATA[tuning]]></category>
		<category><![CDATA[use time]]></category>
		<category><![CDATA[wait time]]></category>
		<category><![CDATA[WebSphere]]></category>

		<guid isPermaLink="false">http://itdevworld.wordpress.com/?p=101</guid>
		<description><![CDATA[For those who ever needed to have a deeper look at application internals that may be impacting performance probably had this impression:
 System.out.println with System.nanoTime (or currentTimeMillis) is tedious, errorprone and limited
 A profiler is an overkill not to mention cumbersome (and unavailable for certain platforms [eg.:tptp on AIX]*)
This is the scenario where Websphere PMI [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=101&subd=itdevworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>For those who ever needed to have a deeper look at application internals that may be impacting performance probably had this impression:</p>
<li> System.out.println with System.nanoTime (or currentTimeMillis) is tedious, errorprone and limited</li>
<li> A profiler is an overkill not to mention cumbersome (and unavailable for certain platforms [eg.:<a href="http://www.eclipse.org/tptp" target="_blank">tptp on AIX</a>]*)</li>
<p>This is the scenario where Websphere PMI is a killer feature.</p>
<p>Imagine that your application isn&#8217;t performing as expected. Many can be the reasons for the poor performance. I&#8217;ve faced myself a scenario where the application was waiting a long time for getting a JMS connection from Websphere internal provider since its default configuration of 10 connections maximum isn&#8217;t acceptable for any application with performance requirements of even 100 transactions per second.</p>
<p><strong>Enabling PMI</strong></p>
<p>By default, Websphere 6.1 ND comes with basic PMI metrics enabled. These include for example:</p>
<ul>
<li>Enterprise Beans.Create Count</li>
<li>JDBC Connection Pools.Wait Time</li>
<li>JDBC Connection Pools.Use Time</li>
</ul>
<p>If you need anything more than the default, you can change under:</p>
<p><em>Monitoring and Tuning &gt; Performance Monitoring Infrastructure (PMI) </em></p>
<p>then click on the desired server.</p>
<p>After you have chosen the desired metrics (remember that more metrics involve more CPU impact on runtime), go to the following menu:</p>
<p><em>Monitoring and Tuning &gt; Performance Viewer &gt; Current Activity</em></p>
<p>Now you need to check if your server is in fact already collecting data, if it is already enabled but not collecting, <em>Collection Status</em> will show <em>Available</em>. In order to start collecting, check the desired server and click <em>Start Monitoring</em> button. After clicking the button it will now show <em>Monitored</em> on the status column.</p>
<p>Now you can click on the desired server and tick for example one of your connection pools under the tree on the left, you should see an structure similar to the below:</p>
<p><em>Performance Modules &gt; JDBC Connection Pools &gt; Oracle XA Provider &gt; yourDataSource</em></p>
<p>After clicking the metric you&#8217;ll have a graph display of the current data and also a tabular with the snapshot of the indicator below.</p>
<p>* note: Eclipse TPTP is <a href="http://www.eclipse.org/tptp/home/downloads/?ver=4.3.1" target="_blank">said to be supported on AIX on version 4.3.1</a> but I have not been able to make it work</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itdevworld.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itdevworld.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itdevworld.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itdevworld.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itdevworld.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itdevworld.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itdevworld.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itdevworld.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itdevworld.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itdevworld.wordpress.com/101/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=101&subd=itdevworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://itdevworld.wordpress.com/2008/12/10/websphere-pmi-enabling-and-viewing-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/292a48d9cbe4c198ce280095a4e3fecc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rafaelri</media:title>
		</media:content>
	</item>
		<item>
		<title>WebSphere Performance Monitoring Infrastructure (PMI)</title>
		<link>http://itdevworld.wordpress.com/2008/10/07/websphere-performance-monitoring-infrastructure-pmi/</link>
		<comments>http://itdevworld.wordpress.com/2008/10/07/websphere-performance-monitoring-infrastructure-pmi/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 00:06:14 +0000</pubDate>
		<dc:creator>rafaelri</dc:creator>
				<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[connection pool]]></category>
		<category><![CDATA[Donald Knuth]]></category>
		<category><![CDATA[early optimization]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[performance monitoring infrastrucure]]></category>
		<category><![CDATA[pmi]]></category>
		<category><![CDATA[profiling]]></category>
		<category><![CDATA[tptp]]></category>
		<category><![CDATA[use time]]></category>
		<category><![CDATA[wait time]]></category>
		<category><![CDATA[WebSphere]]></category>

		<guid isPermaLink="false">http://itdevworld.wordpress.com/?p=59</guid>
		<description><![CDATA[For the next weeks I&#8217;ll be posting some feedback about my experience on using WebSphere PMI tool. It is an incredible tool for performance tuning. Basically it frees you from plugging a CPU intensive profiler (that is also usually hard to setup) and lets you see (for example) performance data such as waiting and use [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=59&subd=itdevworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>For the next weeks I&#8217;ll be posting some feedback about my experience on using <a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v5r0/topic/com.ibm.websphere.base.doc/info/aes/ae/cprf_pmidata.html" target="_blank">WebSphere PMI</a> tool. It is an incredible tool for performance tuning. Basically it frees you from plugging a CPU intensive profiler (that is also usually hard to setup) and lets you see (for example) performance data such as waiting and use time for connections inside a pool. Still there are cases when you need to see information in bits as it is available on a profiling tool such as <a href="http://www.eclipse.org/tptp" target="_blank">Eclipse TPTP</a>.</p>
<p>JCA posts have been updated, I have made some changes about ManagedConnections and Connection Handles interaction in the Foo Connector. For those who have read the previous version of the post I suggest re-reading it.</p>
<p>Still on the performance topic there is one phrase atributed to Donald Knuth that is worth mentioning:</p>
<blockquote><p>&#8220;We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.&#8221; (Knuth, Donald. <em>Structured Programming with go to Statements</em>, ACM Journal <strong>Computing Surveys</strong>, Vol 6, No. 4, Dec. 1974. p.268.) <a href="http://en.wikipedia.org/wiki/Optimization_(computer_science)" target="_blank">Wikipedia &#8211; Optimization</a></p></blockquote>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itdevworld.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itdevworld.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itdevworld.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itdevworld.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itdevworld.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itdevworld.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itdevworld.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itdevworld.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itdevworld.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itdevworld.wordpress.com/59/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=59&subd=itdevworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://itdevworld.wordpress.com/2008/10/07/websphere-performance-monitoring-infrastructure-pmi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/292a48d9cbe4c198ce280095a4e3fecc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rafaelri</media:title>
		</media:content>
	</item>
		<item>
		<title>matchManagedConnections short tip</title>
		<link>http://itdevworld.wordpress.com/2008/10/06/matchmanagedconnections-short-tip/</link>
		<comments>http://itdevworld.wordpress.com/2008/10/06/matchmanagedconnections-short-tip/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 23:55:38 +0000</pubDate>
		<dc:creator>rafaelri</dc:creator>
				<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[JCA]]></category>
		<category><![CDATA[matchManagedConnections]]></category>
		<category><![CDATA[ValidatingManagedConnectionFactory]]></category>
		<category><![CDATA[WebSphere]]></category>

		<guid isPermaLink="false">http://itdevworld.wordpress.com/?p=57</guid>
		<description><![CDATA[Be aware that the container may send invalid connections to the matchManagedConnections method and if you happen to return any of the invalid connections it&#8217;ll give it back to the application. This check is important since connectionErrorOccurred is only safe to be called while connection is in use. Some containers have optimizations that deny you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=57&subd=itdevworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Be aware that the container may send invalid connections to the matchManagedConnections method and if you happen to return any of the invalid connections it&#8217;ll give it back to the application. This check is important since connectionErrorOccurred is only safe to be called while connection is in use. Some containers have optimizations that deny you from calling while connection is not in use by the application (more exactly while in the pool).</p>
<p>So even if your ManagedConnectionFactory implements the interface <a href="http://java.sun.com/j2ee/1.4/docs/api/javax/resource/spi/ValidatingManagedConnectionFactory.html" target="_blank">ValidatingManagedConnectionFactory</a> you should also check for invalid connections during the selection of a matching connection inside matchManagedConnections method.<br />
The <a href="http://java.sun.com/j2ee/1.4/docs/api/javax/resource/spi/ValidatingManagedConnectionFactory.html#getInvalidConnections(java.util.Set)">getInvalidConnections</a> method usually is called after one connection has been detected as invalid (after a valid call to connectionErrorOccurred) or by a container timer thread (<a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1//index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/udat_conpoolset.html">on WebSphere this timeout is specified in the reap time parameter</a>). </p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itdevworld.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itdevworld.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itdevworld.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itdevworld.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itdevworld.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itdevworld.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itdevworld.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itdevworld.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itdevworld.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itdevworld.wordpress.com/57/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=57&subd=itdevworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://itdevworld.wordpress.com/2008/10/06/matchmanagedconnections-short-tip/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/292a48d9cbe4c198ce280095a4e3fecc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rafaelri</media:title>
		</media:content>
	</item>
		<item>
		<title>Connection request flow on outbound JCA connector</title>
		<link>http://itdevworld.wordpress.com/2008/09/17/connection-request-flow-on-outbound-jca-connector/</link>
		<comments>http://itdevworld.wordpress.com/2008/09/17/connection-request-flow-on-outbound-jca-connector/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 12:04:11 +0000</pubDate>
		<dc:creator>rafaelri</dc:creator>
				<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[ConnectionManager]]></category>
		<category><![CDATA[ConnectionRequestInfo]]></category>
		<category><![CDATA[Java Connector Architecture]]></category>
		<category><![CDATA[JCA]]></category>
		<category><![CDATA[ManagedConnection]]></category>
		<category><![CDATA[ManagedConnectionFactory]]></category>
		<category><![CDATA[matchManagedConnection]]></category>
		<category><![CDATA[outbound connector]]></category>
		<category><![CDATA[WebSphere]]></category>

		<guid isPermaLink="false">http://itdevworld.wordpress.com/?p=39</guid>
		<description><![CDATA[Continuing with the posts about outbound JCA connectors lets have a quick look at one of the main flows of an outbound JCA connector: the connection request flow.
By now you might be wondering: &#8220;What on earth is responsible for making my connectors poolable? Is there any dark magic involved?&#8221;.
First answer: &#8220;the ConnectionManager&#8221; and second answer: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=39&subd=itdevworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Continuing with the posts about outbound JCA connectors lets have a quick look at one of the main flows of an outbound JCA connector: the connection request flow.</p>
<p>By now you might be wondering: &#8220;What on earth is responsible for making my connectors poolable? Is there any dark magic involved?&#8221;.</p>
<p>First answer: &#8220;the <a href="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/resource/spi/ConnectionManager.htm" target="_blank">ConnectionManager</a>&#8221; and second answer: &#8220;Yes and it is container dependant!&#8221;. That&#8217;s the reason you should keep an instance of the ConnectionManager inside your ConnectionFactory when it is created, that&#8217;s how you delegate the connection creation to the pooling implementation of the container.</p>
<p>Enough explanation let&#8217;s have a look on a sequence diagram for a connection creation when we have no connections inside the pool.</p>
<p><strong>First flow: connection request with no matching connections</strong></p>
<p style="text-align:center;">
<p>First thing to take note, it is up to you to implement the matchManagedConnections, I&#8217;ve put a note on the next diagram that might help on this implementation: making the ManagedConnection be able to compare itself to a ConnectionRequestInfo makes the things easier. Also beaware that some Application Servers (eg.: WebSphere) skip the matchManagedConnections part if it detects by itself that the pool is empty or there isn&#8217;t any matching connection.</p>
<div id="attachment_70" class="wp-caption alignnone" style="width: 310px"><a href="http://itdevworld.files.wordpress.com/2008/10/sdgetconnectionnomatch.jpg"><img class="size-medium wp-image-70" title="Sequence Diagram - No Matching Connection" src="http://itdevworld.files.wordpress.com/2008/10/sdgetconnectionnomatch.jpg?w=300&#038;h=112" alt="Sequence Diagram - No Matching Connection" width="300" height="112" /></a><p class="wp-caption-text">Sequence Diagram - No Matching Connection</p></div>
<p>Another point about the specification is that it states that a single managed connection may be responsible for more than a single physical connection (FooConnectionImpl), this is required for scenarios where connection sharing is possible (refer to section 6.5.4.2 of the specification).</p>
<p>Previously I tried implementing using a single handle but I noticed that it does not take much effort to make it fully adherent, in fact, it is only necessary to use a delegate (FooConnectionHandle) that implements the FooConnection interface and delegates almost all the methods to the FooConnectionImpl instance that is inside the FooManagedConnection instance (refer to sections 6.5.4.1 and 6.8.1 of the specifications). The exception to the delegation is the close method that your connection must provide, this method in the delegate will be responsible for raising the <a href="http://java.sun.com/j2ee/apidocs-1_5-fr/javax/resource/spi/ConnectionEvent.html#CONNECTION_CLOSED" target="_blank">Connection Closed Event</a>, this is the way you signal the container that you are giving the connection back to the pool.<br />
<strong> Second flow: connection request when there are matching connections inside the pool.</strong></p>
<p style="text-align:center;">
<div id="attachment_71" class="wp-caption alignnone" style="width: 310px"><a href="http://itdevworld.files.wordpress.com/2008/10/sdgetconnectionmatched.jpg"><img class="size-medium wp-image-71" title="Sequence Diagram - Matching Connections" src="http://itdevworld.files.wordpress.com/2008/10/sdgetconnectionmatched.jpg?w=300&#038;h=120" alt="Sequence Diagram - Matching Connections" width="300" height="120" /></a><p class="wp-caption-text">Sequence Diagram - Matching Connections</p></div>
<p>This flow is executed whenever the container guesses there are potential matching connections. The matchManagedConnection method is invoked with the minimal connection set that the container can identify. The connection set is a key point: specification states that the container is responbile for determining the minimal set that has a potential match to avoid degrading performance while looking for the connection. Also I noticed that some containers don&#8217;t check the connections <a href="http://itdevworld.wordpress.com/2008/10/06/matchmanagedconnections-short-tip/" target="_blank">inside this Set before sending them for matching</a>.</p>
<p><strong>Implementation Tips</strong></p>
<p>Here are some decisions that might help on the implementation of the ManagedConnection and ManagedConnectionFactory.</p>
<ul>
<li>Store the ConnectionRequestInfo that was passed to the ManagedConnectionFactory on the creation of the ManagedConnection as an attribute inside the ManagedConnection this leads to the next tip</li>
<li>Use the ConnectionRequestInfo stored in the ManagedConnection as argument to an overload of the equals method of the ManagedConnection class this helps in the implementation of the matchManagedConnection method</li>
<li>Never ever forget to include your ManagedConnection object on equals(Object) method implementation. The tip above may lead you to forget this details. Dont do this under any circumstance since specification requires this and some containers freak out after some use time if this method is not implemented (connection borrow time goes all way up if not implemented)</li>
</ul>
<p>Next post I&#8217;ll focus on how to signal the container that something went wrong with the connection and how to validate the connection before it is returned to the requestor.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/itdevworld.wordpress.com/39/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/itdevworld.wordpress.com/39/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itdevworld.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itdevworld.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itdevworld.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itdevworld.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itdevworld.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itdevworld.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itdevworld.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itdevworld.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itdevworld.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itdevworld.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=39&subd=itdevworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://itdevworld.wordpress.com/2008/09/17/connection-request-flow-on-outbound-jca-connector/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/292a48d9cbe4c198ce280095a4e3fecc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rafaelri</media:title>
		</media:content>

		<media:content url="http://itdevworld.files.wordpress.com/2008/10/sdgetconnectionnomatch.jpg?w=300" medium="image">
			<media:title type="html">Sequence Diagram - No Matching Connection</media:title>
		</media:content>

		<media:content url="http://itdevworld.files.wordpress.com/2008/10/sdgetconnectionmatched.jpg?w=300" medium="image">
			<media:title type="html">Sequence Diagram - Matching Connections</media:title>
		</media:content>
	</item>
	</channel>
</rss>