Skip to main content

The java server application is killed automatically

2 replies [Last post]
phuongngoc
Offline
Joined: 2012-06-24
Points: 0

Hi all,

I have created a java application to run as a socket server. When I run it on my Windows PC, it works OK.
When I put it on the VPS (CentOS) and run in background:

nohup java -jar mychatserver.jar >> chatlog.txt &

Then I check the process by command "jobs -l", the status is "Running"
But, it's automatically killed after 2 - 10 minutes. The status when I call "jobs -l" is:

[1]+ 8835 Exit 143                nohup java -jar mychatserver.jar >> chatlog.txt &

So my server is died
I don't know what happens with my application and why the application is killed?
Can you please advice to resolve my issue?

Thank you.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kirild
Offline
Joined: 2011-02-17
Points: 0

What happens if you don't run it in the background? Same result? If so, could you post any error messages or stack traces.

If it appears to work when it's run in the foreground, try redirecting stderr as well as stdout:

nohup java -jar mychatserver.jar 2>&1 >> chatlog.txt &

phuongngoc
Offline
Joined: 2012-06-24
Points: 0

When it runs in the foreground, it stops without any exception or message...

My server is installed CentOS 5.4 and this is some information about the memory

top - 22:48:30 up  3:16,  1 user,  load average: 0.00, 0.00, 0.00
Tasks:  29 total,   1 running,  28 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1048576k total,   318472k used,   730104k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

The memory is too small to run my service, isn't it?