You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Steve Higham <st...@sjlt.co.uk> on 2012/06/07 19:09:31 UTC

Has anyone managed to get Geronimo 3 to run as a service / daemon on a mac?

Any help appreciated - steve

 

Steve Higham

 


Re: Has anyone managed to get Geronimo 3 to run as a service / daemon on a mac?

Posted by Jarek Gawor <jg...@gmail.com>.
Try adding -Djline.terminal=jline.UnsupportedTerminal to JAVA_OPTS and
see if that helps.

Jarek

On Fri, Jun 8, 2012 at 7:21 AM, Steve Higham <st...@sjlt.co.uk> wrote:
> Hi Daniel,
>
> Thanks for the pointer. I've spent the last couple of days working from this
> document but I can't get it working.
>
> My plist file is below
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
> "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
>
> <plist version="1.0">
> <dict>
>
>  <key>Label</key>
>  <string>GeronimoProduction</string>
>
>  <key>UserName</key>
>  <string>ci-user</string>
>
>  <key>Program</key>
>  <string>/bin/bash</string>
>
>  <key>ProgramArguments</key>
>  <array>
>    <string>/bin/bash</string>
>    <string>/Users/ci-user/GeronimoStart</string>
>    <string>/usr/local/geronimo-3-production</string>
>  </array>
>
>  <key>RunAtLoad</key>
>  <true />
>
>  <key>LaunchOnlyOnce</key>
>  <true />
>
>  <key>StandardOutPath</key>
>  <string>/var/log/geronimo-3-production.log</string>
>
>  <key>StandardErrorPath</key>
>  <string>/var/log/geronimo-3-production.log</string>
>
>  <key>Debug</key>
>  <true />
>
> </dict>
> </plist>
>
> Please ignore references to "production". I'm not going to production on G3.
> I'm just experimenting with Continuous Deployment techniques.
>
> I've used the UserName key as the launchd default is root and I don't want
> Geronimo running under root.
>
> I'm using /bin/bash as my executable and passing the startup script as a
> parameter. Launchd tries to execute its target directly. It can't handle a
> script.
>
> I use my own start-up script to set up the execution environment. Launchd
> has su'd to the user so the environment has not been set up. My script is
> below
>
> # This script is called by the Geronimo Service as ci-user
> # This enables the Geronimo environment to be correctly configured.
>
> # echo
> # echo GeronimoStart called
> # echo
>
> export GERONIMO_HOME=$1
> # echo GERONIM_HOME $GERONIMO_HOME
> # echo
>
> export JRE_HOME=/System/Library/Frameworks/JavaVM.framework/Home
> export JAVA_OPTS='-Djava.awt.headless=true -Xmx512m -XX:PermSize=64m
> -XX:MaxPermSize=256m'
> export GERONIMO_TMPDIR=/Volumes/Temp/Temp
> export GROOVY_HOME=/usr/local/groovy
> export M2_HOME=/usr/share/maven
> export HUDSON_HOME=/Users/ci-user/Hudson/home
>
> echo Environment
> echo ===========
> env
>
> cd $GERONIMO_HOME
> bin/geronimo start
>
> echo Done
>
> When I load the plist file (from Launchctl) the script is run. I get output
> (from /var/log/Geronimo-3-production.log) showing the PID number Geronimo is
> running under. However the process terminates immediately and there is no
> output in the Geronimo logs.
>
> I have also tried using "Geronimo run" instead of "Geronimo start". This
> shows Geronimo throwing the following exception during startup
>
> java.lang.IllegalStateException: GBean is not running:
> org.apache.geronimo.framework/j2ee-system/3.0-beta-1/car?ServiceModule=org.a
> pache.geronimo.framework/j2ee-system/3.0-beta-1/car,j2eeType=ConfigurationMa
> nager,name=ConfigurationManager
>        at
> org.apache.geronimo.kernel.basic.BasicKernel.getGBean(BasicKernel.java:295)
>        at
> org.apache.geronimo.kernel.basic.BasicKernel.getGBean(BasicKernel.java:288)
>        at
> org.apache.geronimo.kernel.config.ConfigurationUtil.getConfigurationManager(
> ConfigurationUtil.java:337)
>        at
> org.apache.geronimo.system.main.EmbeddedDaemon.doStartup(EmbeddedDaemon.java
> :200)
>        at
> org.apache.geronimo.system.main.EmbeddedDaemon.execute(EmbeddedDaemon.java:9
> 3)
>        at
> org.apache.geronimo.system.osgi.BootActivator$1.execute(BootActivator.java:1
> 07)
>        at
> org.apache.geronimo.main.Bootstrapper.execute(Bootstrapper.java:65)
>        at
> org.apache.geronimo.cli.AbstractCLI.executeMain(AbstractCLI.java:65)
>        at org.apache.geronimo.cli.daemon.DaemonCLI.main(DaemonCLI.java:32)
>
> If I telnet onto the server as ci-user and run my startup script directly
> everything works fine (run or start).
>
> Any comments welcome.
>
> Cheers,
>
> Steve
>
> -----Original Message-----
> From: dsh [mailto:daniel.haischt@googlemail.com]
> Sent: 07 June 2012 20:42
> To: user@geronimo.apache.org
> Subject: Re: Has anyone managed to get Geronimo 3 to run as a service /
> daemon on a mac?
>
> Hi,
>
> on Mac OS X you are supposed to use launchd scripts to have a program
> started as a background daemon while the OS is starting. The following
> resource might help you the get an initial idea about the process of setting
> up such a script:
>
> http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPSy
> stemStartup/Chapters/CreatingLaunchdJobs.html
>
> Cheers
> Daniel
>
> On Thu, Jun 7, 2012 at 7:09 PM, Steve Higham <st...@sjlt.co.uk> wrote:
>> Any help appreciated - steve
>>
>>
>>
>> Steve Higham
>>
>>
>

RE: Has anyone managed to get Geronimo 3 to run as a service / daemon on a mac?

Posted by Steve Higham <st...@sjlt.co.uk>.
Hi Daniel,

Thanks for the pointer. I've spent the last couple of days working from this
document but I can't get it working.

My plist file is below

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">
<dict>

  <key>Label</key>
  <string>GeronimoProduction</string>

  <key>UserName</key>
  <string>ci-user</string>

  <key>Program</key>
  <string>/bin/bash</string>
  
  <key>ProgramArguments</key>
  <array>
    <string>/bin/bash</string>
    <string>/Users/ci-user/GeronimoStart</string>
    <string>/usr/local/geronimo-3-production</string>
  </array>

  <key>RunAtLoad</key>
  <true />

  <key>LaunchOnlyOnce</key>
  <true />

  <key>StandardOutPath</key>
  <string>/var/log/geronimo-3-production.log</string>

  <key>StandardErrorPath</key>
  <string>/var/log/geronimo-3-production.log</string>

  <key>Debug</key>
  <true />

</dict>
</plist>

Please ignore references to "production". I'm not going to production on G3.
I'm just experimenting with Continuous Deployment techniques.

I've used the UserName key as the launchd default is root and I don't want
Geronimo running under root.

I'm using /bin/bash as my executable and passing the startup script as a
parameter. Launchd tries to execute its target directly. It can't handle a
script.

I use my own start-up script to set up the execution environment. Launchd
has su'd to the user so the environment has not been set up. My script is
below

# This script is called by the Geronimo Service as ci-user
# This enables the Geronimo environment to be correctly configured.

# echo
# echo GeronimoStart called
# echo

export GERONIMO_HOME=$1
# echo GERONIM_HOME $GERONIMO_HOME
# echo

export JRE_HOME=/System/Library/Frameworks/JavaVM.framework/Home
export JAVA_OPTS='-Djava.awt.headless=true -Xmx512m -XX:PermSize=64m
-XX:MaxPermSize=256m'
export GERONIMO_TMPDIR=/Volumes/Temp/Temp
export GROOVY_HOME=/usr/local/groovy
export M2_HOME=/usr/share/maven
export HUDSON_HOME=/Users/ci-user/Hudson/home

echo Environment
echo ===========
env

cd $GERONIMO_HOME
bin/geronimo start

echo Done

When I load the plist file (from Launchctl) the script is run. I get output
(from /var/log/Geronimo-3-production.log) showing the PID number Geronimo is
running under. However the process terminates immediately and there is no
output in the Geronimo logs.

I have also tried using "Geronimo run" instead of "Geronimo start". This
shows Geronimo throwing the following exception during startup

java.lang.IllegalStateException: GBean is not running:
org.apache.geronimo.framework/j2ee-system/3.0-beta-1/car?ServiceModule=org.a
pache.geronimo.framework/j2ee-system/3.0-beta-1/car,j2eeType=ConfigurationMa
nager,name=ConfigurationManager
	at
org.apache.geronimo.kernel.basic.BasicKernel.getGBean(BasicKernel.java:295)
	at
org.apache.geronimo.kernel.basic.BasicKernel.getGBean(BasicKernel.java:288)
	at
org.apache.geronimo.kernel.config.ConfigurationUtil.getConfigurationManager(
ConfigurationUtil.java:337)
	at
org.apache.geronimo.system.main.EmbeddedDaemon.doStartup(EmbeddedDaemon.java
:200)
	at
org.apache.geronimo.system.main.EmbeddedDaemon.execute(EmbeddedDaemon.java:9
3)
	at
org.apache.geronimo.system.osgi.BootActivator$1.execute(BootActivator.java:1
07)
	at
org.apache.geronimo.main.Bootstrapper.execute(Bootstrapper.java:65)
	at
org.apache.geronimo.cli.AbstractCLI.executeMain(AbstractCLI.java:65)
	at org.apache.geronimo.cli.daemon.DaemonCLI.main(DaemonCLI.java:32)

If I telnet onto the server as ci-user and run my startup script directly
everything works fine (run or start).

Any comments welcome.

Cheers,

Steve

-----Original Message-----
From: dsh [mailto:daniel.haischt@googlemail.com] 
Sent: 07 June 2012 20:42
To: user@geronimo.apache.org
Subject: Re: Has anyone managed to get Geronimo 3 to run as a service /
daemon on a mac?

Hi,

on Mac OS X you are supposed to use launchd scripts to have a program
started as a background daemon while the OS is starting. The following
resource might help you the get an initial idea about the process of setting
up such a script:

http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPSy
stemStartup/Chapters/CreatingLaunchdJobs.html

Cheers
Daniel

On Thu, Jun 7, 2012 at 7:09 PM, Steve Higham <st...@sjlt.co.uk> wrote:
> Any help appreciated - steve
>
>
>
> Steve Higham
>
>


Re: Has anyone managed to get Geronimo 3 to run as a service / daemon on a mac?

Posted by dsh <da...@googlemail.com>.
Hi,

on Mac OS X you are supposed to use launchd scripts to have a program
started as a background daemon while the OS is starting. The following
resource might help you the get an initial idea about the process of
setting up such a script:

http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html

Cheers
Daniel

On Thu, Jun 7, 2012 at 7:09 PM, Steve Higham <st...@sjlt.co.uk> wrote:
> Any help appreciated - steve
>
>
>
> Steve Higham
>
>