<?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>breddy.net &#187; jboss</title>
	<atom:link href="http://www.breddy.net/tag/jboss/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.breddy.net</link>
	<description>Personal and professional weblog of Chris Bredesen</description>
	<lastBuildDate>Sun, 02 May 2010 20:05:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Accessing a JBoss EJB3 Session Bean With Spring</title>
		<link>http://www.breddy.net/2006/07/06/accessing-a-jboss-ejb3-session-bean-with-spring/</link>
		<comments>http://www.breddy.net/2006/07/06/accessing-a-jboss-ejb3-session-bean-with-spring/#comments</comments>
		<pubDate>Thu, 06 Jul 2006 17:34:09 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://www.breddy.net/2006/07/06/accessing-a-jboss-ejb3-session-bean-with-spring/</guid>
		<description><![CDATA[Spring and Hibernate have long been my choice of frameworks with which to construct maintainable, scalable middle-tier software.  Spring promotes good OO design using loose coupling and provides excellent declarative transaction support.  Hibernate is the persistence tool of choice for the open source community.  Any sane person who programs this way will [...]]]></description>
			<content:encoded><![CDATA[<p>Spring and Hibernate have long been my choice of frameworks with which to construct maintainable, scalable middle-tier software.  Spring promotes good OO design using loose coupling and provides excellent declarative transaction support.  Hibernate is the persistence tool of choice for the open source community.  Any sane person who programs this way will have given up on EJB long ago.  Coarse-grained entities, tightly coupled service objects and XML deployment descripters a-plenty are enough to bring a guy to his knees.</p>
<p>But no more.  The EJB expert group, now composed of some of the very creators of modern persistence framework, has bequeathed upon us something wonderful.  The lightweight POJO programming model we have come to love is apparent everywhere in the EJB 3.0 specifiction (<a title="JSR-220" href="http://www.jcp.org/en/jsr/detail?id=220" target="_blank">JSR-220</a>), which was <a title="JSR-220 voting results" href="http://www.jcp.org/en/jsr/results?id=3768" target="_blank">unanimously accepted</a> by the <a title="Java Community Process" href="http://www.jcp.org" target="_blank">JCP</a> earlier this year.  EJB 3.0 is just one goodie in the larger <a title="Java EE 5 What's New" href="http://java.sun.com/javaee/overview/whatsnew.jsp" target="_blank">Java EE 5</a> (<a title="JSR-244" href="http://www.jcp.org/en/jsr/detail?id=244" target="_blank">JSR-244</a>) bag &#8211; but this post is going to be long enough as it is.<span id="more-40"></span></p>
<p>When I returned from Las Vegas with my newfound interest in EJB, my first task at hand was to create a little test application that demonstrated the scenario that is most applicable to my work:  EJB3 services remoted over RMI consumed with POJO web applications that already use Spring.  This use case stems from the need that we have realized the need to segment a growing middle-tier application from the monolithic beast it is destined to become into smaller, more manageable services.  The client programs (mostly web applications) already access the business interfaces using Spring.</p>
<p>I&#8217;m going to skip the gory details of setting up the server, creating a project and all the like.  There are plenty of explanations of this elsewhere.  Besides, this post is going to be long enough as it is.</p>
<p>First we need a business interface.  How about something really complex:</p>
<p>[java]<br />
public interface SimpleService {<br />
int stringLength(String string);<br />
}<br />
[/java]</p>
<p>Nothing fancy there.  Now let&#8217;s implement it with some logic:</p>
<p>[java]<br />
public class SimpleServiceBean implements SimpleService {<br />
public int stringLength(String string) {<br />
return string == null ? 0 : string.length();<br />
}<br />
}<br />
[/java]</p>
<p>Still totally straightforward.  Now let&#8217;s turn our bean into an EJB.  This is the <em>really</em> complicated part.  Watch for the annotations:</p>
<p>[java]<br />
@Stateless<br />
@Remote(SimpleService.class)<br />
public class SimpleServiceBean implements SimpleService {<br />
public int stringLength(String string) {<br />
return string == null ? 0 : string.length();<br />
}<br />
}<br />
[/java]</p>
<p>Did you get all that?  The <tt>@Stateless</tt> annotation tells us that this is a Stateless Session bean, and the <tt>@Remote</tt> annotation specifies the remote interface.  <em>Everything else is handled by the container.</em> Although the footwork is managed by the container in a somewhat vendor-specific way, the annotations are standard Java EE, and so you&#8217;re not tied to an implementation. When you catch your breath, let&#8217;s move on.</p>
<p>Since Java EE 5 has embraced configuration by exception, we don&#8217;t even need any depoyment descriptors.  These two files can be compiled, JAR&#8217;d up and deployed to a server of your choosing &#8212; I used JBoss 4.0.4.</p>
<p>In order to have a client, we need to provide, at a minimum, the remote interfaces and any other classes or exceptions it references.  For testing, I just tossed the same JAR on the classpath since I know it contains everything I need.  Additionally, we need the Spring JARs (this test used 2.0RC1) and the JBoss client JAR&#8217;s.</p>
<p>The only real programming we have to do here is to create a Spring container that wires up to the server&#8217;s JNDI directory.  To do this, we&#8217;ll use Spring&#8217;s <tt>JndiObjectFactoryBean</tt>.  This part actually confused me because try as I did, I could never accomplish this feat using the more aptly-named <tt>SimpleRemoteStatelessSessionProxyFactoryBean</tt>.  The difference, apparently, is that since EJB3 places no specific requirements on the business, home or remote interfaces, there is less to do, and thus the client simply grabs the object and narrows it down as prescribed.  Here is my Spring configuration (minus the XML header and DTD info):</p>
<p>[xml]</p>
<p>org.jnp.interfaces.NamingContextFactory org.jboss.naming:org.jnp.interfaces jnp://localhost:1099<br />
[/xml]</p>
<p>The JNDI properties provided are JBoss specific, as is the provider URL.  These are included with the JBoss client JAR in the form of a jndi.properties file.  They are exactly the same as what would be used to construct a traditional <tt>InitialContext</tt> if this were a non-spring J2SE client.</p>
<p>JBoss mounts Remote interfaces (by default) using /remote, and Local interfaces using /local.  As you can see here, we&#8217;ve chosen the remote.  One could just as easily expose <tt>SimpleServiceBean</tt> as a Local EJB by using the <tt>@Local</tt> annotation and providing the same business interface as an arguement.  The Spring container changes only in URL and jndiName values.</p>
<p>Once the bean factory is configured, you can load it and request the remote <tt>SimpleServiceBean</tt> proxy by name (simpleService), casting it to <tt>SimpleService</tt> as you would normally do with a Spring-managed object.  It works flawlessly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.breddy.net/2006/07/06/accessing-a-jboss-ejb3-session-bean-with-spring/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Seam, EJB3 and Gavin</title>
		<link>http://www.breddy.net/2006/06/13/seam-ejb3-and-gavin/</link>
		<comments>http://www.breddy.net/2006/06/13/seam-ejb3-and-gavin/#comments</comments>
		<pubDate>Wed, 14 Jun 2006 02:05:36 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jboss]]></category>

		<guid isPermaLink="false">http://www.breddy.net/2006/06/13/seam-ejb3-and-gavin/</guid>
		<description><![CDATA[This afternoon&#8217;s festivities were highlited by a characteristically colorful presentation by Gavin King.  For those who don&#8217;t know, Gavin is the creator of the Hibernate persistence framework which was aquired eventually by JBoss.
Gavin &#38; crew demonstrated quickly but effectively the lovely synergy that has been brought to EJB3 and JSF by their newest creation, [...]]]></description>
			<content:encoded><![CDATA[<p>This afternoon&#8217;s festivities were highlited by a characteristically colorful presentation by Gavin King.  For those who don&#8217;t know, Gavin is the creator of the <a title="Hibernate.org" href="http://www.hibernate.org/" target="_blank">Hibernate</a> persistence framework which was aquired eventually by JBoss.</p>
<p>Gavin &amp; crew demonstrated quickly but effectively the lovely synergy that has been brought to EJB3 and JSF by their newest creation, <a title="Seam homepage" href="http://labs.jboss.com/portal/jbossseam" target="_blank">Seam</a>.  Seam can hardly be called a web framework &#8212; you wouldn&#8217;t recognize it as such what with its lack of, well, just about everything that you&#8217;ve come to expect from a web framework.</p>
<p>Seam throws away boilerplate code a-la Rails, but does so in a way that leverages a lot of the untapped power of EJB3 and JSF. Seam is all about Don&#8217;t Repeat Yourself (DRY).  As such, we throw away form beans (a-la Spring MVC) and a whole lot of XML (in favor of annotations).</p>
<p>The most surprising theme that emerges from all of this is the rampant use of Stateful Session beans.  You read that right &#8211; I said Stateful.  Seam begs the question, &#8220;why on earth would I represent state in a database (slow is an understatement) or in HTTPSession (with no dirty checking) when I can use this lovely gift called Stateful beans?&#8221;  He makes a damn good point.  By representing web conversations as SFSB&#8217;s (which are POJO&#8217;s in EJB3, in case you&#8217;re wondering) you eliminate many of the headaches associated with web apps.  Multiple tabs open in your browser?  Piece of cake &#8211; each browser tab/session/window has a unique conversation (they&#8217;re <em>stateful</em>, remember?).   Double submit?  Ha!  Don&#8217;t even try!  Want to have a clean client redirect after performing some action, but still pass messages across?  No problemo &#8211; you&#8217;ve got a lightweight stateful conversation behind you.</p>
<p>By logically grouping your flows into SFSB&#8217;s, you can leverage more sophisticated failover because the container dirty-checks each instance and replicates automatically.  Try that with HTTPSession.</p>
<p>So, I will be doing a sandbox app soon with Seam, and I&#8217;ll post more as I know it.  Till then, read all you can.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.breddy.net/2006/06/13/seam-ejb3-and-gavin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Future of JBoss AS</title>
		<link>http://www.breddy.net/2006/06/13/the-future-of-jboss-as/</link>
		<comments>http://www.breddy.net/2006/06/13/the-future-of-jboss-as/#comments</comments>
		<pubDate>Tue, 13 Jun 2006 20:20:08 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jboss]]></category>

		<guid isPermaLink="false">http://www.breddy.net/2006/06/13/the-future-of-jboss-as/</guid>
		<description><![CDATA[You can&#8217;t really question the inertia behind enterprise development using POJO&#8217;s and lightweight frameworks.  Rod Johnson (of Spring framework fame) wrote the book about this approach, effectively putting the last nail in the heavy framework&#8217;s coffin.  This morning&#8217;s presentation by JBoss covered their take on this from a 5000-ft level and also described some of [...]]]></description>
			<content:encoded><![CDATA[<p>You can&#8217;t really question the inertia behind enterprise development using POJO&#8217;s and lightweight frameworks.  Rod Johnson (of Spring framework fame) <a title="J2EE Without EJB" href="http://www.springframework.com/books/j2eewithoutEJB.html" target="_blank">wrote</a> <a title="Expert One-on-one J2EE" href="http://www.springframework.com/books/expertoneonone.html" target="_blank">the</a> <a title="Professional Java Development with the Spring Framework (Amazon.com)" href="http://www.amazon.com/gp/product/0764574833/sr=8-1/qid=1150229760/ref=pd_bbs_1/103-5528651-5807808?%5Fencoding=UTF8" target="_blank">book</a> about this approach, effectively putting the last nail in the heavy framework&#8217;s coffin.  This morning&#8217;s presentation by JBoss covered their take on this from a 5000-ft level and also described some of the new things afoot in v5 of JBoss AS.</p>
<p>JBoss is mutating their MicroKernel (heavily JMX based) into what they call the MicroContainer.  The MicroContainer architecture could be described by reading the outline of Spring&#8217;s core container and subtituting &#8220;Spring&#8221; for &#8220;JBoss&#8221;.  Indeed, they are not only building a lightweight DI framework; they are building their entire app server on it.  Cool.</p>
<p>JBoss has always been good about letting the developer/integrater customize the footprint of the server through configuration.  It looks like this is going to be even cleaner and better in v5, since the same DI engine which builds the server innerworkings can also assemble application components &#8212; all the way up through the presentation tier using Seam/JSF.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.breddy.net/2006/06/13/the-future-of-jboss-as/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
