0

I need to deploy a WAR file in JBOSS using CLI and want to send a JVM command line parameter that is used in the application. The CLI command for the deployment is:

deploy --name=xxx-api.war --server-groups=server-group1 /war/locn/xxx-api-$rel_name.war

I need to pass the below a java command line parameter:
-Dspring.profiles.active=enableScheduler

How can it be done?

Arun
  • 3,701
  • 5
  • 32
  • 43

2 Answers2

1

you can't set system property with jboss-cli deploy command. When you running jboss-cli JVM has already started. You should set properties in $JBOSS_HOME/bin/standalone.conf (or domain.conf). Or you could run java code to set system properties. You could define a servlet that loads on startup and set system property in servlet init method.

@WebServlet(name = "Prop", urlPatterns = {"/Prop"}, loadOnStartup = 1)
public class SetProperies extends HttpServlet {

@Override
public void init() throws ServletException {
    System.setProperty("spring.profiles.active", "enableScheduler");
}
serdroid
  • 166
  • 2
  • 7
1

Have you tried this?

/server-group=server-group1/system-property=spring.profiles.active:add(boot-time=false, value="enableScheduler")
n1cr4m
  • 221
  • 2
  • 7
  • what does `boot-time` do? what is the consequence if setting it true? – Arun Jan 03 '18 at 15:04
  • The boot-time attribute is used in domain mode to have the host controller spawn new EAP instances with system properties on the JVM invocation that the boot-time attribute set to true. It has no downside in domain mode. – Abhijit Humbe Jan 06 '18 at 10:40