Thursday, 6 November 2008

Migrating Weblogic to JBoss (3)

My XSLT skills are coming on pretty nicely, but the real battle in all of this is finding equivalent features for those Weblogic application server specifics that we've used. So far I've been able to map most features 1-1 between the respective deployment descriptor files, but today I encountered one that doesn't fit this pattern. In Weblogic, entity-cache is in the weblogic-ejb-jar.xml, whereas in JBoss its equivalent is in the jbosscmp-jdbc.xml not jboss.xml, so XSTL becomes tricky.

I'm also pondering moving to XDoclet since it would allow us to maintain one source going forward and still target multiple application servers, but that would mean redoing all our Weblogic descriptors and involves some element of risk, particularly as I'm not certain all the features we use are covered by XDoclet.

If you've not used XDoclet before, it allows one to embed deployment configuration within Java and then generate XML deployment descriptors using an Ant task. For example see below (notice the use of @ejb, @jboss, @weblogic and @websphere tags.) An additional benefit of this approach is it enables one to see clearly which open and which app server specific JEE features are being used.

* This is a teller bean. It is an example of how to use the XDoclet tags.
* @ejb.bean name="Teller"
* description="Teller example bean"
* jndi-name="ejb/bank/Teller"
* type="Stateless"
* @ejb.ejb-ref ejb-name="Account"
* ref-name="ejb/bank/Account"
* @jboss.ejb-local-ref ref-name="File"
* jndi-name="blah/File"
* @ejb.ejb-ref ejb-name="Customer"
* role-link="Administrator"
* role-name="admin"
* @ejb.permission role-name="Teller"
* @ejb.permission role-name="Administrator"
* @ejb.transaction type="Required"
* @ejb.transaction-type type="Container"
* @ejb.resource-ref res-auth="Container"
* res-name="jdbc/DBPool"
* res-type="javax.sql.DataSource"
* @jboss.resource-ref res-ref-name="jdbc/DBPool"
* resource-name="MyDataSourceManager"
* @jboss.container-configuration name="Standard Stateless SessionBean"
* @jboss.ejb-ref-jndi jndi-name="ejb/bank/Account"
* ref-name="bank/Account"
* @weblogic.pool initial-beans-in-free-pool="1"
* max-beans-in-free-pool="3"
* @weblogic.stateless-clustering stateless-bean-call-router-class-name="Whatever"
* stateless-bean-is-clusterable="True"
* stateless-bean-load-algorithm="Whazzup"
* stateless-bean-methods-are-idempotent="Sure"
* @websphere.bean timeout="239"

1 comment:

  1. Must have been something in the water yesterday. No problems with the entity-cache tag.