Openfire Ubuntu 12.04 doesn't always bind to Port

Hello everybody,

hopefully you may help me, since im trying to get this running for the past few days.

At the moment the system is steup as folloed:

Java (tried several Java packets, at the moment this is the one used):

/# java -version

java version “1.6.0_38”

Java™ SE Runtime Environment (build 1.6.0_38-b05)

Java HotSpot™ Client VM (build 20.13-b02, mixed mode)

Openfire installed:

/# dpkg -i openfire_3.7.1_all.deb

with no warnings or errors.

Changed /etc/ini.d/openfire line 27 to the following due to the “ubuntu java oracle”-Problem:

t=/usr/lib/jvm/java-6-oracle && test -d $t && JAVA_HOME=$t

Now starting openfire as usual

/# ./etc/init.d/openfire start
Starting openfire: openfire.

Looking if running

/# ps -elf | grep openfire

4 S openfire 1887 1 5 80 0 - 169316 futex_ 10:35 ? 00:00:02 /usr/lib/jvm/java-6-oracle/bin/java -server -DopenfireHome=/usr/share/openfire -Dopenfire.lib.dir=/usr/share/openfire/lib -classpath /usr/share/openfire/lib/startup.jar -jar /usr/share/openfire/lib/startup.jar

Seems to be good to go, but I can’t reach the webconfig under port 9090.

Ports are opened.

/# iptables -S

-A INPUT -p tcp -m tcp --dport 5222 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 5223 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 9090 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 9091 -j ACCEPT

But when i do a netstat I don’t see anything listening on 9090 (9091 aswell etc.).

So where am I doing something wrong? I also tried the tar.gz package, but there I’m running in even more trouble. Also every install instruction for Ubuntu 12.04 I found via google, used the DEB.

Is there anybody with some good idea for me? I used Openfire under OpenSuse and this was so easy to setup and at the moment I’m quite confused

Thanks for your help in advance

Changed title -> Less confusing title

After a reboot of the server I was able to connect to the webconfig. After a while the connection broke and i was unable to connect to the webconfig again.

Something is weird here. Because there was a 9090 Port listening. Now there isn’t. Something seems to prevent openfire from binding on this port.

The warn.log says

2012.12.13 09:35:37 org.jivesoftware.util.log.util.JettyLog - EXCEPTION
java.lang.IllegalMonitorStateException
        at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireInterruptibly(AbstractQueuedSynchronizer.java:858)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(AbstractQueuedSynchronizer.java:1201)
        at java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:312)
        at org.eclipse.jetty.util.BlockingArrayQueue.poll(BlockingArrayQueue.java:311)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:451)
        at java.lang.Thread.run(Thread.java:662)
2012.12.13 09:56:20 org.jivesoftware.util.log.util.JettyLog - HttpException(400,null,null)
2012.12.13 09:56:20 org.jivesoftware.util.log.util.JettyLog - HttpException(400,null,null)
2012.12.13 09:56:21 org.jivesoftware.util.log.util.JettyLog - HttpException(400,null,null)
2012.12.13 09:56:21 org.jivesoftware.util.log.util.JettyLog - HttpException(400,null,null)

info.log

2012.12.13 09:29:22 org.jivesoftware.openfire.XMPPServer - Openfire 3.7.1 [Dec 13, 2012 9:29:22 AM]
2012.12.13 09:35:36 org.jivesoftware.openfire.XMPPServer - Openfire 3.7.1 [Dec 13, 2012 9:35:36 AM]
2012.12.13 09:53:48 org.jivesoftware.openfire.XMPPServer - Server halted
2012.12.13 09:56:03 org.jivesoftware.openfire.XMPPServer - Openfire 3.7.1 [Dec 13, 2012 9:56:03 AM]
2012.12.13 09:56:06 org.jivesoftware.openfire.container.AdminConsolePlugin - Admin console listening at http://127.0.0.1:9090
2012.12.13 10:10:07 org.jivesoftware.openfire.XMPPServer - Openfire 3.7.1 [13.12.2012 10:10:07]
2012.12.13 10:10:10 org.jivesoftware.openfire.container.AdminConsolePlugin - Adminkonsole lauscht auf http://127.0.0.1:9090
2012.12.13 10:12:03 org.jivesoftware.openfire.XMPPServer - Openfire 3.7.1 [13.12.2012 10:12:03]

Do you need something else to help me by this? I have no further idea.

Ok some Update in hope that somebody may help me by this.

After a few tests with several Java Versions the only info on starting the openfire server is the line

Starting openfire: openfire as you can see below:

/# ./etc/init.d/openfire start

Starting openfire: openfire.

The logs don’t get any further updates since my last post. No info about listening on port 9090 no information about a startup. Plain nothing. The only thing is the line in the process view.

Is there anyone up to this problem?

EDIT:

I was unable to connect to the Webconfig since the 13. Dec again. It never started up again

Modify your startup script to log stdout from the JRE so you can see what it is doing.

Something like this:

su -s /bin/sh -c “nohup $OPENFIRE_RUN_CMD > $OPENFIRE_LOGDIR/nohup.out 2>&1 &” $OPENFIRE_USER

You should also verify none of the Openfire ports are in use with ‘netstat -ntlp’ - Check for 9090/9091/5222/5223/5262 at minimum.

Hello David,

Thanks for your reply. First I checked the netstat when openfire is not started. There was none of the mentioned ports listed.

I’m not sure if i get the part with modifying the startup script right. Do you mean this script /etc/init.d/openfire? and where shoud this line go there? In first place? I haven’t done anything like that before.

Is it supposed to make a nohup.out file in /var/logs/openfire/?

Thanks for your help in advance

Yes, the init.d script. There should be an existing nohup line in there that you can modify. By default I believe it sends the output to /dev/null.

You can change it to log to /opt/openfire/logs instead - /var/log/openfire is something specific to our environment.

Hmm, I can’t find a nohup line in the script. For your reference, I provide you with my actual init.d script file:

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
         t=/usr/lib/jvm/java-6-openjdk && 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 -server -DopenfireHome=${DAEMON_DIR} \ -Dopenfire.lib.dir=${DAEMON_LIB} -classpath ${DAEMON_LIB}/startup.jar\ -jar ${DAEMON_LIB}/startup.jar" #set -e #Helper functions
start() {
        start-stop-daemon --start --quiet --background --make-pidfile \
                --pidfile /var/run/$NAME.pid --chuid openfire:openfire \
                --exec $JAVA -- $DAEMON_OPTS
} stop() {
        start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
                --exec $JAVA --retry 4
} case "$1" in
  start)
        echo -n "Starting $DESC: "
        start
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping $DESC: "
        stop
        echo "$NAME."
        ;;
  restart|force-reload)
        #
        #       If the "reload" option is implemented, move the "force-reload"
        #       option to the "reload" entry above. If not, "force-reload" is
        #       just the same as "restart".
        #
        echo -n "Restarting $DESC: "
        #set +e
        stop
        #set -e
        #sleep 1
        start         echo "$NAME."
        ;;
  *)
        N=/etc/init.d/$NAME
        # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac exit 0

Hope that helps.

Change your start function to this:

start() {

start-stop-daemon --start --quiet --background --make-pidfile \

–pidfile /var/run/$NAME.pid --chuid openfire:openfire \

–exec /bin/bash – -c " $JAVA $DAEMON_OPTS > /opt/openfire/log/stdout.log 2>&1"

}

Make sure the openfire user can write to /opt/openfire/log, or change it to some place it can write to.

Ok, that works. Thank you so far. I’m getting a stdout file in the defined folder. But it stays empty.

Openfire running? Check!

16280 ? Sl 0:00 /usr/lib/jvm/java-6-openjdk/bin/java -server -DopenfireHome=/usr/share/openfire -Dopenfire.lib.dir=/usr/share/openfire/lib -classpath /usr/share/openfire/lib/startup.jar -jar /usr/share/openfire/lib/startup.jar

stdout.log? Check!

/var/log/openfire# ls -l

-rw-r–r-- 1 openfire openfire 0 Dez 19 16:07 stdout.log

The first time after changing the init script openfire didn’t start. There was the following message in stdout.log:

root@h1760304:/var/log/openfire# cat stdout.log

A fatal error has been detected by the Java Runtime Environment:

SIGSEGV (0xb) at pc=0xb4651edd, pid=16244, tid=3078101824

JRE version: 6.0_24-b24

Java VM: OpenJDK Server VM (20.0-b12 mixed mode linux-x86 )

Derivative: IcedTea6 1.11.5

Distribution: Ubuntu 12.04 LTS, package 6b24-1.11.5-0ubuntu1~12.04.1

Problematic frame:

J java.lang.Object.()V

An error report file with more information is saved as:

/tmp/hs_err_pid16244.log

[thread -1954546880 also had an error]

If you would like to submit a bug report, please include

instructions how to reproduce the bug and visit:

https://bugs.launchpad.net/ubuntu/+source/openjdk-6/

Too bad I can’t provide you with more logging information

Well, first off the Java it is using when it reported that error is not the same java you said you had installed - You might want to look at the script and make sure $JAVA explicitly points to the Oracle JRE rather than OpenJDK.

Start there and see if the log file is still empty.

Ok just had the time to look after that one. Due to my testings I switched the java version. Now im back on the version i mentioned in my first posting. Also I changed the init script back to use the correct java version

t=/usr/lib/jvm/java-6-oracle && test -d $t && JAVA_HOME=$t

Unfortunately openfire is running (now two tasks, I guess because of the change of the start function) I get these tasks

27071 ? S 0:00 /bin/bash -c /usr/lib/jvm/java-6-oracle/bin/java -server -DopenfireHome=/usr/share/openfire -Dopenfire.lib.dir=/usr/share/openfire/lib -classpath /usr/share/openfire/lib/startup.jar -jar /usr/share/openfire/

27072 ? Sl 0:01 /usr/lib/jvm/java-6-oracle/bin/java -server -DopenfireHome=/usr/share/openfire -Dopenfire.lib.dir=/usr/share/openfire/lib -classpath /usr/share/openfire/lib/startup.jar -jar /usr/share/openfire/lib/startup.jar

but the stdout. log still is empty and still no listening ports in netstat

su to the openfire user and run the command manually from the command line:

/usr/lib/jvm/java-6-oracle/bin/java -server -DopenfireHome=/usr/share/openfire -Dopenfire.lib.dir=/usr/share/openfire/lib -classpath /usr/share/openfire/lib/startup.jar -jar /usr/share/openfire/lib/startup.jar

Should just write any errors directly to the terminal.

Thanks again for your help.

When running it that way for the first time i got the following:

root@h1760304:/# /usr/lib/jvm/java-6-oracle/bin/java -server -DopenfireHome=/usr/share/openfire -Dopenfire.lib.dir=/usr/share/openfire/lib -classpath /usr/share/openfire/lib/startup.jar -jar /usr/share/openfire/lib/startup.jar

Openfire 3.7.1 [20.12.2012 12:39:37]

Adminkonsole lauscht auf http://xxx.xxx.xxx.xxx:9090

A fatal error has been detected by the Java Runtime Environment:

SIGSEGV (0xb) at pc=0xb6c0ace8, pid=1321, tid=2376948544

JRE version: 6.0_38-b05

Java VM: Java HotSpot™ Server VM (20.13-b02 mixed mode linux-x86 )

Problematic frame:

V [libjvm.so+0x287ce8] ClassFileParser::parse_method(constantPoolHandle, bool, AccessFlags*, typeArrayHandle*, typeArrayHandle*, typeArrayHandle*, Thread*)+0x7d8

An error report file with more information is saved as:

//hs_err_pid1321.log

If you would like to submit a bug report, please visit:

http://java.sun.com/webapps/bugreport/crash.jsp

Abgebrochen (Speicherabzug geschrieben)

I tried in directly again and it started. Also I was able to connect to the setup page but wasn’t able to end the websetup. I lost connection at the last step in the websetup (Adminacc) I tried to get it running again. But several times I had connected and been disconnected in one or another step of the websetup.

I didn’t get any other information on the command line as that openfire has started and that it is listening on port 9090 (which at all was a step forward). It seems at the moment something breaks during the websetup. As usual at the moment: No logs

Also I had to kill the running command as ctrl+c didn’t work when the websetup lost connection.

Hopefully you understand everything I mean Thanks alot so far.

Hello everybody again. Due to the hollydays I didn’t find time to give you some further information on this problempojectthing

What have I done till then?

I completely remove everything related to openfire from the system. and reinstalled it. After a change in the init script to use the oracle Java

Line 27 edited to:

t=/usr/lib/jvm/java-6-oracle && test -d $t && JAVA_HOME=$t

Started openfire and voila there is the webinterface. I was happy as f… and wanted to complete the websetup but at the point where I have to enter the admin account the websetup hang up and did’t respond. I checkt if it is still running and it was. Checked netstat if there is a port 9090 and it was. It just seemed to stop working.

I restarted openfire but now it didn’t bind on 9090. I tried 2 more times and now it bound to it. And again i wasn’t able to complete the websetup. It hungup where i have to choose the database. This happened now several times.

I found this errors in the error.log:

2013.01.04 16:02:32 org.jivesoftware.util.Log - Access is denied: Session is closed

java.sql.SQLException: Access is denied: Session is closed

This error didn’t occour everytime I tried and restarted etc.

Maybe this helps you more. I just don’t understand why it does sometimes work a few seconds and then BOOM nothing again