Anand
Anand

Reputation: 707

Jenkins - JBoss AS - Restart the server using jenkins

I am trying to set up the CI environment using Jenkins. As I am using the JBoss AS 7.1 as the app server, I installed the JBoss Management Builder plugin in Jenkins. I did configure the properties for JBoss and created a job to start the server. Job is also running without any errors.

As I use the "standalone", I start the server using standalone.bat file. But Jenkins fires the run.bat to start the server. I even mentioned the command "standalone -b <>" in the properties sections to force Jenkins to fire this command. But it does not.

I do not find any documentation on the usage of JBoss Management Builder plugin for Jenkins in the internet.

As I use Gradle to build the WAR file, I tried to restart the server using Gradle. But I could not do.

Please guide me on how to start/shutdown the server either using Jenkins or Gradle.

Console Output:

Building in workspace C:\Program Files (x86)\Jenkins\workspace\Restart jBoss Server 
START: Checking if server is already running (max 20 seconds)...
START: Going to trigger start server...
[bin] $ cmd.exe /C '"D:\jboss-as-7.1.1.Final/bin/run.bat -c "JBoss-server" -b 127.0.0.1 && exit %%ERRORLEVEL%%"' "-Dstandalone=-b 10.225.72.104"
Finished: SUCCESS

Upvotes: 0

Views: 2105

Answers (1)

newohybat
newohybat

Reputation: 186

It seems that the plugin is not maintained anymore. If you want to startup the server, you can use 'Execute script' step and directly call the standalone.bat without any plugin.

If you want to reload/restart/shutdown your running server you can use the jboss-cli tool to manage the running server.

There is lot on the topic in AS7.1 documentation

Basically your scenario would require running:

  • $JBOSS_HOME/bin/jboss-cli.sh --connect --command="reload"

or

  • to restart
    • $JBOSS_HOME/bin/jboss-cli.sh --connect --command="shutdown(restart=true)"
  • to shutdown
    • $JBOSS_HOME/bin/jboss-cli.sh --connect --command="shutdown()"

Use jboss-cli.bat on Windows in similar manner.

Upvotes: 1

Related Questions