Deploying services and error handling
aloubyansky Aug 12, 2010 10:17 AMRight now standalone fails to start because there are nonexistent deployments in its config. (BTW, it's logged only in its boot.log, not on the console. So the console logs include just JBoss Bootstrap Environment and some envvar value. And then silently returns to the shell prompt.)
The boot.log contains
{quote:title=boot.log}14:36:51,090 ERROR [stderr] org.jboss.as.server.ServerStartException: Failed to start server
14:36:51,090 ERROR [stderr] at org.jboss.as.server.AbstractServer.start(AbstractServer.java:106)
14:36:51,090 ERROR [stderr] at org.jboss.as.server.StandaloneServer.start(StandaloneServer.java:71)
14:36:51,091 ERROR [stderr] at org.jboss.as.server.Main.boot(Main.java:92)
14:36:51,091 ERROR [stderr] at org.jboss.as.server.Main.main(Main.java:71)
14:36:51,091 ERROR [stderr] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:36:51,091 ERROR [stderr] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
14:36:51,091 ERROR [stderr] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
14:36:51,091 ERROR [stderr] at java.lang.reflect.Method.invoke(Method.java:597)
14:36:51,091 ERROR [stderr] at org.jboss.modules.Module.run(Module.java:373)
14:36:51,092 ERROR [stderr] at org.jboss.modules.Main.main(Main.java:171)
14:36:51,092 ERROR [stderr] Caused by: java.lang.RuntimeException: Deployment root does not exist."/c:/Users/avoka/github.com/jboss-as/build/target/server/deployments/my-app.ear"
14:36:51,092 ERROR [stderr] at org.jboss.as.model.ServerGroupDeploymentElement.activate(ServerGroupDeploymentElement.java:218)
14:36:51,092 ERROR [stderr] at org.jboss.as.model.Standalone.activate(Standalone.java:461)
14:36:51,092 ERROR [stderr] at org.jboss.as.server.AbstractServer.start(AbstractServer.java:101)
14:36:51,092 ERROR [stderr] ... 9 more{quote}
So, the first thing I'd like to agree upon is whether the server should really shutdown if at least one of the deployments menetioned in its config wasn't found. If we want to follow the traditional approach then it shouldn't but should log the errors.
In fact, I can see that there is in fact some logic to log the failed services but it just doesn't get to that point because the ServiceActivator impl in this case throws a RuntimeException
{code}public void activate(final ServiceActivatorContext context) {
final String deploymentName = key.getName() + ":" + key.getSha1HashAsHexString();
log.info("Activating server group deployment: " + deploymentName);
final VirtualFile deploymentRoot = VFS.getChild(getFullyQualifiedDeploymentPath(key.getName()));
if (!deploymentRoot.exists())
throw new RuntimeException("Deployment root does not exist." + deploymentRoot);{code}
And then AbstractServer just re-throws it
{code}catch (Throwable t) {
throw new ServerStartException("Failed to start server", t);
}{code}
So, I was thinking perhaps we should introduce some ServiceActivationException and hanle it so that we collect all the failed deployments which the DeploymentCallback is supposed to report.