Developing Java Enterprise Applications 2nd Edition

Welcome to the website for the second edition of our book Developing Java Enterprise Applications. This site contains errata, updates and resources that we hope will help our readers. If you have any suggestions or found any problems in the book, please email us at ejava at so that we can update the site.

Code Updates and Examples


For some reason, Sun decided that I need to be protected from my own server. So servlets are not allowed to right to the file system by default. This will effect a number of examples. To fix this problem open the lib/security/server.policy file. Scroll to the final grant statement and update the file permissions to include:

permission "*", "read,write,delete";


permission "${com.sun.enterprise.home}${file.separator}-", "read,write,delete";

by adding the write and delete permissions to these two entries. This will allow all code to read and write files.

Search Servlet

The Search Servlet is broken, due to the j2ee's implementation of the security manager. In general EJBs and servlets should not use threads directly, but we were doing so to simplify this example. To fix this problem, replace the file with this one, which removes the use of threads in the IndexLoader. This version will pause for the first user, instead of failing. Or, keep the existing IndexManager that runs in the background and update the server.policy file to include the line:

permission java.lang.RuntimePermission "modifyThreadGroup";

in the final grant block that effects all code. Be sure to fix the file security issues mentioned above.

Container Managed Persistence

Sun updated the CMP model after the book was published. Check the documentation for the latest information, and check back here for new examples.


  • Some build scripts use the Unix rm instead of the DOS del command
  • We used the machine address and name brisco for some examples. You will need to update these.
  • In 4-tier store example
    • Search servlet should be updated, see Code Updates section.
    • Use the deploy tool's Tools->Server Configuration menu to create the ejava datasource after you run the build script
    • Make sure to copy the ads directory to c:\temp or update the web.xml file to reflect the directory you want to use.
    • Make sure to start the Cloudscape database, using the cloudscape executable in the bin directory, before trying to make a purchase