Migrating Enhydra Applications
to Lutris EAS 4.1 and Java Services

One of the subtler new features in Lutris EAS 4.1 is the ability to migrate existing Enhydra super-servlet, EAF (Enhydra Application Framework) applications to Lutris EAS 4.1 without rebuilding or recompiling your application. This may sound like a handy feature to support, but if you think about it, it represents some interesting potential.

  • Enhydra is now the perfect entry-level application server
  • You can now take advantage of Lutris DynaCluster for session level failover
  • You can get access to Java Services, such as the SMS Service or Scheduler Service from your super-serlvet application.

In this article, I'm going to discuss the configuration steps that I took in order to migrate an Enhydra super-servlet application to Lutris EAS 4.1 Beta (#3).

OtterPod.com

OtterPod.com is the site I maintain as the official web site for my book "Enhydra XMLC Java Presentation Development." My original intent was to power the entire site with Lutris Enhydra. But when I learned that EAS 4.1 would support Enhydra EAF (super-servlet) applications, it seemed like a no-brainer to instead use EAS 4.1 for my platform. This would give me the ability to demonstrate XMLC and its use with J2EE applications.

So, I found out I needed to create an EAF file. This follows the same structure of a standard WAR file with the following ingredients:

1. Instead of a web.xml file, you create an eas-eaf.xml file.

2. You grab the ".conf" file from your super-servlet (under ./output/conf) and add it at the same left as ./META-INF, and

3. You grab the ".jar" file from your super-serlvet (under ./output/archive)

eas-eaf.xml

All I really had to do with copy the eas-eaf.xml file "demoApp" example from the lutris-eas4.1 directory called /examples:

examples/enhydraApps/demoApp/resources/META-INF/eas-eaf.xml

I simply changed the value of the url-prefix to be "otterpod." The eas-eaf.xml file then looked like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE eas-eaf PUBLIC '-//Lutris Technologies, Inc//DTD EAS EAF 1.0//EN'
'http://www.lutris.com/dtds/eas-eaf_1_0.dtd'>
<eas-eaf>
<application-group>default</application-group>
<url-prefix>otterpod</url-prefix>
</eas-eaf>

I then created the directory /META-INF and placed the eas-eaf.xml file in it. Then I put OtterPod.conf and OtterPod.jar in the directory containing /META-INF. Using the jar command, I created the eaf file OtterPod.eaf:

jar cvf OtterPod.eaf ./OtterPod.jar ./OtterPod.conf ./META-INF

I then used the Lutris Management Console and the "Deployer" command (pointed by the giant green arrow in the screen shot below) to deploy the OtterPod.eaf file. Note that the deployer button doesn't turn green until you select a server node (such as kspar in the example). You also get a deployer button if you right click your mouse on the node.

Container.xml

Well, it almost worked. The problem was that I'd structured my document hierarchy in a way that caused some URL naming collisions. So, I found out that I could own the whole doc root if I grabbed a eas-web-container.xml file and created my own application container. I located an example container file in the petstore application:

./enhydraApps/jpsEnhydra/resources/META-INF/eas-web-container.xml

I changed the contents to look like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE eas-web-container
PUBLIC '-//Lutris Technologies, Inc//DTD EAS Web Container 1.0//EN'
'http://www.lutris.com/dtds/eas-web-container_1_0.dtd'>
<eas-web-container>
<application-group name="xmlcbook" />
<connection name="xmlcbookHttp" application-group="xmlcbook" type="http">
<property name="host" value="ALL" />
<property name="port" value="8020" />
</connection>
</eas-web-container>

You can see that the web container contains information about how it's connected to the outside world. I created a new connection, associating it with the application group, "xmlcbook." and assigned it a unique port number for my server. Having decided on the name of the application group ("xmlcbook"), I then updated the eas-eaf.xml file to reflect the following.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE eas-eaf PUBLIC '-//Lutris Technologies, Inc//DTD EAS EAF 1.0//EN'
'http://www.lutris.com/dtds/eas-eaf_1_0.dtd'>
<eas-eaf>
<application-group>xmlcbook</application-group>
<url-prefix>/</url-prefix>
</eas-eaf>

As you can see, I referred my application to the new application group I'd created in the web container. And since it's the only application I'm going to run under that group, I changed the url-prefix to "/".