How do I wait for a module to be ready
By ejannett on avr. 21, 2008
A common mistake is to not make the difference between
the status of the Common Agent Container and the status of modules deployed inside.
As any container, CAC may be in good shape while modules deployed aren't.
The command "cacaoadm status" gives you the status of the container but
to get the actual state and status of a module the command is cacaoadm status <module name>.
The container may be in three states:
# cacaoadm statusdefault instance is DISABLED at system startup.default instance is not running.
# cacaoadm status default instance is DISABLED at system startup. Smf monitoring process: 13400 Uptime: 0 day(s), 0:16
# cacaoadm status default instance is DISABLED at system startup. Daemon is running but not available. Try again as it might be starting."
The container may be still starting executing its own initilization phase but mainly busy to
start modules deployed inside. see here for details. The container is ready to serve as soon as
an uptime is printed.
All this as nothing to do with the satus of a modules deployed. The container will start a module but
the module can be actually not ready to serve :
- The module's creation (deployment) may have fail because of missing jars or imcompatible platform.
- The module may have not been started because of dependency problem.
- The module may have not been started because its is locked by default
- The module may have failed to start because of an error raised during its initialization.
If an application depends on a service(s) deployed in CAC (i.e a module(s)) . This application
must monitor the status of the module it is interested in and not the container itself.
This is done by "cacaoadm status <module name>".
Few examples of module'state/status :
- Module up and running.
# cacaoadm status com.sun.cacao.rbacOperational State:ENABLEDAdministrative State:UNLOCKEDAvailability Status:Module is in good health.
- Module only enabled on demand (off line for now)
#cacaoadm status com.sun.cacao.efd Module com.sun.cacao.efd has not been loaded. Cause of the problem:[OFF_LINE]
- Module registered and enabled but which had a problem starting
#cacaoadm status com.sun.cacao.instrumOperational State:DISABLEDAdministrative State:UNLOCKEDAvailability Status:[OFF_LINE]
- Module not loaded by the container due to errors
#cacaoadm status com.sun.scn.base.SCNBaseModule com.sun.scn.base.SCNBase has not been loaded.Cause of the problem:[FAILED]
- Module not started by the container due to dependency problem
#cacaoadm status com.sun.scn.SolarisAssetModuleModule com.sun.scn.SolarisAssetModule has not been loaded.Cause of the problem:[DEPENDENCY]
Another tips for a module developer is set correctly its dependencies. One of basics examples is connectors.
If a module offer a service using the RMI connector (if the client part of the applications access it
only using the RMI connector). If the developer knows that its entire logic will be down because if this,
the module descriptor file of the module should define a dependency on the RMI module.