<div dir="ltr">Hi guys,<div><br></div><div>For the Mobicent SIP Servlet project that is build on top of AS7, we have some CLI operations to list available SIP Servlet application, to gracefuly stop the context and the server. These operations work fine when the server runs in standalone mode using the command: </div>
<div> /subsystem=sip:listSipAppplications</div><div><br></div><div>But  when running in domain mode the command should be (sip subsystem belongs to the default profile) : </div><div>  /profile=default/subsystem=sip:listSipAppplications</div>
<div>But then we get an NPE because the context that the operation executes is not a normal server:</div><div><div><span class="" style="white-space:pre">        </span>@Override</div><div><span class="" style="white-space:pre">        </span>public void execute(OperationContext context, ModelNode operation)</div>
<div><span class="" style="white-space:pre">                        </span>throws OperationFailedException {</div><div><br></div><div><span class="" style="white-space:pre">                </span>ModelNode result = context.getResult();</div><div><span class="" style="white-space:pre">                </span>result.get(&quot;AppName&quot;).setEmptyList();</div>
<div><span class="" style="white-space:pre">                </span>if(context.isNormalServer()){</div><div><span class="" style="white-space:pre">                        </span>SipApplicationDispatcher sipApplicationDispatcher = StaticServiceHolder.sipStandardService.getSipApplicationDispatcher();</div>
<div><span class="" style="white-space:pre">                        </span>Iterator&lt;SipContext&gt; sipApps = sipApplicationDispatcher.findSipApplications();</div><div><br></div><div><span class="" style="white-space:pre">                        </span>while(sipApps.hasNext()){</div>
<div><span class="" style="white-space:pre">                                </span>result.get(&quot;AppName&quot;).add(sipApps.next().getApplicationName());</div><div><span class="" style="white-space:pre">                        </span>}</div><div><span class="" style="white-space:pre">                </span>} else {</div>
<div><span class="" style="white-space:pre">                        </span></div><div><span class="" style="white-space:pre">                        </span>throw new OperationFailedException(new ModelNode().set(&quot;Operation available only a Server&quot;));</div>
<div><span class="" style="white-space:pre">                </span>}</div><div><span class="" style="white-space:pre">                </span>context.completeStep();<span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">        </span>}</div>
</div><div><br></div><div>Is there a way we can specify a server node that the operation should execute?</div><div><br></div><div>Also, in standalone mode, we gracefuly shutdown the server and the contexts running using the following:</div>
<div><div><span class="" style="white-space:pre">        </span>protected void shutdownServer() throws MalformedObjectNameException, NullPointerException, InstanceNotFoundException, MBeanException, ReflectionException, IOException{</div>
<div><span class="" style="white-space:pre">                </span>MBeanServerConnection mbeanServerConnection = ManagementFactory.getPlatformMBeanServer();</div><div><span class="" style="white-space:pre">                </span>ObjectName mbeanName = new ObjectName(&quot;jboss.as:management-root=server&quot;);</div>
<div><span class="" style="white-space:pre">                </span>Object[] args = {false};</div><div><span class="" style="white-space:pre">                </span>String[] sigs = {&quot;java.lang.Boolean&quot;};</div><div><span class="" style="white-space:pre">                </span>mbeanServerConnection.invoke(mbeanName, &quot;shutdown&quot;, args, sigs);</div>
<div><span class="" style="white-space:pre">        </span>}</div></div><div><br></div><div>And this one fails when server runs in domain mode.</div><div><br></div><div>Any ideas?</div><div><br></div><div>Thanks</div><div>George</div>
</div>