geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Higham <st...@sjlt.co.uk>
Subject Re: Geronimo:wait-for-server is not waiting
Date Tue, 31 Dec 2013 12:06:57 GMT
Hi David,

Thanks for responding - really appreciated :-) 

I've downloaded the 3.0.1 source code. I'm building it with "mvn clean install". I'm running
with the following commands

cd assemblies/geronimo-tomcat7-javaee6-web/target/assembly/bin
chmod a+x Geronimo
./Geronimo run

Once started I'm running Geronimo:wait-for-server. When this completes I shut down the server
and look at the log file. I'm adding additional logging and fixing issues in the code as follows:

file framework/modules/geronimo-shell-base/.../WaitForServerCommand.Java

The method of interest is protected Object do execute ()

This starts with

if (is embedded ()) { return null; }

The isEmbedded () call is returning true so the method consistently returns immediately. I
think this code needs deleting. I appreciate that the embedded case needs thought but an immediate
return is inappropriate. 

Further down we see the code

if (server != null) { started = ... }

if (!started) { Throwable error = server.getLastError (); ... }

This clearly fails when server == null. The fix is trivial.

Within the try section (in the !started loop) the problems get more interesting. connection.getDeploymentManager
() is downcast to RemoteDeploymentManager. Unfortunately in my scenario the object returned
is of type LocalDeploymentManager so this fails. I'm working to fix this with minimal code
changes. I can clean up later. Therefore  I've started with the following: 

DeploymentManager deploymentMgr = null;
try {
  connection = connect ();
  deploymentMgr = connection.getDeploymentManager ();
  if (deploymentMgr instanceof RemoteDeploymentManager) {
    ... existing solution ...
  } else if (deploymentMgr instanceof LocalDeploymentManager) {
    started = ((LocalDeploymentManager)deploymentMgr).isFullyStarted ();
  }

This looks OK, but to compile I need to add isFullyStarted () to the class LocalDeploymentManager.
I've done this based on the same function in the ServerProxy class. The private utility methods
have been cut and pasted over (can refactor later).

File framework/modules/geronimo-deploy-jsr88/.../LocalDeploymentManager.Java

public boolean isFullyStarted () {
  boolean fully started = true;
  // Do I need to mess about with class loaders in the Local case?
  Set<AbstractName> result = kernel.listGBeans (CONFIGURER_QUERY);
  try {
    for (AbstractName name : result) {
      boolean started = getBooleanAttribute (name, "kernelFullyStarted");
      if (!started) {
        fully started = false; break;
      }
    }
  }
  catch (IOException e) { ... }
  catch (Exception e) { ... }
  ...
}

This compiles but when I run it I'm getting a NoSuchAttributeException for attribute "kernelFullyStarted".
I've traced this to a GBeanInstance:invoke call but that's as far as I've got.

Any insights very welcome as this is my first forray into the Geronimo code base.

Cheers,

Steve




David Jencks <david_jencks@yahoo.com> wrote:

>Can you be more specific about what is started and what isn't?  I haven't looked at the
shell command or the underlying functionality in a really long time but I think that the wait-for-server
functionality was waiting for all the gbeans in all the cars mentioned in server.xml to start.
 It won't wait for any apps deployed dynamically.
>
>david jencks
>
>On Dec 29, 2013, at 4:26 AM, Steve Higham <steve@sjlt.co.uk> wrote:
>
>> Hi,
>> 
>> I'm trying to automate a Geronimo deployment using v3.0.1.
>> 
>> I have tried starting a Geronimo server and immediately connecting using SSH. I can
connect to the shell and run Geronimo:wait-for-server (interactively). However the command
returns immediately even though the server is only half way through its start up.
>> 
>> Any help appreciated.
>> 
>> Steve
>
Mime
View raw message