Hi,
I got to the bottom of the unresolved symbol issue that was reported in
the kraken Openfire plug-in installed in co-existence with the sipXecs
presence plug-in. I thought I'd share the findings Jason and I made in
case you face the same issue in the future.
In summary, when an application provides a class name to log4j via the
Properties.setProperty() API call, the location of the
application-provided class name jar file needs to be located in the
*same path* as to where the log4j.jar file is first loaded in the
classpath. That is either loaded statically via a classpath option on
the JVM command line or dynamically via the class loader.
For example in Openfire:
==================
The kraken plug-in class (net/sf/kraken/KrakenPlugin.java) invokes those
properties set in log4j:
public KrakenPlugin() {
setLoggerProperty("log4j.appender.openfire",
"net.sf.kraken.util.Log4JToOpenfireAppender");
setLoggerProperty("log4j.appender.openfiredebug",
"net.sf.kraken.util.DebugOnlyLog4JToOpenfireAppender");
}
public static void setLoggerProperty(String property, String
setting) {
log4jProperties.setProperty(property, setting);
PropertyConfigurator.configure(log4jProperties);
}
Classes KrakenPlugin, Log4JToOpenfireAppender and
DebugOnlyLog4JToOpenfireAppender all appear in this jar file:
/opt/openfire/plugins/kraken/lib/plugin-kraken.jar
The initial log4j.jar file that is added to the static classpath is
located in /opt/openfire/lib/log4j.jar.
The fact that log4j.jar is located in /opt/openfire/lib and that the
properties setting invoked from KrakenPlugin in path
/opt/openfire/plugins/kraken/lib differ causes unresolved symbols for
both Log4JToOpenfireAppender and DebugOnlyLog4JToOpenfireAppender
classes. However, if I move /opt/openfire/lib/log4j.jar to
/opt/openfire/plugins/kraken/lib/log4.jar then the symbols are resolved.
Doing so however creates other unresolved symbols in the sipXecs
presence plug-in.
The solution to this problem is to create a new jar file that contains
both Log4JToOpenfireAppender and DebugOnlyLog4JToOpenfireAppender
classes and install the jar file under in /opt/openfire/lib such that
the referred-to classes are co-located in the same directory.
This is not an issue for the presence plug-in because the class names
provided in the log4j properties calls are loaded from
/opt/openfire/lib/sipxcommons.jar located in the same directory as for
/opt/openfire/lib/log4j.jar.
.../SipXOpenfirePlugin.java:
props.setProperty("log4j.appender.file",
SipFoundryAppender.class.getName());
.../presence/SipXOpenfirePlugin.java:
props.setProperty("log4j.appender.file.layout",
SipFoundryLayout.class.getName());
Best regards,
Martin
_______________________________________________
sipx-dev mailing list [email protected]
List Archive: http://list.sipfoundry.org/archive/sipx-dev
Unsubscribe: http://list.sipfoundry.org/mailman/listinfo/sipx-dev
sipXecs IP PBX -- http://www.sipfoundry.org/