Programmatically stop and start JBoss in Eclipse
Asked Answered
D

1

7

Is it possible to programmatically start and stop JBoss in Eclipse? I am using Indigo Eclipse Java EE, I have a JBoss 5.1.0.GA server that I manually start/stop in Eclipse.

I want to automate restarting the server (as part of a test procedure to restart the server to reflect changes in the database). Is there some library that I can use to do this, or some other way of accomplishing this?

Dissatisfy answered 22/2, 2013 at 15:7 Comment(1)
Well, you could write a separate program module that is referring to the jboss .bat files.. Just a thought.Regent
I
5

Create a .bat or .sh file (depending on the OS your JBoss instance is installed) with a script that executes the shutdown (bat or sh) and then the run (bat or sh). There's no need to use Java or any other programming language for this.

Still, if you really want to do this using Java, you can use one of the approaches (again, depending on the OS):

Batch files:

Shell files:

Just note that the run and stop scripts files are in [JBoss_install_path]/bin

Intersect answered 22/2, 2013 at 15:17 Comment(2)
Does it matter that I started it in Eclipse? Eclipse won't recognize that it is started if I manually run run.bat, will it? Also, I'd probably have to mimic the arguments and directly run run.jar, since that's how I think it's started when done in Eclipse.Dissatisfy
Nope, it won't matter if you started your JBoss instance from Eclipse or manually, the stop.jar will, uhm, stop the JBoss running instance. Note that doing this, Eclipse may be not synchronized with the JBoss running instance.Intersect

© 2022 - 2024 — McMap. All rights reserved.