-1

I'm new in glassfish. I have a vps in digitalocean with Ram 512 mb. I just running 1 domain and 1 simple web service application. But glassfish stop without my command. Any suggest?

I using glassfish 4.1.1

Edit for Trevor. I forget to say about error log. I checked the error log. No log that say error or why the glassfish stop. It's running okay when i restart, but after few hours it happen again

Rainey
  • 119
  • 2
  • 10
  • 1
    What does the glassfish manual say? What shows in the error logs? What happened when you restart it? – Trevor Jan 09 '16 at 12:24
  • @Trevor hi. I checked the error log. No log that say error or why the glassfish stop. It's running okay when i restart, but after few hours it happen again – Rainey Jan 09 '16 at 13:07

1 Answers1

1

There is a good chance you are running out of memory.

By default, the server has -Xmx512m set, which means the heap size can increase to 512MB. Since that is all you have available on your DigitalOcean machine, it will start with a lower amount, and increase as you deploy your application to it. Once GlassFish tries to use more memory than your DigitalOcean machine can spare, it will die.

Decreasing this to something like -Xmx256m will probably give you more stability. For simple apps, you should be OK with that.

Note: you may want to also decrease the -XX:MaxPermSize=192m to -XX:MaxPermSize=128m. If you are on Java 8, then this doesn't matter any more and the value isn't used. For Java 7, decreasing this will help.

Either change this value through the admin console at http://[$HOSTNAME]:4848 and go to Configurations -> server-config -> JVM Settings, then click the JVM Options tab (you will need to change the value, then click save, then restart GlassFish).

Or change it in the domain.xml directly (being careful to get it right)

glassfish41/glassfish/domains/domain1/config/domain.xml

You will notice that that value is in that file twice. One is the actual server-config, used for the server itself, and the other is the "default-config" which is a template used for creating new configurations. Make sure you change the correct one! If you're unsure, just change both.

Mike
  • 4,852
  • 1
  • 29
  • 48