OOP-ResearchMake It Simpler by Object Oriented Programming

Patch for JOnAS2.0, EJB server (Enterprise Java Bean)

The patch for JOnAS2.0 for closing all the actual JDBC connection when shutdown. With this patch, 'ejbRemove()' is also invoked on each the session bean. You can download it at FREE from OOP-Research.


What is JOnAS2.0?

EJB is the core architecture of J2EE. To build up the enterprise-oriented, network-oriented and system-independent Java components, EJB is essential architecture for the serious developer in the world. Since EJB 1.1 specification was released, we have desired some sophisticated EJB compliant server.
And now voilà JOnAS2.0 from Bull S.A..

JOnAS2.0 is one of the most powerful EJB server in the world. JOnAS2.0 provides us everything we need:

  • Container managed persistence for Entity Beans.
  • Container managed Transaction support.
  • Sophisticated implementation of DataSource(JDBC2)
  • XML based deployment descriptor.
and much more. In addition, JOnAS is build on Java! One of the benefits taken from EJB is that we can be independent from OS and RDB. I believe that the fact of 100%-pure-Java and the sophisticated implementation of DataSource will make us happy.

Some slight issues

JOnAS2.0 is enough to build up our enterprise-oriented systems, there are some slight issues about its implementation. They are:

Not closing the actual JDBC connections at shutdown
The current implementation of ConnectionManager is responsible for closing the actual JDBS connection after the specified time passed. It is the great improvement. But there is the possibility that some connections remain opened at the server shutdown. This doesn't matter for most RDB, but as for InstantDB, it results in the problem. Anymore, it is desirable to close all the actual JDBC connection when the server is shutdown.
No 'ejbRemove()' on the session bean instance
According to the EJB Spec 1.1, the 'ejbRemove()' on the session bean instances have nothing to do with the 'remove' on the home or remote interface. The container can invoke 'ejbRemove()' on the session bean instance at its convenience. But when the container discards the session bean instance, it should invoke 'ejbRemove()' on it. And it is not true for the current implementation of JOnAS2.0. So the session bean instance must reply on the client call of 'remove()' and this is not good. When the server shutdown, the container only unbinds the available session bean instances. Thus the session bean instance has no chance to achieve some clean tasks, such as closing active connections, normally which are done within 'ejbRemove()'.

Solution: Un-official patches

To solve these problems, the slight modification will be enough. I've modified the following classes:

  • org.objectweb.jonas.container.Container
  • org.objectweb.jonas.container.JSessionHome
  • org.objectweb.jonas.dbm.ConnectionManager
  • org.objectweb.jonas.dbm.DataBaseManager
  • org.objectweb.jonas.tools.GenICSessionHome
NOTE:
I've contributed these sources to ejb-container-group mailing list. Some of my patches will be merged into the next version of JOnAS. But in this point, my patches are UN-OFFICIAL ones.
The source for these classes is available here.
After extracted, the directory of jonas_patch is created, and under the directory, the subdirectory of 'modified_src' contains the modified sources while 'modified_org' contains the original sources.
Within in the source code, the lines between
        //Start:Jun Inamori modified
and
	//End:Jun Inamori modified
are modified.
To compile the sources and update the jar files, simply run the shell script of 'build_update.sh', assuming the CLASSPATH and JONAS_ROOT are set to the appropriate values.

Caution!
All the APIs for Servlet/JSP introduced by this web site are now included in Bento framework:
  • Simpler than JSTL or Apache Struts
  • MVC framework by HTML
  • Input validation from CGI FORM
  • Easy user authentication
  • Easy localization (L10n)
To download the APIs and source code examples, please visit the web site of Bento framework.


JBuilder 2007


General Information

For Java Development

Java and all Java-based trademarks and logos are trademarks or registered of Sun Microsystems, Inc. in the United States and other countries.


ALL CONTENTS COPYRIGHT 1997-2007, OOP-Research Corporation. All rights reserved.