problem with running java on Linux 2.6.9-023stab043.1-enterprise

Rick Stevens rstevens at internap.com
Fri May 18 18:13:54 UTC 2007


On Thu, 2007-05-17 at 09:12 +0530, Alok Padey wrote:
> Hi Rick 
> Thanks for ur time . I have paste the o/p of top command below , have
> a look . hope it will help u in providing any solution.:
> 
> thx
> 
> top - 20:37:18 up 11 days,  7:51,  1 user,  load average: 0.00, 0.00,
> 0.00
> Tasks:  56 total,   1 running,  55 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
> Mem:    689496k total,   302016k used,   387480k free,        0k
> buffers
> Swap:        0k total,        0k used,        0k free,        0k
> cached

It's pretty obvious you don't have a swap partition as shown in the
"Swap:" line above.  The odds are quite good that's the problem.  Java
VM sucks up a pretty good chunk of memory so it's quite likely you're
running out of RAM.

Try configuring and using a swap file.  It's not quite as efficient as
a swap partition, but it'll do.  If you're unfamiliar with how to set up
a swap file, here's some instructions.  All commands must be run as the
root user:

1. First, find a filesystem that has 1GB of free space that you don't
mind being used by the swap file.  Figure out which directory on that
filesystem you want the swap file to go into.

2. Create the swap file:

	dd if=/dev/zero of=/path/to/swap/file bs=1K count=1M

If you want a smaller swap file, change the "count=" value to what you
want.  The command above will create a 1G swap file.  "count=512K" will
create a 512MB swap file.

3. Activate the swap file:

	swapon /path/to/swap/file

4. Verify the swap file is active.  The following examples will show
commands and expected results.  Your results will have different numbers
as these are from one of my machines which uses a separate 2GB swap
partition (/dev/hda6):

EXAMPLE 1:
[root at prophead ~]# swapon -s
Filename                       Type            Size    Used    Priority
/dev/hda6                      partition       2096440 40180   -1
(Your machine will have "/path/to/swap/file" instead of "/dev/hda6" and
will probably say "file" under the "Type" column).

EXAMPLE 2:
[root at prophead IBRIX-UK]# free
             total       used       free     shared    buffers
cached
Mem:       1024808     958992      65816          0      79988
283624
-/+ buffers/cache:     595380     429428
Swap:      2096440      40180    2056260
(Note the numbers after the "Swap:" label)

EXAMPLE 3:
top - 11:06:33 up 18 days, 38 min, 11 users,  load average: 0.39, 0.43,
0.45
Tasks: 174 total,   4 running, 167 sleeping,   0 stopped,   3 zombie
Cpu(s): 15.6%us,  2.0%sy,  0.0%ni, 76.7%id,  0.0%wa,  5.6%hi,  0.0%si,
0.0%st
Mem:   1024808k total,   959112k used,    65696k free,    80032k buffers
Swap:  2096440k total,    40180k used,  2056260k free,   283744k cached
(Again, note the numbers after the "Swap:" label)

5. Make your new swap file permanent and startable on boot.  Edit your
/etc/fstab file and add the following line to it:

/path/to/swap/file    swap              swap    defaults        0 0

This will cause your system to activate the swap file when you reboot
next time.

Do that stuff and try running Java again.  I'll bet it starts up.

> On 5/15/07, Rick Stevens <rstevens at internap.com> wrote:
>         On Tue, 2007-05-15 at 18:41 +0530, Alok Padey wrote:
>         > hi gurus
>         >
>         > I am facing problem while running java on linux(Linux
>         > 2.6.9-023stab043.1-enterprise)
>         > after installation i executed the command : 
>         > java -version ,got error as :
>         >
>         > "Error occurred during initialization of VM
>         > Could not reserve enough space for code cache"
>         >
>         > I have also tried
>         > jdk1.5.0_06/bin/java -Xmx512M
>         >
>         > but no luck
>         >
>         > Have any one experienced this problem before.
>         > Any idea is welcome.
>         > plz show me light were to search
>         >
>         > The deatils are as:
>         > java : jdk1.5
>         > linux: 2.6.9-023stab043.1-enterprise
>         > RAM: 700 MB(approx) 40% in use 60% free.
>         >
>         > [root at as private]# ulimit -a
>         > core file size (blocks, -c) 0
>         > data seg size (kbytes, -d) unlimited 
>         > file size (blocks, -f) unlimited
>         > pending signals (-i) 1024
>         > max locked memory (kbytes, -l) 32
>         > max memory size (kbytes, -m) unlimited
>         > open files (-n) 1024
>         > pipe size (512 bytes, -p) 8 
>         > POSIX message queues (bytes, -q) 819200
>         > stack size (kbytes, -s) 10240
>         > cpu time (seconds, -t) unlimited
>         > max user processes (-u) 71679
>         > virtual memory (kbytes, -v) unlimited
>         > file locks (-x) unlimited 
>         
>         Hmmm.  That's odd.  Does "free" show any free memory?
>         
>         You did set up a swap partition, right?  Is it being
>         used?  "swapon -s"
>         will show you.  If you're running a GUI, 700MB may be a bit
>         tight and 
>         if you don't have swap, you could be running out of RAM.  Java
>         does
>         suck up a lot of RAM at times.
>         
>         ----------------------------------------------------------------------
>         - Rick Stevens, Principal Engineer
>         rstevens at internap.com -
>         - VitalStream, Inc.
>         http://www.vitalstream.com -
>         -                                                                    -
>         -          su -; find / -name someone -exec touch \{\}
>         \;            -
>         -                          - The UNIX way of touching
>         someone        -
>         ----------------------------------------------------------------------
>         
>         _______________________________________________
>         Redhat-install-list mailing list
>         Redhat-install-list at redhat.com
>         https://www.redhat.com/mailman/listinfo/redhat-install-list
>         To Unsubscribe Go To ABOVE URL or send a message to: 
>         redhat-install-list-request at redhat.com
>         Subject: unsubscribe
> 
> 
> -- 
> THANKS
> ALOK PANDEY 
> _______________________________________________
> Redhat-install-list mailing list
> Redhat-install-list at redhat.com
> https://www.redhat.com/mailman/listinfo/redhat-install-list
> To Unsubscribe Go To ABOVE URL or send a message to:
> redhat-install-list-request at redhat.com
> Subject: unsubscribe
----------------------------------------------------------------------
- Rick Stevens, Principal Engineer             rstevens at internap.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-  Jimmie crack corn and I don't care...what kind of lousy attitude  -
-                 is THAT to have, huh?   -- Dennis Miller           -
----------------------------------------------------------------------




More information about the Redhat-install-list mailing list