Last month, we looked at XMLC, a new system for displaying dynamic web content that comes with the Enhydra application server. This month, we will look at how to write servlets and basic applications using the tools that come with Enhydra. While Enhydra's web applications are not as standardized as servlets with Jakarta-Tomcat, they do offer a fair amount of power and the possibility of creating Enterprise JavaBeans with a fully open-source infrastructure.
Enhydra is an open-source application server written in Java, aiming for full compliance with Sun's J2EE specifications. Lutris, the company that spearheads Enhydra development, has made the application server available under a BSD-like license. The current stable version of Enhydra is 3.x and includes support for a large number of standards, including servlets and JSPs. Enhydra Enterprise, which is slated for release during the summer of 2001, will have additional J2EE features, including support for Enterprise Java Beans (EJB).
Enhydra itself is available as a fully open-source product, meaning that you can download it from the Web and install it. But for those clients who might be suspicious of open-source software, who want to use a packaged product that has gone through quality assurance or who want to get support from Lutris, commercial versions of Enhydra are available. I suspect that most people reading this column will not need support from Lutris, but it is good to know that they are ready and willing to help others use the product.
Lutris is aiming Enhydra not just at the J2EE market but also at the market for wireless internet applications. I personally have yet to see a compelling use of cellular internet technologies—the WAP functionality on my mobile phone could charitably be called pathetic—but Lutris is positioning Enhydra as a player in what will inevitably become a hot market.
While Enhydra has yet to develop the mindshare or community of Zope and the ArsDigita Community System, they have managed to score a fair number of impressive commercial triumphs. In particular, Hewlett-Packard recently announced that they would work with Lutris to market and use Enhydra in a number of applications. If nothing else, this proves that open-source application servers do have an important place in the world of web application development and that they can provide a compelling case even to companies that could otherwise afford to pay much more.
Now that we've reviewed a bit of the background, let's try to create some basic web applications using Enhydra. The first task, of course, is to download and install the product. I decided to download the beta of Enhydra Enterprise, in no small part because I wanted to play with the EJB features. As of the beta release, Enhydra Enterprise requires JDK 1.3, a pleasant contrast to previous releases that required JDK 1.2 even after 1.3 had been released for quite a while.
I downloaded and unpacked the Enhydra tar file, which created a large number of files and directories under the enhydra4.0 directory. As you might guess, the doc directory contains documentation, the lib directory contains .jar files that Enhydra needs and the conf directory contains global Enhydra configuration files. There is also a bin directory, in which nearly all files are shell scripts (with Windows .bat equivalents) that execute the various Java programs that make up Enhydra.
To ensure that the Enhydra shell scripts and Java programs are aware of the directory in which you installed Enhydra, run the configure shell script in the root directory of the Enhydra distribution (to which I will refer as $ENHYDRA). configure takes a single mandatory argument, the root directory of your JDK installation. configure modifies a number of Makefiles and other configuration files but does not force a recompilation of any code. After running configure (which does not produce any visible output), run the bash shell script (setup.bash) in $ENHYDRA, which adds the JDK executable directory to your PATH.
Enhydra consists of a number of different interrelated software packages. The application server itself, known as the multiserver, can work directly opposite HTTP clients or with a front-end web server such as Apache acting as a proxy. You can reduce the number of services that the multiserver starts up or change the order in which they are started by changing the loadOrder property in $ENHYDRA/conf/bootstrap.conf.
To start the multiserver, simply run $ENHYDRA/bin/multiserver. It should start up right away, launching services one at a time until you finally see the message, “Bootstrapper initialized normally”. At this point, you can test the multiserver by pointing your web browser at port 8001, which should bring up a control panel for viewing the current state of your multiserver.
My initial attempts to launch the multiserver failed, with the program complaining that it was unable to find enhydra.jar in my CLASSPATH. Particularly confusing here was the fact that I couldn't find any such file as enhydra.jar in the entire Enhydra distribution.
The solution turned out to be simple, if not obvious: Enhydra knows what CLASSPATH is necessary in order to run each of its programs but will ignore those settings if you have already set your CLASSPATH. So before running the multiserver, make sure to unset CLASSPATH, removing this environment variable. Once you have done this, the multiserver should come up as expected.
Reuven M. Lerner, Linux Journal Senior Columnist, a longtime Web developer, consultant and trainer, is completing his PhD in learning sciences at Northwestern University.
Webinar: 8 Signs You’re Beyond Cron
11am CDT, April 29th
Join Linux Journal and Pat Cameron, Director of Automation Technology at HelpSystems, as they discuss the eight primary advantages of moving beyond cron job scheduling. In this webinar, you’ll learn about integrating cron with an enterprise scheduler.Join us!
- Picking Out the Nouns
- Tips for Optimizing Linux Memory Usage
- "No Reboot" Kernel Patching - And Why You Should Care
- DevOps: Better Than the Sum of Its Parts
- Return of the Mac
- Android Candy: Intercoms
- Drupageddon: SQL Injection, Database Abstraction and Hundreds of Thousands of Web Sites
- Non-Linux FOSS: .NET?
- New GeekGuide: Beyond Cron