We have deployed our web application deployed on oracle applications server 10 and we encounter this error when running the application.
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@12badee for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category)
We have log4j bundled inside our webapp WEBINF/lib and we have a shared lib for log4j in our application server lib as well. Since this shared lib is shared by many applications we can't remove it.
I understand that there is some class conflict in between these 2 log4j libs. Is there anyway that we can exclude this shared lib and work with the bundled log4j inside the web application? any help on this regard is highly appreciated.
Use the prefer-web-inf-classes element in your weblogic.xml
application descriptor.
According to the documentation,
Setting this element to True subverts the classloader delegation model so that class definitions from the Web application are loaded in preference to class definitions in higher-level classloaders. This allows a Web application to use its own version of a third-party class, which might also be part of WebLogic Server.
This is a related question which might help you as well.