[jboss-user] [Management, JMX/JBoss] - starting, stoping web application

mikala do-not-reply at jboss.com
Wed Mar 11 10:51:06 EDT 2009


Hello All !!!

I try to control web application - stop(), start() - on JBOSS 5.0.1.
I can  call stop() or start() on jboss.web.deployment:war=/www  MBean in jmx-console, my www.war application starting or stoping.

I wrote my MBeean:

  | @Service(name = "WebAppController", objectName = "www:service=WebAppController")
  | @Local(WebAppControllerLocal.class)
  | @Remote(WebAppControllerRemote.class)
  | @Management(WebAppControllerManagement.class)
  | public class WebAppController implements WebAppControllerLocal,
  | 		WebAppControllerRemote, WebAppControllerManagement {
  | 	private static Logger log = Logger.getLogger(WebAppController.class);
  | 
  | 	public void startWebApp(String app) {
  | 		log.info("starting www applications ...");
  | 		try {
  | 			MBeanServer server = (MBeanServer) MBeanServerFactory
  | 					.findMBeanServer(null).get(0);
  | 			ObjectName name = new ObjectName("jboss.web.deployment:war=/" + app);
  | 			server.invoke(name, "start", new Object[0], new String[0]);
  | 		} catch (Exception e) {
  | 			e.printStackTrace();
  | 		}
  | 	}
  | 	public void stopWebApp(String app) {
  | 		log.info("stoping www applications ...");
  | 		try {
  | 			MBeanServer server = (MBeanServer) MBeanServerFactory
  | 					.findMBeanServer(null).get(0);
  | 			ObjectName name = new ObjectName("jboss.web.deployment:war=/" + app);
  | 			server.invoke(name, "stop", new Object[0], new String[0]);
  | 		} catch (Exception e) {
  | 			e.printStackTrace();
  | 		}
  | 	}
  | 	public void create() throws Exception {
  | 		log.info("creating service");
  | 	}
  | 	public void start() throws Exception {
  | 		log.info("starting service");
  | 	}
  | 	public void stop() {
  | 		log.info("stoping service");
  | 	}
  | 	public void destroy() {
  | 		log.info("destroying service");
  | 	}
  | }
  | 

When I try to run stopWebApp("www") and startWebApp("www") from jmx-console I have exception:

  | 15:45:53,133 ERROR [TomcatDeployment] ENC setup failed
  | javax.naming.NameAlreadyBoundException: TransactionSynchronizationRegistry
  | 	at org.jnp.server.NamingServer.bind(NamingServer.java:209)
  | 	at org.jnp.interfaces.NamingContext.bind(NamingContext.java:646)
  | 	at org.jnp.interfaces.NamingContext.bind(NamingContext.java:607)
  | 	at org.jboss.web.tomcat.service.deployers.TomcatDeployment$EncListener.lifecycleEvent(TomcatDeployment.java:465)
  | 	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
  | 	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4388)
  | 	at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:312)
  | 	at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:144)
  | 	at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
  | 	at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
  | 	at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:597)
  | 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
  | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  | 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
  | 	at com.zetokatowice.talgos.core.facade.ejb3.controller.WebAppController.startWebApp(WebAppController.java:27)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:597)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)
  | 	at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:69)
  | 	at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:73)
  | 	at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:59)
  | 	at sun.reflect.GeneratedMethodAccessor295.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:597)
  | 	at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
  | 	at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72)
  | 	at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_3306125.invoke(InvocationContextInterceptor_z_fillMethod_3306125.java)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
  | 	at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88)
  | 	at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_3306125.invoke(InvocationContextInterceptor_z_setup_3306125.java)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
  | 	at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
  | 	at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
  | 	at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
  | 	at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
  | 	at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
  | 	at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
  | 	at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
  | 	at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
  | 	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
  | 	at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
  | 	at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
  | 	at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
  | 	at org.jboss.ejb3.service.ServiceContainer.localInvoke(ServiceContainer.java:512)
  | 	at org.jboss.ejb3.service.ServiceContainer.localInvoke(ServiceContainer.java:475)
  | 	at org.jboss.ejb3.service.ServiceMBeanDelegate.invoke(ServiceMBeanDelegate.java:215)
  | 	at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
  | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
  | 	at org.jboss.jmx.adaptor.control.Server.invokeOpByName(Server.java:258)
  | 	at org.jboss.jmx.adaptor.control.Server.invokeOp(Server.java:223)
  | 	at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet$3.run(HtmlAdaptorServlet.java:380)
  | 	at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet$3.run(HtmlAdaptorServlet.java:377)
  | 	at java.security.AccessController.doPrivileged(Native Method)
  | 	at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOp(HtmlAdaptorServlet.java:376)
  | 	at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOp(HtmlAdaptorServlet.java:287)
  | 	at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:104)
  | 	at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doPost(HtmlAdaptorServlet.java:86)
  | 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
  | 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  | 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  | 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
  | 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
  | 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
  | 	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
  | 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
  | 	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
  | 	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
  | 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
  | 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
  | 	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
  | 	at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:402)
  | 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  | 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
  | 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
  | 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
  | 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
  | 	at java.lang.Thread.run(Thread.java:619)
  | 

What is difference between calling start() in jboss.web.deployment:war=/www and calling startWebApp("www") in my service www:service=WebAppController ?


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

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



More information about the jboss-user mailing list