[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [equinox-dev] 2 versions of log4j-core.jar
|
Hi Tom,
Resources from you classpath should not be leaking into your OSGi environment unless the "osgi.parentClassLoader" is set to either app or framework and you're doing something like setting 'org.osgi.framework.bootdelegation=*'.
Can you look at these settings and tell us a bit about the environment you're running.
Also, this is really the dev list. Could we continue this thread in the user newsgroup -- eclipse.technology.equinox.
Thanks.
-Simon
equinox-dev-bounces@xxxxxxxxxxx wrote on 03/05/2009 07:29:45 PM:
> [image removed]
>
> [equinox-dev] 2 versions of log4j-core.jar
>
> Tom Hsu
>
> to:
>
> Equinox development mailing list
>
> 03/05/2009 07:32 PM
>
> Sent by:
>
> equinox-dev-bounces@xxxxxxxxxxx
>
> Please respond to Equinox development mailing list
>
> Hi experts,
>
> In the midst of the integrating a osgi/eclipse based program to an
> existing Java program, I am running into a problem with the double
> loading of log4j-core.jar. The original java program already has a
> log4j-core.jar loaded as part of the CLASSPATH when it is started. The
> said program in turns will launch the new osgi/eclipse based program
> through EclipseStarter:
> ***
> EclipseStarter.setInitialProperties(buildDefaultProps());
> EclipseStarter.startup(launcherArgs, null);
> EclipseStarter.run(launcherArgs);
> ***
>
> The osgi/eclipse program has another version of the log4-core.jar in the
> org.apache.jakarta_log4j_0.0.0. bundle. This bundle is a required
> bundle. As you can see, that the same classes will be loaded twice when
> my original Java program attempts to load the osgi/eclipse program.
> Hence I am getting a class cast error:
> ***
> log4j:ERROR Could not create an Appender. Reported error follows.
> java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot be
> cast to org.apache.log4j.Appender
> at
> org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:165)
>
> at
> org.apache.log4j.xml.DOMConfigurator.findAppenderByName
> (DOMConfigurator.java:140)
>
> at
> org.apache.log4j.xml.DOMConfigurator.findAppenderByReference
> (DOMConfigurator.java:153)
>
> at
> org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement
> (DOMConfigurator.java:415)
>
> at
> org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:384)
> at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:783)
> at
> org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:666)
> at
> org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
> at
> org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:584)
> at org.apache.log4j.xml.XMLWatchdog.doOnChange(DOMConfigurator.java:815)
> at
> org.apache.log4j.helpers.FileWatchdog.checkAndConfigure(FileWatchdog.java:80)
>
> at org.apache.log4j.helpers.FileWatchdog.<init>(FileWatchdog.java:49)
> at org.apache.log4j.xml.XMLWatchdog.<init>(DOMConfigurator.java:807)
> at
> org.apache.log4j.xml.DOMConfigurator.configureAndWatch
> (DOMConfigurator.java:574)
>
> at
> org.apache.log4j.xml.DOMConfigurator.configureAndWatch
> (DOMConfigurator.java:557)
>
> ...
> ***
>
> Can someone advise me on how to solve this issue? I am thinking about
> ways like:
> 1. Make the OSGI know that log4j-core.jar is already present so don't
> load it again. Not sure how to do this or if this is even feasible.
> 2. Modify the bundle requirement of the various bundles in the plugins
> directory so the org.jakarta bundle will not be needed? I'd like to
> avoid this since this means I have to change someone else's nicely
> packaged bundles.
>
> Regards,
> Tom
> _______________________________________________
> equinox-dev mailing list
> equinox-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/equinox-dev