How can I start Glassfish server from Eclipse on OS X 10.10.3?

I was developing a website using Java EE in Eclipse and tested it locally with Glassfish, but after upgrading to OS X 10.10.3, the server started to timeout during startup. When trying to start from terminal Glassfish failed to start, but when used with sudo

it started successfully. After inspecting the website, I found that as of 10.10.3 Glassfish needs root privileges to run. Is there a way I can get Eclipse to start the server with root privileges, or work around the problem in another way?

EDIT: This is the log after using the first variant of Siddharth (the second when using Eclipse makes no difference):

2015-05-16T16:30:39.877+1000|Info: Running GlassFish Version: GlassFish Server Open Source Edition  4.1  (build 13)
2015-05-16T16:30:39.879+1000|Info: Server log file is using Formatter class: com.sun.enterprise.server.logging.ODLLogFormatter
2015-05-16T16:30:39.980+1000|Info: Realm [admin-realm] of classtype [] successfully created.
2015-05-16T16:30:39.981+1000|Info: Realm [file] of classtype [] successfully created.
2015-05-16T16:30:39.984+1000|Info: Realm [certificate] of classtype [] successfully created.
2015-05-16T16:30:40.104+1000|Info: Authorization Service has successfully initialized.
2015-05-16T16:30:40.130+1000|Info: Registered for persistence-type = replicated in BackingStoreFactoryRegistry
2015-05-16T16:30:40.375+1000|Info: Grizzly Framework 2.3.15 started in: 25ms - bound to [/]
2015-05-16T16:30:40.391+1000|Info: Grizzly Framework 2.3.15 started in: 1ms - bound to [/]
2015-05-16T16:30:40.397+1000|Info: Grizzly Framework 2.3.15 started in: 1ms - bound to [/]
2015-05-16T16:30:40.427+1000|Info: Grizzly Framework 2.3.15 started in: 0ms - bound to [/]
2015-05-16T16:30:40.428+1000|Info: GlassFish Server Open Source Edition  4.1  (13) startup time : Felix (1,426ms), startup services(619ms), total(2,045ms)
2015-05-16T16:30:40.602+1000|Info: JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://olivers-imac.gateway:8686/jndi/rmi://olivers-imac.gateway:8686/jmxrmi


Sometimes he achieves this.

2015-05-16T16:30:40.602+1000|Info: Grizzly Framework 2.3.15 started in: 0ms - bound to [/]
2015-05-16T16:30:40.670+1000|Info: Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl@ae372b9 as OSGi service registration: org.apache.felix.framework.ServiceRegistrationImpl@67403656.


Sometimes he achieves this.

2015-05-16T16:30:40.904+1000|Info: visiting unvisited references
2015-05-16T16:30:41.444+1000|Info: Created HTTP listener http-listener-1 on host/port
2015-05-16T16:30:41.450+1000|Info: Created HTTP listener http-listener-2 on host/port
2015-05-16T16:30:41.453+1000|Info: Created HTTP listener admin-listener on host/port
2015-05-16T16:30:41.471+1000|Info: Created virtual server server
2015-05-16T16:30:41.473+1000|Info: Created virtual server __asadmin
2015-05-16T16:30:41.638+1000|Info: Setting JAAS app name glassfish-web
2015-05-16T16:30:41.639+1000|Info: Virtual server server loaded default web module 
2015-05-16T16:30:41.927+1000|Info: Java security manager is disabled.
2015-05-16T16:30:41.928+1000|Info: Entering Security Startup Service.
2015-05-16T16:30:41.930+1000|Info: Loading policy provider
2015-05-16T16:30:41.969+1000|Info: Security Service(s) started successfully.
2015-05-16T16:30:42.155+1000|Info: visiting unvisited references
2015-05-16T16:30:42.170+1000|Info: visiting unvisited references
2015-05-16T16:30:42.172+1000|Info: visiting unvisited references
2015-05-16T16:30:43.060+1000|Info: Initializing Mojarra 2.2.7 ( 20140610-1547 for context ''
2015-05-16T16:30:43.655+1000|Info: HV000001: Hibernate Validator 5.0.0.Final
2015-05-16T16:30:43.965+1000|Info: Loading application [__admingui] at [/]
2015-05-16T16:30:43.966+1000|Info: Loading application __admingui done in 3,296 ms


EDIT: I answered Siddharth correctly as it helped me the most, however the issue was only fully resolved after the El Capitan update.


source to share

2 answers

This is a known issue and has now been fixed ( see this ). If you would like to continue with the current version of Glassfish, perhaps you can consider the solution posted here .

By specifying the same solution below: -

It turns out that the Glassfish team made the assumption that they could use startctl bsexec in their kernel / admin / launcher / src / home / java / com / sun / enterprise / admin / launcher / file.

This subcommand now requires root privileges.

Someone posted a patch to the trunk of Glassfish, but if you want to use Glassfish immediately, you can create this script somewhere like ~ / Bin / launchctl.

# A little hack to wrap launchctl in order to
# successfully start Glassfish on Yosemite 10.10.3+
if [[ ${1} == "bsexec" ]]; then
    nohup ${@:3}
    /bin/launchctl ${@}


Remember 'chmod 755 ~ / bin / launchctl for it to execute.

Also remember that your ~ / .profile or ~ / .bash_profile should have something like this:

export PATH="$HOME/bin:$PATH"


The idea here is that this script is a wrapper around launchctll. As a user in Yosemite 10.10.3, you cannot start bsexec, but you might want to use launchctll for other things.



I had the same problem with the eclipse luna Glassfish tools that I installed from the Eclipse MarketPlace under OSX 10.9.

I came across the post below on Stack Overflow and I think after the root access issue is resolved in 10.10, I believe the suggested solution there should work for your case as well as it did for me.

Don't forget to uninstall the Glassfish tools you installed earlier from the Marketplace!

Installing Glassfish tools in eclipse luna



All Articles