You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by an...@itginc.com on 2004/01/05 21:37:42 UTC

Problems with DOMConfigurator and WebLogic 6.1 SP4

I am using log4j 1.2.7 with a web application under WebLogic 6.1 sp4.  I
just recently switched from using log4j.properties to log4j.xml in order to
use an asynchronous appender.  I'm running into a problem that I hope
someone on this list can help me with.

The first class that accesses log4j is a ServletContextListener.  My
getLogger call is failing:

private static final Logger log =
Logger.getLogger(MyServletContextListener.class);

I've turned on log4j.debug, and here's what I get in my console output:

--BEGIN CONSOLE OUTPUT--
log4j: Trying to find [log4j.xml] using context classloader
sun.misc.Launcher$AppClassLoader@3f52a5.
log4j: Trying to find [log4j.xml] using
weblogic.utils.classloaders.ChangeAwareClassLoader@3f61a0 finder:
weblogic.utils.classloaders.MultiClassFinder@596138 class loader.
log4j: Using URL
[file:/home/anguyen/applications/myapp//WEB-INF/classes/log4j.xml] for
automatic log4j configuration.
log4j: Preferred configurator class: org.apache.log4j.xml.DOMConfigurator
log4j: System property is :null
java.lang.ExceptionInInitializerError: java.lang.ClassCastException:
weblogic.xml.jaxp.RegistryDocumentBuilderFactory
        at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown
Source)
        at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:644)
        at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
        at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:602)
        at
org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:460)
        at org.apache.log4j.LogManager.<clinit>(LogManager.java:113)
        at org.apache.log4j.Logger.getLogger(Logger.java:94)
        at
com.itgssi.MyServletContextListener.<clinit>(MyServletContextListener.java:35)
        at java.lang.Class.newInstance0(Native Method)
        at java.lang.Class.newInstance(Class.java:237)
        at
weblogic.servlet.internal.WebAppServletContext.registerEventListener(WebAppServletContext.java:1997)
        at
weblogic.servlet.internal.WebAppServletContext.initFromDescriptors(WebAppServletContext.java:1444)
        at
weblogic.servlet.internal.WebAppServletContext.init(WebAppServletContext.java:940)
        at
weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:875)
        at
weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:503)
        at weblogic.j2ee.WebAppComponent.deploy(WebAppComponent.java:77)
        at weblogic.j2ee.Application.addComponent(Application.java:174)
        at weblogic.j2ee.J2EEService.addDeployment(J2EEService.java:117)
        at
weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:364)
        at
weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:150)
        at
weblogic.management.mbeans.custom.WebServer.addWebDeployment(WebServer.java:76)
[rest of stack trace removed for brevity]

--END CONSOLE OUTPUT--

I have placed log4j.xml in WEB-INF/classes and log4j.jar in WEB-INF/lib.  I
think I'm running into a class loader issue, but I'm not sure.  I do have a
newer version of xerces in my WEB-INF/lib than what comes with WebLogic,
and I think this is causing the CCE.  I tried specifying
-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl,
 but all this did was change the CCE message to
"org.apache.xerces.jaxp.DocumentBuilderFactoryImpl".  My guess is that
DOMConfigurator is expecting DocumentBuilderFactory.newInstance to return a
DocumentBuilderFactory loaded from the webapp class loader, but xerces uses
the system class loader when locating/instantiating the
DocumentBuilderFactory.  Has anyone experienced this behavior?  Any clues
no how I can get around this?  Any help is appreciated.

Regards,

Andy Nguyen







-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
"This message is for the named person's use only. This communication is for 
informational purposes only and has been obtained from sources believed to 
be reliable, but it is not necessarily complete and its accuracy cannot be 
guaranteed. It is not intended as an offer or solicitation for the purchase
or sale of any financial instrument or as an official confirmation of any
transaction. Moreover, this material should not be construed to contain any
recommendation regarding, or opinion concerning, any security. It may
contain confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission. If
you receive this message in error, please immediately delete it and all
copies of it from your system, destroy any hard copies of it and notify the
sender. You must not, directly or indirectly, use, disclose, distribute, 
print, or copy any part of this message if you are not the intended 
recipient.  Any views expressed in this message are those of the individual
sender, except where the message states otherwise and the sender is 
authorized to state them to be the views of any such entity.

ITG Inc. reserves the right to monitor and archive all electronic 
communications through its network. 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Problems with DOMConfigurator and WebLogic 6.1 SP4

Posted by Ceki Gülcü <ce...@qos.ch>.
First check if using log4j 1.2.8 makes a difference.

At 03:37 PM 1/5/2004 -0500, anguyen@itginc.com wrote:
>I am using log4j 1.2.7 with a web application under WebLogic 6.1 sp4.  I
>just recently switched from using log4j.properties to log4j.xml in order to
>use an asynchronous appender.  I'm running into a problem that I hope
>someone on this list can help me with.
>
>The first class that accesses log4j is a ServletContextListener.  My
>getLogger call is failing:
>
>private static final Logger log =
>Logger.getLogger(MyServletContextListener.class);
>
>I've turned on log4j.debug, and here's what I get in my console output:
>
>--BEGIN CONSOLE OUTPUT--
>log4j: Trying to find [log4j.xml] using context classloader
>sun.misc.Launcher$AppClassLoader@3f52a5.
>log4j: Trying to find [log4j.xml] using
>weblogic.utils.classloaders.ChangeAwareClassLoader@3f61a0 finder:
>weblogic.utils.classloaders.MultiClassFinder@596138 class loader.
>log4j: Using URL
>[file:/home/anguyen/applications/myapp//WEB-INF/classes/log4j.xml] for
>automatic log4j configuration.
>log4j: Preferred configurator class: org.apache.log4j.xml.DOMConfigurator
>log4j: System property is :null
>java.lang.ExceptionInInitializerError: java.lang.ClassCastException:
>weblogic.xml.jaxp.RegistryDocumentBuilderFactory
>         at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown
>Source)
>         at
>org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:644)
>         at
>org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
>         at
>org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:602)
>         at
>org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:460)
>         at org.apache.log4j.LogManager.<clinit>(LogManager.java:113)
>         at org.apache.log4j.Logger.getLogger(Logger.java:94)
>         at
>com.itgssi.MyServletContextListener.<clinit>(MyServletContextListener.java:35)
>         at java.lang.Class.newInstance0(Native Method)
>         at java.lang.Class.newInstance(Class.java:237)
>         at
>weblogic.servlet.internal.WebAppServletContext.registerEventListener(WebAppServletContext.java:1997)
>         at
>weblogic.servlet.internal.WebAppServletContext.initFromDescriptors(WebAppServletContext.java:1444)
>         at
>weblogic.servlet.internal.WebAppServletContext.init(WebAppServletContext.java:940)
>         at
>weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:875)
>         at
>weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:503)
>         at weblogic.j2ee.WebAppComponent.deploy(WebAppComponent.java:77)
>         at weblogic.j2ee.Application.addComponent(Application.java:174)
>         at weblogic.j2ee.J2EEService.addDeployment(J2EEService.java:117)
>         at
>weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:364)
>         at
>weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:150)
>         at
>weblogic.management.mbeans.custom.WebServer.addWebDeployment(WebServer.java:76)
>[rest of stack trace removed for brevity]
>
>--END CONSOLE OUTPUT--
>
>I have placed log4j.xml in WEB-INF/classes and log4j.jar in WEB-INF/lib.  I
>think I'm running into a class loader issue, but I'm not sure.  I do have a
>newer version of xerces in my WEB-INF/lib than what comes with WebLogic,
>and I think this is causing the CCE.  I tried specifying
>-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl,
>  but all this did was change the CCE message to
>"org.apache.xerces.jaxp.DocumentBuilderFactoryImpl".  My guess is that
>DOMConfigurator is expecting DocumentBuilderFactory.newInstance to return a
>DocumentBuilderFactory loaded from the webapp class loader, but xerces uses
>the system class loader when locating/instantiating the
>DocumentBuilderFactory.  Has anyone experienced this behavior?  Any clues
>no how I can get around this?  Any help is appreciated.
>
>Regards,
>
>Andy Nguyen
>
>
>
>
>
>
>
>-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
>"This message is for the named person's use only. This communication is for
>informational purposes only and has been obtained from sources believed to
>be reliable, but it is not necessarily complete and its accuracy cannot be
>guaranteed. It is not intended as an offer or solicitation for the purchase
>or sale of any financial instrument or as an official confirmation of any
>transaction. Moreover, this material should not be construed to contain any
>recommendation regarding, or opinion concerning, any security. It may
>contain confidential, proprietary or legally privileged information. No
>confidentiality or privilege is waived or lost by any mistransmission. If
>you receive this message in error, please immediately delete it and all
>copies of it from your system, destroy any hard copies of it and notify the
>sender. You must not, directly or indirectly, use, disclose, distribute,
>print, or copy any part of this message if you are not the intended
>recipient.  Any views expressed in this message are those of the individual
>sender, except where the message states otherwise and the sender is
>authorized to state them to be the views of any such entity.
>
>ITG Inc. reserves the right to monitor and archive all electronic
>communications through its network.
>-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org

-- 
Ceki Gülcü

      For log4j documentation consider "The complete log4j manual"
      ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp  



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org