Developing for Deployment


In the real world, virtually all Jini services and clients will be run in multimachine environments. This means that services may be scattered across any number of machines on a network. The downloadable code for these services may be served by any number of HTTP servers, and clients may be connecting to these services from any machine.

But often--whether through convenience or necessity--you need to develop and test your code on only one machine. It's quite easy to run into problems in such cases, simply because by running everything on one machine you're not exercising parts of your code that may cause things to break when the components of your distributed system run on different hosts.

For most Jini development, you will have three Jini-aware applications running: a lookup service, the service you're testing, and a client that uses that service (these applications are in addition to whatever other programs are needed, such as HTTP servers and RMI activation daemons). If all of these programs run on the same machine, and share the same resources (the same CLASSPATH, the same HTTP server, and so on), then potential problems with dynamic class loading or with security may be masked. Developing and testing in such an environment can allow problems to lurk unnoticed in your code.

This is the great danger to only testing locally. The apparent early convenience of taking the easy way out can result in greater headaches down the road. So even though a multimachine environment may require more up-front work, such as starting more HTTP servers, setting security policies, and so on, youll be rewarded for this effort by easier debugging and deployment later. For this reason, its a good idea to get in the habit of thinking about multimachine environments, and even simulating such environments when you develop and test.

Fortunately this simulation is fairly easy to do. There are some simple tips you can follow when you run and test your code to ensure that it will work in such a multi-machine environment, even if youre developing on only one computer. These tips address most of the common problems in a multimachine setting.

These are the guidelines I follow when developing Jini applications, and they're the guidelines that I follow in the Core Jini book. I hope they help. Here are the tips I recommend following when developing.

Let's look at each of these in turn.

Run Multiple HTTP Servers

Watch Out for Codebase Problems Always Set a Security Manager Pay Attention to Security Policies Take Care with CLASSPATH Consider Bundling Downloadable Code into a JAR File Summary Go back to Jini Planet

Keith Edwards
kedwards@kedwards.com


Copyright 1999, W. Keith Edwards