DynamicClassLoadingException - How does class loading in logback works?

Hi, I'm sorry for the earlier posts, my keyboard enter key was malfunctioning. I'm using weblogic 10, and deployed my application as EAR. My custom appender is located in the WEB-INF/lib. I am getting this ClassNotFoundException. app.ear - web1.war - WEB-INF/lib customAppenderPackage.jar So I've tried the following but still it can't find it: - deploying customAppenderPackage.jar as a shared library - putting in APP-INF/lib/customAppenderPackage.jar - adding in the MANIFEST Class-Path - adding as "library-ref" in weblogic.xml and weblogic-application.xml The only one that worked is when I moved the customAppenderPackage.jar in my weblogic server domain library directory. But I don't want this... I want it to be inside my EAR package. Any ideas how to solve this? How does class loading in logback works? Caused by: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type com.mycompany.CustomeAppender at at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:45) at at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:23) at at ch.qos.logback.core.joran.action.AppenderAction.begin(AppenderAction.java:50) at ... 51 common frames omitted Caused by: java.lang.ClassNotFoundException: com.mycompany.CustomeAppender at at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at at java.security.AccessController.doPrivileged(Native Method) at at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

I found a solution. I just put my customAppenderPackage.jar in the same level (same directory) where my logback.jar files are. thanks --- On Wed, 11/12/08, Jenny <jenny_uy81@yahoo.com> wrote: From: Jenny <jenny_uy81@yahoo.com> Subject: [logback-user] DynamicClassLoadingException - How does class loading in logback works? To: "logback users list" <logback-user@qos.ch> Date: Wednesday, November 12, 2008, 10:59 AM Hi, I'm sorry for the earlier posts, my keyboard enter key was malfunctioning. I'm using weblogic 10, and deployed my application as EAR. My custom appender is located in the WEB-INF/lib. I am getting this ClassNotFoundException. app.ear - web1.war - WEB-INF/lib customAppenderPackage.jar So I've tried the following but still it can't find it: - deploying customAppenderPackage.jar as a shared library - putting in APP-INF/lib/customAppenderPackage.jar - adding in the MANIFEST Class-Path - adding as "library-ref" in weblogic.xml and weblogic-application.xml The only one that worked is when I moved the customAppenderPackage.jar in my weblogic server domain library directory. But I don't want this... I want it to be inside my EAR package. Any ideas how to solve this? How does class loading in logback works? Caused by: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type com.mycompany.CustomeAppender at at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:45) at at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:23) at at ch.qos.logback.core.joran.action.AppenderAction.begin(AppenderAction.java:50) at ... 51 common frames omitted Caused by: java.lang.ClassNotFoundException: com.mycompany.CustomeAppender at at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at at java.security.AccessController.doPrivileged(Native Method) at at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at at java.lang.ClassLoader.loadClass(ClassLoader.java:306) _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

Jenny skrev:
I found a solution. I just put my customAppenderPackage.jar in the same level (same directory) where my logback.jar files are. thanks
Interesting. Where are your logback files? /Thorbjørn

The class look up for custom components has been simplified, only the class loader that loaded logback itself is used. In earlier versions of logback several class loaders, including the ThreadContext class loader were used. There are less surprises with the simplified approach. Thorbjørn Ravn Andersen wrote:
Jenny skrev:
I found a solution. I just put my customAppenderPackage.jar in the same level (same directory) where my logback.jar files are. thanks
Interesting. Where are your logback files?
/Thorbjørn
-- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch

Ah that explains it. Thanks Ceki. Thorbjørn, Initially this was my setup Weblogic Domain / lib - logback.jar files MyApp.ear - MyWeb.jar - WEB-INF/lib - customAppenderPackage.jar When I put logback.jar files in the same level with customAppenderPackage.jar it works. --- On Thu, 11/13/08, Ceki Gulcu <listid@qos.ch> wrote:
From: Ceki Gulcu <listid@qos.ch> Subject: Re: [logback-user] DynamicClassLoadingException - How does class loading in logback works? To: "logback users list" <logback-user@qos.ch> Date: Thursday, November 13, 2008, 4:15 PM The class look up for custom components has been simplified, only the class loader that loaded logback itself is used. In earlier versions of logback several class loaders, including the ThreadContext class loader were used.
There are less surprises with the simplified approach.
Thorbjørn Ravn Andersen wrote:
Jenny skrev:
I found a solution. I just put my customAppenderPackage.jar in the same level (same directory) where my logback.jar files are. thanks
Interesting. Where are your logback files?
/Thorbjørn
-- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

Jenny skrev:
Ah that explains it. Thanks Ceki.
Thorbjørn, Initially this was my setup
Weblogic Domain / lib - logback.jar files
MyApp.ear - MyWeb.jar - WEB-INF/lib - customAppenderPackage.jar
When I put logback.jar files in the same level with customAppenderPackage.jar it works.
Great, that makes sense. The domain lib cannot see the application packages. Oh the joys of classloader magic.

Ceki Gulcu skrev:
The class look up for custom components has been simplified, only the class loader that loaded logback itself is used. In earlier versions of logback several class loaders, including the ThreadContext class loader were used.
There are less surprises with the simplified approach.
I understand that. What I don't understand is if the logback files was included with the web container (which I doubt) or elsewhere?

See Jenny's message from 2 minutes ago. Does it answer your question? Thorbjørn Ravn Andersen wrote:
Ceki Gulcu skrev:
The class look up for custom components has been simplified, only the class loader that loaded logback itself is used. In earlier versions of logback several class loaders, including the ThreadContext class loader were used.
There are less surprises with the simplified approach.
I understand that. What I don't understand is if the logback files was included with the web container (which I doubt) or elsewhere?
-- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch
participants (3)
-
Ceki Gulcu
-
Jenny
-
Thorbjørn Ravn Andersen