Hello.

I'm trying to programatically start and stop JBoss server, but I'm having some 
problems. Actualy, my code to start/stop is as follows:


  | import org.jboss.*;
  | 
  | ...
  | 
  | private void startJBoss() {
  |     try {
  |         String str[]={};
  |         Class c = Class.forName("org.jboss.Main");
  |         Main ob = (Main)c.newInstance();
  |         ob.main(str);
  |     } catch (Exception e) {
  |         System.out.println(e.getMessage());
  |     }
  | }
  |     
  | private void stopJBoss() {
  |     try {
  |         String str[]={"-S"};
  |         Class c = Class.forName("org.jboss.Shutdown");
  |         Shutdown ob = (Shutdown)c.newInstance();
  |         ob.main(str);
  |     } catch (Exception e) {
  |         System.out.println(e.getMessage());
  |     }
  | }
  | 

In the classpath I have added the run.jar and shutdown.jar from the bin 
directory of JBoss. Now the problem comes when I start JBoss where I receive 
the following exceptions:


  | [Server] Starting General Purpose Architecture (GPA)...Exception in thread 
"main" java.lang.NoClassDefFoundError: org/dom4j/Element
  |     at java.lang.Class.getDeclaredConstructors0(Native Method)
  |     at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
  |     at java.lang.Class.getConstructor0(Unknown Source)
  |     at java.lang.Class.newInstance0(Unknown Source)
  |     at java.lang.Class.newInstance(Unknown Source)
  |     at 
org.jboss.mx.modelmbean.RequiredModelMBeanInstantiator.instantiate(RequiredModelMBeanInstantiator.java:37)
  |     at org.jboss.mx.server.MBeanServerImpl.<init>(MBeanServerImpl.java:205)
  |     at 
org.jboss.mx.server.MBeanServerBuilderImpl.newMBeanServer(MBeanServerBuilderImpl.java:56)
  |     at javax.management.MBeanServerFactory.newMBeanServer(Unknown Source)
  |     at javax.management.MBeanServerFactory.createMBeanServer(Unknown Source)
  |     at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:349)
  |     at org.jboss.system.server.ServerImpl.start(ServerImpl.java:310)
  |     at org.jboss.Main.boot(Main.java:195)
  |     at org.jboss.Main$1.run(Main.java:463)
  |     at java.lang.Thread.run(Unknown Source)
  | 

If I remove the shutdown.jar from the classpath, I can start JBoss without 
problems, but then, I don't have any option to stop it.

Any other way to start/stop JBoss programatically.

Thanks,
Miguel


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

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


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to