Openfire-JVM problems

Hi, I am a novice XMPP developer who try to install and configure an Openfire server in a Debian distribution. I have installed it following this process:

**$**wget http://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_3.6.2_a ll.deb --output-document=openfire_3.6.2_all.deb
–09:29:32-- http://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_3.6.2_a ll.deb
=> `openfire_3.6.2_all.deb’
Resolving www.igniterealtime.org… 63.246.20.125
Connecting to www.igniterealtime.org|63.246.20.125|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 11,641,798 (11M) [application/octet-stream]

100%[====================================>] 11,641,798 739.80K/s ETA 00:00

09:29:49 (659.55 KB/s) - `openfire_3.6.2_all.deb’ saved [11641798/11641798]

$dpkg -i openfire_3.6.2_all.deb

Selecting previously deselected package openfire.
(Reading database … 37494 files and directories currently installed.)
Unpacking openfire (from openfire_3.6.2_all.deb) …
Setting up openfire (3.6.2) …
Starting openfire: openfire.

However, it doesn’t work. I think that it is a problem related with JVM, because of this:

$ java -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
$ /etc/init.d/openfire stop
Stopping openfire: openfire.
$ java -version
java version "1.6.0_10"
Java™ SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot™ Client VM (build 11.0-b15, mixed mode)

I have found this document in the fourm, but I don’t found the bin/openfire document.These are the Openfire configuration files in the server:

$ apt-cache show openfire
Package: openfire
Status: install ok installed
Priority: optional
Section: net
Installed-Size: 14228
Maintainer: Jive Software webmaster@jivesoftware.com
Architecture: all
Version: 3.6.2
Pre-Depends: sun-java5-jre | sun-java6-jre
Conffiles:
/etc/openfire/openfire.xml 7007ba8be6e6f127372e8075f13c179f
/etc/openfire/security/keystore d3466713ffcfb3d44dfd82ff0c10c514
/etc/openfire/security/truststore 9b470f3455839329c1a5c60d9df5c89c
/etc/openfire/security/client.truststore d3466713ffcfb3d44dfd82ff0c10c514
/etc/default/openfire 52e97268baf45bade1f2ee6591365f1c
/etc/init.d/openfire 5426f46d360d76f9c93f6badb0ed2295
/etc/openfire/openfire.xml 7007ba8be6e6f127372e8075f13c179f
/etc/openfire/security/keystore d3466713ffcfb3d44dfd82ff0c10c514
/etc/openfire/security/client.truststore d3466713ffcfb3d44dfd82ff0c10c514
/etc/openfire/security/truststore 9b470f3455839329c1a5c60d9df5c89c
/etc/sysconfig/openfire c20ea0586669faf6c0eb2d9f551abedb obsolete
Description: A high performance XMPP (Jabber) server.
Openfire is an instant messaging server that implements the XMPP
(Jabber) protocol. It features high performance, a robust
administration console, and a full plugin system. The server
is 100% Java.

Openfire is a professional Open Source project, led by Jive Software.

I have checked that admininstration console ports are rigth in /etc/openfire/openfire.xml

9090 9091

and I have also changed some JVM parameters in /etc/sysconfig/openfire unsuccessfully.

If you wish to set any specific options to pass to the JVM, you can

set them with the following variable.

OPENFIRE_OPTS=" -Xmx1024m" <- Change Xmx, Xms and another parameters specified in this document.

Does anybody know what could be wrong?

Thanks in advance

A folder named"sysconfig" doesn’t exist in my debian etch install. But it seems that you try to run Openfire in virtualized environment (perhabs Virtuozzo or OpenVZ). I encountered the same problem on my virtual server (although I also had problems installing the JVM). My solution was to edit the /etc/init.d/openfire. There is variable named DAEMON_OPTS in which you can insert -Xmx??m to set the maximal heap size to ?? MB. That worked for me under Debian etch in Virtuozzo environment.

You are right, I am working in a strato virtual server. I have found DAEMON_OPTS variable in /etc/init.d/openfire file and I have tried to set -Xms and -Xmx to several values, but unluckily it didn’t work.

Thanks you anyway.

Strange for me this fix worked: How does your DAEMON_OPTS line looks? My first line of the DAEMON_OPTS variable looks like this:

DAEMON_OPTS="$DAEMON_OPTS -Xmx64m -server -DopenfireHome=${DAEMON_DIR} \

This way I let Openfire 64 MB for his heap. In total this makes about 100-120 MB of memory usage. May I ask how your virtual machine is configured and how much does ist cost? I considered to change my provider because I’m running very often in trouble with my numproc counter. I have a limit of 240 but Openfire seems to consume very much of the numproc ressource.

Firsts lines in my etc/init.d/openfire are:

/etc/init.d/openfire
#!/bin/sh

Written by Miquel van Smoorenburg miquels@cistron.nl.

Modified for Debian

by Ian Murdock imurdock@gnu.ai.mit.edu.

Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl

Attempt to locate JAVA_HOME, code borrowed from jabref package

if [ -z $JAVA_HOME ]
then
t=/usr/lib/jvm/java-1.5.0-sun && test -d $t && JAVA_HOME=$t
t=/usr/lib/jvm/java-6-sun && test -d $t && JAVA_HOME=$t
fi

PATH=/sbin:/bin:/usr/sbin:/usr/bin:${JAVA_HOME}/bin
JAVA=${JAVA_HOME}/bin/java
NAME=openfire
DESC=openfire
DAEMON_DIR=/usr/share/openfire
DAEMON_LIB=${DAEMON_DIR}/lib

test -x $JAVA || exit 0

Include openfire defaults if available

if [ -f /etc/default/openfire ] ; then
. /etc/default/openfire
fi

DAEMON_OPTS="$DAEMON_OPTS -Xmx64m -server -DopenfireHome=${DAEMON_DIR}
-Dopenfire.lib.dir=${DAEMON_LIB} -classpath ${DAEMON_LIB}/startup.jar
-jar ${DAEMON_LIB}/startup.jar"

So I am pretty sure that something is wrong somewhere else. I think that available memory is enough:

**$free -m result
**
total
used
free
shared
buffers
cached
Mem
2019
1992
26
0
211
862
-/+ buffers/cache
918
1100
Swap
2996
2
2993

And it seems to be the problem with JVM. Somebody has told me that there was an old version of openfire working in this machine some time ago. I have tried to reinstall some old versions, but the result is the same:

**$java -version
**
Error occurred during initialization of VM

Could not reserve enough space for object heap
Could not create the Java virtual machine.

Thanks again.

The problem in Virtuozzo environments ist that the command “free” does not deliver reliable results. I my case on a machine from keyweb ist shows me the total memory of the host machine although I only have 768 MB available in my vserver. That is also the reason why java has memory problems. It tries to allocate too much memory because it “sees” the whole memory of the host machine (at least thats my theory so far). If you run the command “java -Xmx32m -version” you should get a proper output.

Your DAEMON_OPT variable looks ok. Just like mine. You said that someone already run Openfire on that virtual machine. Didn’t set up everything yourself. Because already the installatiion of sun-java5-bin should be problemativ and should have gone wrong on a vserver. Another thing ist that 64 MB ist just the heap size you allow the JVM to allocate. But heap ist not the only memory. If you have only 128 MB total RAM for your vserver it is likely that your really have too few memory.

Hi,

you should have read http://www.igniterealtime.org/community/docs/DOC-1021 - VPS are not meant to run Java applications.

In any case you need to tune the JVM to use as little memory as possible which also means that your installation may support not more than 100 users. You could try it with parameters like:

-Xms16m -Xmx32m -Xss128k -XX:ThreadStackSize=128 -XX:PermSize=8m -XX:MaxPermSize=64m -XX:+PrintGCDetails -Xloggc:/tmp/gc.log -Djava.net.preferIPv4Stack=true -server

Monitor the GC log and adjust the Xmx and (decrease) MaxPermSize values as needed.

To start Openfire you need to chdir to the directory and enter “java -Xms16m -Xmx32m -Xss128k -XX:ThreadStackSize=128 -XX:PermSize=8m -XX:MaxPermSize=64m -XX:+PrintGCDetails -Xloggc:/tmp/gc.log -Djava.net.preferIPv4Stack=true -server -jar lib/startup.jar” - that’s much faster for tests than running the start script.

LG

Good news. I have reinstalled JRE6 and executed the command that you have suggest me, and it is the result:

/usr/share/openfire/lib$ java -Xms16m -Xmx32m -Xss128k -XX:ThreadStackSize=128 -XX:PermSize=8m -XX:MaxPermSize=64m -XX:+PrintGCDetails -Xloggc:/tmp/gc.log -Djava.net.preferIPv4Stack=true -server -jar ./startup.jar
Could not locate home
java.io.FileNotFoundException
at org.jivesoftware.openfire.XMPPServer.locateOpenfire(XMPPServer.java:827)
at org.jivesoftware.openfire.XMPPServer.initialize(XMPPServer.java:296)
at org.jivesoftware.openfire.XMPPServer.start(XMPPServer.java:415)
at org.jivesoftware.openfire.XMPPServer.(XMPPServer.java:161)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct orAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC onstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.jivesoftware.openfire.starter.ServerStarter.start(ServerStarter.java:106)
at org.jivesoftware.openfire.starter.ServerStarter.main(ServerStarter.ja va:51)
Critical Error! The home directory has not been configured,
which will prevent the application from working correctly.

ERROR 12283 [Jive-ERR] ():
java.io.FileNotFoundException: XML properties file does not exist: openfire.xml
at org.jivesoftware.util.XMLProperties.(XMLProperties.java:101)
at org.jivesoftware.util.XMLProperties.(XMLProperties.java:63)
at org.jivesoftware.util.JiveGlobals.loadSetupProperties(JiveGlobals.jav a:832)
at org.jivesoftware.util.JiveGlobals.getHomeDirectory(JiveGlobals.java:236)
at org.jivesoftware.util.Log.initLog(Log.java:79)
at org.jivesoftware.util.Log.(Log.java:65)
at org.jivesoftware.openfire.XMPPServer.start(XMPPServer.java:457)
at org.jivesoftware.openfire.XMPPServer.(XMPPServer.java:161)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct orAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC onstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.jivesoftware.openfire.starter.ServerStarter.start(ServerStarter.j ava:106)
at org.jivesoftware.openfire.starter.ServerStarter.main(ServerStarter.java:51)
2008.12.03 14:57:23 Error occurred opening log file: LogName was null - Openfire Home not set?
2008.12.03 14:57:23 [org.jivesoftware.openfire.XMPPServer.start(XMPPServer.java:457)]
java.io.FileNotFoundException
at org.jivesoftware.openfire.XMPPServer.locateOpenfire(XMPPServer.java:827)
at org.jivesoftware.openfire.XMPPServer.initialize(XMPPServer.java:296)
at org.jivesoftware.openfire.XMPPServer.start(XMPPServer.java:415)
at org.jivesoftware.openfire.XMPPServer.(XMPPServer.java:161)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct orAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC onstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.jivesoftware.openfire.starter.ServerStarter.start(ServerStarter.j ava:106)
at org.jivesoftware.openfire.starter.ServerStarter.main(ServerStarter.java:51)
Error starting the server. Please check the log files for more information.

I have to look for the solution to this new problem but I have more information to solve it now. If I found any problems,I ask in this thread: http://www.igniterealtime.org/community/thread/28410. Thanks to deureulenspiegel and LG for your suggestions.

Hi,

you may need to “cd openfire/bin” before you start java. And then use “… …/lib/startup.jar” instead of “… ./lib/startup.jar”

LG