The behaviour is not "inconsistent".
In fact, it is more consistent now.
In the past, invoking "start" never actually guaranteed
the service started. It would only actually do the
start() if all the dependencies were satisfied.
Later you might actually get the start when the correct
dependency is added.
In fact, the code you show didn't even work properly
until less than 2 years ago when I made it redirect
through the service controller (under the hood
in ServiceMBeanSupport).
Now with the introduction of the MC,
everything is done consistently.
Your code should be (and always should have been
if you want things to work properly)
ServiceController.start(ObjectName);
followed by
ServiceController.getServiceContext(ObjectName)
to check what state it is actually in,
i.e. dependencies satisfied, the error/problem, etc.
See the deployment tests, that I wrote when I was fixing
all this a while ago, if you want to see the correct
pattern in more detail.
On Sat, 2006-08-19 at 15:04 -0500, Anil Saldhana wrote:
Hi,
There seems to be an inconsistent behavior in the
AbstractKernelController.
My test case code:
========================================================================
=
prepareTestDynamicLoginConfig(server,
new ObjectName("jboss:service=TestDynamicLoginConfig"),
null);
try
{
server.invoke(serviceOName,"create", new Object[0], new
String[0]);
server.invoke(serviceOName,"start", new Object[0], new
String[0]);
fail("Service should not have started");
}
catch(Throwable t)
{
log.debug("Service has rightly disagreed to start",t);
}
========================================================================
Is failing now because the MC instead of throwing an exception(unable to
start a service), is only logging the error as follows:
------------------------------------------------------------------
14:50:19,015 ERROR [AbstractKernelController] Error installing to Start:
name=jb
oss:service=TestDynamicLoginConfig state=Create mode=Manual
requiredState=Installed
java.lang.IllegalStateException: AuthConfig is defaulting to
conf/login-config.xml. Please check your archive.
at
org.jboss.security.auth.login.DynamicLoginConfig.validateAuthConfigUR
L(DynamicLoginConfig.java:271)
at
org.jboss.security.auth.login.DynamicLoginConfig.startService(Dynamic
LoginConfig.java:219)
at
org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanS
upport.java:289)
at
org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMB
eanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
...
...org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
java:264)
at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at
org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java
:167)
at $Proxy0.start(Unknown Source)
at
org.jboss.system.microcontainer.StartStopLifecycleAction.installActio
n(StartStopLifecycleAction.java:42)
at
org.jboss.system.microcontainer.ServiceControllerContextAction.instal
l(ServiceControllerContextAction.java:46)
at
org.jboss.dependency.plugins.AbstractControllerContextActions.install
(AbstractControllerContextActions.java:51)
at
org.jboss.dependency.plugins.AbstractControllerContext.install(Abstra
ctControllerContext.java:226)
-----------------------------------------------------------------
Please advice on this inconsistent behavior.
Regards,
Anil
_______________________________________________
jboss-development mailing list
jboss-development(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-development --
xxxxxxxxxxxxxxxxxxxxxxxxxxx
Adrian Brock
Chief Scientist
JBoss a division of Red Hat
xxxxxxxxxxxxxxxxxxxxxxxxxxx