Openfire 3.8.0: log4j doesn't pick up ${openfireHome}

Hi all.

I’m using openfire_3_8_0.tar.gz to install openfire on Centos 6.3:

yum install java-1.7.0-openjdk
tar xzf openfire_3_8_0.tar.gz
mv openfire /opt/
sh /opt/openfire/bin/extra/redhat-postinstall.sh
service openfired start

And I see in logs that it can’t create /logs/error.log and so on.

Fixing lib/log4j.xml does the thing.

Actual package start string is (logged from /opt/openfire/bin/openfire):

nohup /usr/bin/java -server -Dinstall4j.jvmDir=/usr -Dexe4j.moduleName=/opt/openfire/bin/openfire -classpath /opt/openfire/.install4j/i4jruntime.jar:/opt/openfire/lib/activation.jar:/opt/openfire/lib/bouncycastle.jar:/opt/openfire/lib/commons-el.jar:/opt/openfire/lib/hsqldb.jar:/opt/openfire/lib/jasper-compiler.jar:/opt/openfire/lib/jasper-runtime.jar:/opt/openfire/lib/jdic.jar:/opt/openfire/lib/jtds.jar:/opt/openfire/lib/mail.jar:/opt/openfire/lib/mysql.jar:/opt/openfire/lib/openfire.jar:/opt/openfire/lib/postgres.jar:/opt/openfire/lib/servlet.jar:/opt/openfire/lib/slf4j-log4j12.jar:/opt/openfire/lib/sqlite-jdbc-3.7.2.jar:/opt/openfire/lib/startup.jar com.install4j.runtime.Launcher start org.jivesoftware.openfire.starter.ServerStarter false false /opt/openfire/bin/../logs/stderror.log /opt/openfire/bin/../logs/stdoutt.log true true false  true true 0 0  20 20 Arial 0,0,0 8 500 version 3.8.0 20 40 Arial 0,0,0 8 500 -1 -DopenfireHome=/opt/openfire/bin/../ -Dopenfire.lib.dir=/opt/openfire/lib

openfire.zip (2519 Bytes)
log4j.xml (2848 Bytes)

Why not just use the RPM?

Logged as OF-640

Why Java is broken again?

I prefer to depend of some system based solution that would be automatically updated in the case of “Bad Things Happen”. Java from the CentOS repo would be updated automatically even if I’m not going to update OpenFire. OpenFire still needs to be updated by hand. Or is the a working yum repo for CentOS 6.3 around?

In case I would have two sources for one package I would still prefer system one as CentOS will be first to release patch.

And yes, I prefer to use the latest stable version when setting something up. I need cluster, I need FastPath and I want it to work for at least four years more without issues. And I really don’t want to dive into process of updating and reinstallation if Oracle decides to dump Java 1.6 in two years. I prefer to witness all bugs and glitches right now, before it goes to production.

What did you change in log4j.xml?

It seems like openfireHome is not defined so that

becomes simply /logs/info.log

That’s why I included start string. It has "-DopenfireHome=/opt/openfire/bin/../" in it.

I fixed it by “s|${openfireHome}|/opt/openfire/|” but that’s not a real fix I can propose.

And it doesn’t work if you use -DopenfireHOme=/foo/bar and don’t substitute openfireHome in log4j.xml?

Correct.

And after you executed redhat-postinstall.sh, what where the contents of log4j.xml with regard to the log file paths?

Attached.

It looks like packaging problem. And this can be caused by other bug I reported before. When extracting openfire_3_8_0.tar.gz I get no “openfire.sh”, only “openfire”. I attached this file too. This file is not present in trunk and in branch for 3.8.0 and the way it starts java is totally wrong.

I actually managed to fix this file by moving -DopenfireHome declaration to the beginning of the string. With this change it automatically starts fine.

What exactly is totally wrong?

It seems that bin/openfire in the tar.gz distribution is created by install4j, at least I could find any traces of this file in the svn.

Actually i use openfire (without sh) to run Openfire on my server. I use old version of a daemon (from 2007) which is pointing to openfire binary. I use tar.gz version, and i only extract it over the older version and don’t run any scripts. Daemon is already in place and working, so no need to replace it and no need to “install” anything. I thought this was an advantage and purpose of such tar.gz extractable versin, that you don’t have to worry about install scripts, etc.:slight_smile:

I already posted the full executed string before:

nohup /usr/bin/java -server -Dinstall4j.jvmDir=/usr -Dexe4j.moduleName=/opt/openfire/bin/openfire -classpath /opt/openfire/.install4j/i4jruntime.jar:/opt/openfire/lib/activation.jar:/opt/openfire/lib/bouncycastle.jar:/opt/openfire/lib/commons-el.jar:/opt/openfire/lib/hsqldb.jar:/opt/openfire/lib/jasper-compiler.jar:/opt/openfire/lib/jasper-runtime.jar:/opt/openfire/lib/jdic.jar:/opt/openfire/lib/jtds.jar:/opt/openfire/lib/mail.jar:/opt/openfire/lib/mysql.jar:/opt/openfire/lib/openfire.jar:/opt/openfire/lib/postgres.jar:/opt/openfire/lib/servlet.jar:/opt/openfire/lib/slf4j-log4j12.jar:/opt/openfire/lib/sqlite-jdbc-3.7.2.jar:/opt/openfire/lib/startup.jar com.install4j.runtime.Launcher start org.jivesoftware.openfire.starter.ServerStarter false false /opt/openfire/bin/../logs/stderror.log /opt/openfire/bin/../logs/stdoutt.log true true false true true 0 0 20 20 Arial 0,0,0 8 500 version 3.8.0 20 40 Arial 0,0,0 8 500 -1 -DopenfireHome=/opt/openfire/bin/../ -Dopenfire.lib.dir=/opt/openfire/lib

When I move -D declaration parameters to the beginning of the line everything works.

Maybe I’m just wrong and I need to find out where I can get openfire.sh? openfired mentiones this file, not openfire, but openfire.sh is nor included into the package nor generated by redhat-postinstall.sh.