Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Start JBoss programatically  RSS feed

 
Miguel Roque
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

I need to start, stop and restart JBoss programatically. First I've tryed with but nothing is done and if I try to read the methods of this class using reflection nothing is show and if I try to execute the boot method also by reflection, a exception is raised informing that the method is not found!

The only soluction that I've found was by including to my class and create a new instance of the Main class and execute the method of this class. Like this, I can start JBoss programatically.

My question is, how can I stop it or restart it also programatically? Other question is, how can I start JBoss using reflection? Is there a way to put to work as I would prefer this way to start and stop the server?

Thanks,
Miguel
 
Sanju Thomas
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use org.jboss.Shutdown class to shut down the JBoss programatically.
 
Sanju Thomas
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you can use reflection to start JBoss.

Sample code



You can pass parameter to JBoss AS through the String array.

I think this will work. And on the same way you can Shutdown class too.
 
Sanju Thomas
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you can Shutdown the Server in this way.


Hope this may help you.
 
Miguel Roque
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sanju.

First of all, thanks for the quick answer. I've tryed using reflection but it gives the following messages:



It starts OK but then...

The only way I've managed to start JBoss was by using a instance of the Main class, and then executing the boot method, but this was in a console application that was executed from DOS! If I try to run in Eclipse it gives the same message as by using reflection.

Thanks,
Miguel
 
Sanju Thomas
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is because, those classes are not there in your class path. If you are using Eclipse then include those class files as library. If you are not using an IDE then you must include all those JBoss library jar into the class path. Hope this will help you.
 
Miguel Roque
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again.

Yes, it's something in the classpath. If I have the classpath as follows:



It gives the exception, but if the classpath is set as:



It works!

I must see the Eclipse configuration on this, but I've added as external jar the run.jar and shutdown.jar to my project.

Thanks,
Miguel
[ June 16, 2005: Message edited by: Miguel Roque ]
 
Miguel Roque
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

I've checked the configuration of the classpath variable and the problem is as follows. If I put the "shutdown.jar" in the classpath, when I start JBoss I get the exceptions mentioned in the previous post. If I remove the "shutdown.jar" from the classpath variable, JBoss starts without problems, but then I'm unable to stop it!!!

Any sugestion?

Thanks,
Miguel
 
Miguel Roque
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

As anyone have had any idea on this?

Thanks,
Miguel
 
Sudipta Laha
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I tried starting JBOSS from JAVA. It worked for me.

Please file the below link
http://sudiptalahapost.blogspot.com/2010/09/running-jboss-programatically-from-java.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!