views:

413

answers:

3

Im trying to get Solr up and running, at first I had the JDK.1.6 working fine, then tomcat running fine too. All of a sudden when trying to run Solr for the first time however I get the error message:

[root@78 bin]# ./java -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

Ive deleted Tomcat, deleted the JDK and reinstalled the latest JRE but still get the error message even when trying to get the version number of Java.

top - 18:47:15 up 207 days, 13:50,  1 user,  load average: 0.08, 0.03, 0.00
Tasks:  42 total,   1 running,  41 sleeping,   0 stopped,   0 zombie
Cpu(s):  5.0%us,  0.2%sy,  0.0%ni, 94.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    786432k total,   376656k used,   409776k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

The setup Ive got is: Dual CPU Dual Core AMD Opteron 512MB RAM 40GB HDD

Im almost new to UNIX and so any help or advice would be really helpful, thanks guys

EDIT RUNNING PROCESSES ARE:

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
    1 root      18   0 10332  636  600 S    0  0.1   0:08.28 init
 1752 psaadm    15   0  176m  29m  17m S    0  3.9   0:03.76 httpsd
 1785 psaadm    15   0  173m  24m  14m S    0  3.1   0:02.03 httpsd
 5308 psaadm    15   0  174m  32m  21m S    0  4.2   0:02.70 httpsd
 6107 apache    25   0  347m  47m 5616 S    0  6.2   1:48.26 httpd
11493 root      15  -4 12588  320  316 S    0  0.0   0:00.00 udevd
12105 root      15   0 60592 1224  676 S    0  0.2   0:00.00 sshd
13659 apache    15   0  345m  46m 4784 S    0  6.1   0:57.14 httpd
15855 root      15   0 21628  768  672 S    0  0.1   0:13.75 xinetd
15986 root      15   0 40848  592  536 S    0  0.1   0:00.38 couriertcpd
16086 root      18   0 33540 1184 1120 S    0  0.2   0:00.28 courierlogger
16117 root      21   0 40848  536  532 S    0  0.1   0:00.00 couriertcpd
16119 root      21   0 33544 1072 1068 S    0  0.1   0:00.00 courierlogger
16135 root      15   0 40848  592  536 S    0  0.1   0:03.09 couriertcpd
16137 root      18   0 33540 1184 1120 S    0  0.2   0:01.70 courierlogger
16154 root      18   0 40852  536  532 S    0  0.1   0:00.00 couriertcpd
16157 root      18   0 33540 1124 1120 S    0  0.1   0:00.00 courierlogger
16287 qmails    18   0  3832  512  428 S    0  0.1   2:03.49 qmail-send
16289 qmaill    18   0  3780  508  444 S    0  0.1   0:36.67 splogger
16290 root      18   0  3816  408  324 S    0  0.1   0:00.09 qmail-lspawn
16291 qmailr    17   0  3820  404  328 S    0  0.1   0:16.95 qmail-rspawn
16292 qmailq    18   0  3772  368  324 S    0  0.0   0:15.61 qmail-clean
17669 root      18   0 12592 1180  908 R    0  0.2   0:00.03 top
18190 root      15   0  318m  25m 9000 S    0  3.3   0:36.21 httpd
19687 apache    16   0  347m  47m 5764 S    0  6.2   1:10.59 httpd
19710 named     25   0  180m 2572 1744 S    0  0.3   0:03.06 named
19809 root      18   0 11908 1152 1148 S    0  0.1   0:00.01 mysqld_safe
20166 apache    15   0  347m  47m 5696 S    0  6.2   1:07.68 httpd
20340 mysql     15   0  303m  35m 5620 S    0  4.7 185:56.38 mysqld
23747 apache    15   0  412m  46m 5768 S    0  6.0   0:38.23 httpd
23791 root      15   0  166m 7504 4216 S    0  1.0   0:02.39 httpsd
23901 root      15   0 20836  616  548 S    0  0.1   3:37.38 crond
23926 root      18   0 46648  416  412 S    0  0.1   0:00.00 saslauthd
24084 root      18   0 46648  160  156 S    0  0.0   0:00.00 saslauthd
24297 root      15   0 96636 4032 3112 S    0  0.5   0:00.20 sshd
24302 root      18   0 12180 1804 1308 S    0  0.2   0:00.17 bash
24431 root      18   0  152m 1112  664 S    0  0.1   0:25.77 rsyslogd
24435 root      18   0  3784  336  332 S    0  0.0   0:00.00 rklogd
24537 apache    15   0  344m  45m 4364 S    0  5.9   0:35.93 httpd

Its a shared server by the way.

Free -m gives me:

             total       used       free     shared    buffers     cached
Mem:           768        367        400          0          0          0
-/+ buffers/cache:        367        400
Swap:            0          0          0
A: 

The JVM will require a certain amount of memory on start up (configured via -Xms - default is 32m, I believe). If it can't get it, it won't start.

So what else is running on your macine ? I suspect you have very little free virtual memory on your machine.

Brian Agnew
how can I find out so I can tell you?
bluedaniel
You can run 'top' and order by memory usage. Can't remember how that'll work, but 'man top' should help. And/or 'ps -fe' to get a process list with memory consumption
Brian Agnew
Up to Java 5, the default -Xms value for Sun's JVM was 2MB. For Java 6, the default value is chosen at runtime based on system configuration.
Eli Acherkan
A: 

Do you have $JAVA_OPTIONS set?

echo $JAVA_OPTIONS

Doest the following command runs without error?

java -Xmx8m -version
Pascal Thivent
java options aint set no, Ill set it now but the java -Xmx8m -version command doesnt run
bluedaniel
Don't set JAVA_OPTIONS, I just wanted to know if you had some parameters set by default. And if you can't start a JVM with 8m, then you really have a problem, but I don't know what is happening.
Pascal Thivent
A: 

Just a simple reboot was needed, cant for the life of me understand what happened or why.

bluedaniel
Sometimes that is just the solution.. Java Gremlins! One thing I didn't exactly see answered was the advice of setting xms and xmx settings on startup.. If I have a dedicated server I normally set those so I know my app is getting all the memory on startup.
Eric Pugh
In future, run SOLR with some additional memory dedicated to it. 32M is far to small amount of memory. I run my with atleast 1024. Try with 256 Mb.
Yurish