Logger class cast exception in ariba with JBOSS AS7

267 views
Skip to first unread message

Anish Antony

unread,
Oct 28, 2013, 9:20:50 AM10/28/13
to arib...@googlegroups.com
Hi

When I run my ariba application with JBoss AS7 i got the following exception which related to ariba logger

java.lang.ExceptionInInitializerError
    at ariba.util.core.ClassUtil.classForName(ClassUtil.java:259) [ariba.util.jar:1.0-dev - 2010-05-11 18:50:11]
    at ariba.util.core.ClassUtil.classForName(ClassUtil.java:182) [ariba.util.jar:1.0-dev - 2010-05-11 18:50:11]
    at ariba.ui.aribaweb.util.AWClassLoader.getClass(AWClassLoader.java:49) [ariba.aribaweb.jar:1.0-dev - 2010-05-11 18:50:28]
    at ariba.ui.aribaweb.util.AWUtil.classForName(AWUtil.java:201) [ariba.aribaweb.jar:1.0-dev - 2010-05-11 18:50:28]
    at ariba.ui.aribaweb.core.AWConcreteApplication.createApplication(AWConcreteApplication.java:145) [ariba.aribaweb.jar:1.0-dev - 2010-05-11 18:50:28]
    at ariba.ui.servletadaptor.RimsAWDispatcherServlet.createApplication(RimsAWDispatcherServlet.java:21) [classes:]
    at ariba.ui.servletadaptor.AWDispatcherServlet.init(AWDispatcherServlet.java:54) [ariba.aribaweb.jar:]
    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.<clinit>(Log.java:90) [ariba.util.jar:1.0-dev - 2010-05-11 18:50:11]
    ... 254 more

Actually i dont want ariba logging so is there is any configuration to turn of ariba logging?
or can you please tell any another scenario to resolving above exception?

regards
Anish Antony

Frantisek Kolar

unread,
Oct 29, 2013, 5:33:51 AM10/29/13
to arib...@googlegroups.com
Hi Anish, 

Let me look at this. 

As you probably know you can disable logging for certain category but this error is something different and there are certain things that you can really disable. Like static initialization of classes, variables etc. which is this case. 

FK



--
You received this message because you are subscribed to the Google Groups "AribaWeb (aribaweb.org)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aribaweb+u...@googlegroups.com.
To post to this group, send email to arib...@googlegroups.com.
Visit this group at http://groups.google.com/group/aribaweb.
For more options, visit https://groups.google.com/groups/opt_out.

Anish Antony

unread,
Oct 29, 2013, 8:46:21 AM10/29/13
to arib...@googlegroups.com
Thanks František Kolář
 Here follows my finding about this problem
The logging on JBoss AS7 done by using Log4J. In JBoss AS 7 uses org.jboss.logmanager.log4j.BridgeLogger class for Logger implementation (the BridgeLogger class extends with org.apache.log4j.Logger). But in the case of ariba the logger classes are implemented by using ariba.util.log.Logger (Here also the ariba Logger class extends with org.apache.log4j.Logger). Also my Class cast exception happens on following lines of ariba.util.log.Log.class 

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

Do you have any idea to resolving this problem?

Frantisek Kolar

unread,
Oct 29, 2013, 9:28:10 AM10/29/13
to arib...@googlegroups.com
Hi, 

There should be csv files in the path which are usually inside the ariba.util.jar used to initialize the Logger. It should be the : ariba/util/log/PrivateLoggers.csc. If you do not have this then such exception is thrown. It does not have to be your case but something similar happened to me several time. 

You can check if you put an breakpoint into this method ariba.util.log.Logger. getLogger:

public static org.apache.log4j.Logger getLogger (String name)
    {
            // If we're in development mode and this logger is being created,
            // check to make sure it's listed as a public or private logger.
        if (SystemUtil.isDevelopment() && (LogManager.exists(name) == null)) {
            checkRegistration(name, true);
        }
        LoggerFactory factory = PrivateLoggers.getLoggerFactory(name); //////// HEREEEEEEE
        if (factory == null) {
            factory = myFactory;
        }
        return Logger.getLogger(name, factory);
    }


The  PrivateLoggers.getLoggerFactory(name); probably returns NULL. 

Can you check?

FK

On Oct 29, 2013, at 1:46 PM, Anish Antony <anishan...@gmail.com> wrote:

Thanks František Kolář
 Here follows my finding about this problem
The logging on JBoss AS7 done by using Log4J. In JBoss AS 7 uses org.jboss.logmanager.log4j.BridgeLogger class for Logger implementation (theBridgeLogger class extends with org.apache.log4j.Logger). But in the case of ariba the logger classes are implemented by using ariba.util.log.Logger (Here also the ariba Logger class extends with org.apache.log4j.Logger). Also my Class cast exception happens on following lines of ariba.util.log.Log.class 

Anish Antony

unread,
Oct 30, 2013, 1:58:27 AM10/30/13
to arib...@googlegroups.com
Thanks František Kolář
I checked it, and i got Null value  when PrivateLoggers.getLoggerFactory(name) executes. Also here i am attaching  PrivateLoggers.csv (inside ariba.util.jar) file in my application.
PrivateLoggers.csv

Anish Antony

unread,
Oct 30, 2013, 3:54:17 AM10/30/13
to arib...@googlegroups.com
Thanks František Kolář
with your support I got a solution for my problem, Here it follows
On my first post i mentioned that i am using Aribaweb application in JBOSS AS7 server. 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)

public static org.apache.log4j.Logger getLogger (String name)
    {
            // If we're in development mode and this logger is being created,
            // check to make sure it's listed as a public or private logger.
        if (SystemUtil.isDevelopment() && (LogManager.exists(name) == null)) {
            checkRegistration(name, true);
        }
        LoggerFactory factory = PrivateLoggers.getLoggerFactory(name);
        if (factory == null) {
            factory = myFactory;
        }
        return Logger.getLogger(name, factory);//Here
    }

So when i inspect the above lines of code the Logger.getLogger(name, factory) returns the logger object which is corresponding to JBoss (org.jboss.logmanager.log4j.BridgeLogger).

For resolving this issue i removed the JBoss AS7's log4j module dependecy from my war file. For that i created 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 i deployed that file in META-INF folder of my war file.

Frantisek Kolar

unread,
Oct 30, 2013, 4:51:38 AM10/30/13
to arib...@googlegroups.com
Hi Antony, 

Cool. You could probably leave the existing Bridge4Logger as it as, just to make sure that privateloggers does not return NULL than I think you would be fine. You just need to provide a few files I was talking about. 

-FK

Anish Antony

unread,
Oct 30, 2013, 6:16:11 AM10/30/13
to arib...@googlegroups.com



Hi František Kolář
In my code PrivateLoggers.getLoggerFactory(name) returns null because inside  getLoggerFactory(name) method there is no values on loggersMap object and i inspected on createMap () method in ariba.util.log.PrivateLoggers class (which is used to put values into loggersMap)  but here it satisfies the condition !PrivateLoggersFiles[i].exists() which results control not going into createMap(PrivateLoggersFiles[i], map) method inside createMap() method

private static Map createMap ()
    {
        try {
            Map map = MapUtil.map();
            for (int i=0; i<PrivateLoggersFiles.length; i++) {
                if (!PrivateLoggersFiles[i].exists()) {//Control going to inside this if condition
                    continue;
                }
                createMap(PrivateLoggersFiles[i], map);
            }
            return map;
        }

But when i inspect PrivateLoggersFiles i got following result.


Also I found the PrivateLoggers.csv file inside ariba.util.jar with package name ariba\util\log

Frantisek Kolar

unread,
Oct 30, 2013, 10:44:49 AM10/30/13
to arib...@googlegroups.com
I think those files are not in path. 


On Oct 30, 2013, at 11:16 AM, Anish Antony <anishan...@gmail.com> wrote:



Hi František Kolář
In my code PrivateLoggers.getLoggerFactory(name) returns null because inside  getLoggerFactory(name) method there is no values on loggersMap object and i inspected on createMap () method in ariba.util.log.PrivateLoggers class (which is used to put values intologgersMap)  but here it satisfies the condition !PrivateLoggersFiles[i].exists() which results control not going intocreateMap(PrivateLoggersFiles[i], map) method inside createMap() method

Thomas Abraham

unread,
Feb 8, 2018, 3:29:43 AM2/8/18
to AribaWeb (aribaweb.org)
I'm not sure if this is a connected problem, but I'm not able to get stack traces of exceptions in the console with aribaweb 5.2. Any pointers? The stack trace appears on screen but not on the console. However, the console prints INFO and DEBUG statements from hibernate, prints SQL statements etc.

All log4j settings are exactly the same as in the earlier versions. I tried building without the jboss-deployment xml which is now added into the release, since I do not use JBoss. But that also did not help.

There are changes to the util/log folder. But again, that does not look like the problem.

The util/resources has fewer locales than earlier builds. I use en_GB, which is missing. I added the resources from the earlier versions into the jar since there seems to have been some localising of messages. However, this too has not helped.

Regards
Thomas
Reply all
Reply to author
Forward
0 new messages