Glassfish 4.1 with Ansible and Vagrant: Domain doesn’t start from play

ansibleglassfishvagrant

I'm setting up a vagrant machine with Glassfish 4.1 using Ansible. I tried to use asadmin to start the domain, etc. According to the logs, there is no error but Glassfish doesn't starts.

changed: [vagrant] => {"changed": true, "cmd": "/opt/glassfish4/glassfish/bin/asadmin --user admin --passwordfile /opt/glassfish4/glassfish/bin/fich-password.txt start-domain", "delta": "0:00:12.558981", "end": "2015-09-12 09:30:48.805112", "rc": 0, "start": "2015-09-12 09:30:36.246131", "stderr": "", "stdout": "Waiting for domain1 to start ...........\nSuccessfully started the domain : domain1\ndomain  Location: /opt/glassfish4/glassfish/domains/domain1\nLog File: /opt/glassfish4/glassfish/domains/domain1/logs/server.log\nAdmin Port: 4848\nCommand start-domain executed successfully.", "warnings": []}

I have been looking in Glassfish logs and there isn't any errors neither

When i try to run the script from the terminal it works ok, in fact, i set cron to start the domain on reboot and once i rebooted everything it's fine, even the enable-secure-admin command that i set in the script .

I have created a custom user and group for glassfish and setted the permissions of opt/glassfish4/

I've been struggling with this problem for 3 days. Any guidance you can provide it's welcome.

UPDATE: I used top command and apparently while the script is running, up to 3 instances of java starts. As far as i know that's not right, so it's not a surprise that glassfish got killed as fvu and alfredocambera said.

I don't know why that is happening,

Ansible Task

command: /opt/glassfish4/glassfish/bin/asadmin multimode --file /opt/glassfish4/glassfish/bin/glassfish-multimode.txt

glassfish-multimode.txt

start-domain

change-admin-password --user admin --interactive=false --passwordfile /opt/glassfish4/glassfish/bin/fich-password.txt

create-password-alias --interactive=false --user admin --passwordfile /opt/glassfish4/glassfish/bin/fich-password2.txt aliaspwadmin

enable-secure-admin --interactive=false --user admin --passwordfile /opt/glassfish4/glassfish/bin/fich-password2.txt

restart-domain

Thank you for your help

Best Answer

I had a similar problem with Jenkins while doing some test on a vm with Ubuntu 14.04. The problem was that I had assigned too little RAM (256Mb) and Jenkins was starting but the kernel would kill the process a few seconds later. Try running:

dmesg

You can also check memory configuration (-Xms and -Xmx) on:

$GLASSFISH_HOME/config/asenv.conf