环境:OS X10.10.5, idea 14.1.4, glassfish 4.1
报错:
/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 -classpath "/opt/GlassFish/glassfish/modules/javax.ejb-api.jar..........................." com.intellij.javaee.oss.process.JavaeeProcess 51864 com.intellij.javaee.oss.glassfish.agent.Glassfish31Agent
/opt/GlassFish/glassfish/bin/asadmin start-domain 0xcb
Detected server admin port: 4848
[2015-09-09 01:07:06,816] Artifact WebAppSample:war exploded: Server is not connected. Deploy is not available.
Detected server http port: 8080
Command start-domain failed.
JVM failed to start: com.sun.enterprise.admin.launcher.GFLauncherException: The server exited prematurely with exit code 1.
Before it died, it produced the following output:
This subcommand requires root privileges: bsexec
解决方法:
Run->Edit Configuaretions: 在配置项里面,Startup/Connections一栏中,不使用默认的命令,修改为以下即可:
/usr/bin/sudo -A /opt/GlassFish/glassfish/bin/asadmin start-domain 0xcb
/usr/bin/sudo -A /opt/GlassFish/glassfish/bin/asadmin stop-domain 0xcb
测试还要再开一下终端,在终端中输入sudo su先输入密码验证一下,才可以正常运行GlassFish