为了实现某种自动化,我正在寻找一种通过java代码完全启动hybris服务器的方法。
到目前为止,我尝试过的是使用这些命令的启动
1)
de.hybris.platform.core.Registry.setCurrentTenantByID("master");
de.hybris.platform.core.Registry.activateMasterTenant();
2)
de.hybris.platform.core.Registry.startup()
这两种方式都实现了hybris服务器的启动,但是我需要访问localhost:9002或localhost:9001,但是当我这样启动服务器时它们不可用。这些端口上没有任何东西:/
考虑从Java程序执行以下Hybris服务器Shell脚本:
Mac OS
Process process = Runtime.getRuntime().exec("./hybrisserver.sh", null, new File("<PATH_TO_PLATFORM>"));
process.waitFor();
我刚刚在Mac OS上对其进行了测试,并成功启动了Hybris,可以通过浏览器访问它。祝你好运!
FOR WINDOWS(尚未测试)
Process process = Runtime.getRuntime().exec("cmd /c hybrisserver.bat, null, new File("<PATH_TO_PLATFORM>"));
process.waitFor();