[jboss-dev-forums] [Design the new POJO MicroContainer] - ProfileService shutdown and undeploy order

adrian@jboss.org do-not-reply at jboss.com
Fri Jan 25 12:22:02 EST 2008


The problem with the NoInitialContext in the all configuration
is because it is not undeploying the in the reverse order of deployment.


  | 17:49:05,946 ERROR [DefaultPartition] partition unbind operation failed
  | javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
  |         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
  |         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
  |         at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
  |         at javax.naming.InitialContext.unbind(InitialContext.java:375)
  |         at org.jboss.ha.framework.server.ClusterPartition.stopService(ClusterPartition.java:408)
  | 

The issue is that the ProfileServiceBootstrap just does a MainDeployer.shutdown()
but this just undeploys in "random" order.


  |    private Map<String, DeploymentContext> topLevelDeployments = new ConcurrentHashMap<String, DeploymentContext>();
  | 
  |    public void shutdown()
  |    {
  |       lockWrite();
  |       try
  |       {
  |          while (topLevelDeployments.isEmpty() == false)
  |          {
  |             // Remove all the contexts
  |             for (DeploymentContext context : topLevelDeployments.values())
  |             {
  |                topLevelDeployments.remove(context.getName());
  |                removeContext(context, true);
  |             }
  | 
  |             // Do it
  |             process();
  |          }
  | 

In the example above, conf/jboss-service.xml is undeployed before
the clustering deployment.

This can obviously be fixed, but I guess what should really be happening
is the ProfileService undeploys in reverse order of stages,
i.e. APPLICATION then DEPLOYER then BOOTSTRAP.

The MainDeployer.shutdown() should just be there to catch things
that don't undeploy themselves properly.

The problem is that the Profile api doesn't guarantee any ordering

  |    Collection<VFSDeployment> getDeployments(DeploymentPhase phase) throws Exception;
  | 

even though it is implemented as ordered in ProfileImpl using LinkedHashMaps

  |    private LinkedHashMap<String, VFSDeployment> bootstraps = new LinkedHashMap<String, VFSDeployment>();
  |    private LinkedHashMap<String, VFSDeployment> applications = new LinkedHashMap<String, VFSDeployment>();
  |    private LinkedHashMap<String, VFSDeployment> deployers = new LinkedHashMap<String, VFSDeployment>();
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4123603#4123603

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4123603



More information about the jboss-dev-forums mailing list