[jboss-as7-dev] start/stop as7 server?

denstar valliantster at gmail.com
Mon Apr 18 19:33:24 EDT 2011


On Mon, Apr 18, 2011 at 7:49 AM, Brian Stansberry wrote:
> You can't start a standalone AS process via the management API. The API
> will not support making native OS calls . You can't start a
> DomainController/HostController either. That has to be done via some
> external action.
>
> https://github.com/jbossas/jboss-as/blob/master/arquillian/container-managed/src/main/java/org/jboss/as/arquillian/container/managed/JBossAsManagedContainer.java
> is a class that launches a separate standalone AS instance from within a
> test client. So that's an example of how to do this. It uses
> java.lang.Process, so it's up to the parent process to manage the
> lifecycle of the child, consume its streams etc.

Wow.  That's a lot better than what I was going to toss out there:

import org.jboss.modules.Main;

String jbossDir = "./build/jboss7.0.0.Beta3-SNAPSHOT";
System.setProperty("java.net.preferIPv4Stack", "true");
System.setProperty("org.jboss.boot.log.file", jbossDir +
"/standalone/log/boot.log");
System.setProperty("logging.configuration",
"file:"+jbossDir+"/standalone/configuration/logging.properties");
System.setProperty("jboss.server.home.url", "file://"+jbossDir);
System.setProperty("jboss.home.dir", jbossDir);
String argline="-mp "+jbossDir+"/modules -logmodule
org.jboss.logmanager -jaxpmodule javax.xml.jaxp-provider
org.jboss.as.standalone -Djboss.home.dir="+jbossDir;
try {
	org.jboss.modules.Main.main(argline.split(" "));
} catch (Throwable e) {
	e.printStackTrace();
}

Thanks Brian!

:Den

-- 
The family is one of nature's masterpieces.
George Santayana



More information about the jboss-as7-dev mailing list