Question

I created an aribaweb application which is running on JBoss AS7. In JBoss AS7 uses org.jboss.logmanager.log4j.BridgeLogger class for Logger implementation (Here the BridgeLogger class extends with org.apache.log4j.Logger). I deployed an aribaweb application in JBoss AS7 server . Internally aribaweb application also uses same Log4J Implementation for logging purpose but it uses ariba.util.log.Logger class (Here the ariba Logger class extends with org.apache.log4j.Logger) for Logger implementation. But aribaweb application shows no result due to some class cast exception which is related to logger issue here follows few lines of my exception


java.lang.ExceptionInInitializerError
    at ariba.util.core.ClassUtil.classForName(ClassUtil.java:259)
    at ariba.util.core.ClassUtil.classForName(ClassUtil.java:182)
    at ariba.ui.aribaweb.util.AWClassLoader.getClass(AWClassLoader.java:49)
    at ariba.ui.aribaweb.util.AWUtil.classForName(AWUtil.java:201)
    at ariba.ui.aribaweb.core.AWConcreteApplication.createApplication(AWConcreteApplication.java:145)
    at ariba.ui.servletadaptor.MyAWDispatcherServlet.createApplication(RimsAWDispatcherServlet.java:25)
    at ariba.ui.servletadaptor.AWDispatcherServlet.init(AWDispatcherServlet.java:54)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:]
    ... 246 more
Caused by: java.lang.ClassCastException: org.jboss.logmanager.log4j.BridgeLogger cannot be cast to ariba.util.log.Logger
    at ariba.util.log.Log.(Log.java:90)

The exception happening on ariba.util.log.Log.java class with following lines


public static final Logger startup =
        (Logger)Logger.getLogger("startup");

I dont know about JBoss logging configuration. Is there is any logger in JBoss AS7 which have same name as "startup"?. or is there is any configuration to solving this?

Was it helpful?

Solution

This is due to Logger implementation conflict of aribaweb and JBoss AS7.

JBoss AS7 supports Log4J implementation by default. But in the case of JBoss AS7 server org.apache.log4j.Logger class is wrapped by its own implementation which is org.jboss.logmanager.log4j.BridgeLogger. In the case of aribaweb org.apache.log4j.Logger class is wrapped by aribas implementation (ariba.util.log.Logger). For resolving this issue you need to remove the JBoss AS7's log4j module dependency from your war file. For that you need to create a jboss-deployment-structure.xml file with following lines of codes


<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
  <deployment>
    <exclusions>
        <module name="org.apache.log4j" />
    </exclusions>
  </deployment>
</jboss-deployment-structure>

and you need to deploy this file in META-INF folder of your war file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top