Archive for the ‘java’ Category

Interview with Jython Lead

Wednesday, October 21st, 2009

Just came across this excellent interview with Frank Wierzbicki, who now leads the Jython Development.

Interview can be found here

Find a class in plethora of jars in a directory with JarScan

Thursday, September 17th, 2009

Recently I had to find a jar which contains a java class I was looking for. Previously I was using other utilities like Jarfinder, FindClass etc, but wasn’t very happy.  (more…)

Jython 2.2 in WebLogic 11g

Friday, August 21st, 2009

I just started playing around with WebLogic Server 11g and realised that Oracle has upgraded Jython from 2.1 to 2.2, very nice!

(more…)

WebLogic EmbeddedLDAP's MasterFirst Attribute saved my day!

Monday, August 10th, 2009

While provisioning WebLogic environments to a new infrastructure, recently we started experiencing a problem where the Managed Server had problems starting up. It consistently failed with the error shown below. (more…)

How are python.cachedir and the error "*sys-package-mgr*: can't create package cache dir" are related

Tuesday, August 4th, 2009

While starting WLST or for that matter Jython, you might have seen this annoying error message,

*sys-package-mgr*: can’t create package cache dir, ‘/tmp/cachedir/packages’
Traceback (innermost last):
File “<iostream>”, line 12, in ?
ImportError: no module named java

(more…)

My takeaways from Oracle Fusion Middleware 11g Forum

Wednesday, July 29th, 2009

I attended the Oracle Fusion Middleware 11g Forum in Bridgewater, NJ. It was a pretty informational session and I got to talk directly to Oracle management about some questions I had regarding Oracle’s Portal and JVM Strategies. (more…)

Default protocol in WebLogic and why is it important

Sunday, July 26th, 2009

If your WebLogic Server makes outbound connections to other systems it is wise to know what a DefaultProtocol is. Generally, when you create a WebLogic domain and haven’t configured SSL you will not have to do anything. (more…)

In case you run into this issue …

Saturday, February 18th, 2006

While upgrading our WLS console to use the latest libraries i.e. to use the latest Struts, Beehive, WebLogic Portal versions. I ran into this problem that caught me completely off gaurd and took me a while to figure whats going on. Struts 1.2.7 distribution comes with commons logging 1.0.4 and log4j 1.2.8. Once I upgraded our console to struts 1.2.7 and tried to deploy it to the server the deployment failed with the error below.

java.lang.NoSuchMethodError: isEnabledFor
······at org.apache.commons.logging.impl.Log4JCategoryLog.isErrorEnabled(Log4JCategoryLog.java:189)
······at org.apache.beehive.netui.util.logging.Logger.isErrorEnabled(Logger.java:97)
······at org.apache.beehive.netui.pageflow.internal.AdapterManager.getServletContainerAdapter(AdapterManager.java:47)
······at org.apache.beehive.netui.pageflow.PageFlowUtils.createURLTemplatesFactory(PageFlowUtils.java:1716)

Well, initially I thought this is caused due to another version of commons-logging.jar lurking around somewhere in the system classpath and is being picked up by the application. But after carefully reviewing the classpath and other libraries in the application I did not find any foul play, this just drove me crazy. Thought I would instrument the Log4JCategoryLog class to see what methods it is seeing in “org.apache.log4j.Category” that is making it to fail with NSME. After compiling and re-packaging it in commons-logging.jar to my surprise everything worked as normal. I could see my debug output that I put in while instrumenting Log4jCategoryLog. At this point it made me think if the class file packaged in commons-logging.jar is erroneous. To prove that I had to isolate the problem to just commons-logging and log4j. Thanks to another colleague, this simple reproducer revealed the issue.

public class Foo {
···// Ensure that your classpath has commons-logging-1.0.4.jar and log4j-1.2.8.jar
···public static void main(String[] args) {
······org.apache.commons.logging.impl.Log4JCategoryLog x = new org.apache.commons.logging.impl.Log4JCategoryLog();
······x.isErrorEnabled();
···}
}

This simple client failed with the exact same error I was seeing while deploying the console. I believe the problem is the classes in commons-logging-1.0.4 that come from apache have been compiled with the wrong log4j Category class.
If you do javap -c org.apache.commons.logging.impl.Log4JCategoryLog with commons-logging-1.0.4.jar in classpath you will see that for isErrorEnabled method,

public boolean isErrorEnabled();
Code:
0: aload_0
1: getfield #7; //Field category:Lorg/apache/log4j/Category;
4: getstatic #14; //Field org/apache/log4j/Level.ERROR:Lorg/apache/log4j/Level;
7: invokevirtual #17; //Method org/apache/log4j/Category.isEnabledFor:(Lorg/apache/log4j/Level;)Z
10: ireturn

Here the log4j’s Category’s isEnabledFor takes Level as an argument, but Log4JCategoryLog is expecting an object of type Priority. If I re-compile Log4JCategoryLog and re-package it and do a javap -c on the class I get,

public boolean isErrorEnabled();
Code:
0: aload_0
1: getfield #2; //Field category:Lorg/apache/log4j/Category;
4: getstatic #9; //Field org/apache/log4j/Priority.ERROR:Lorg/apache/log4j/Priority;
7: invokevirtual #12; //Method org/apache/log4j/Category.isEnabledFor:(Lorg/apache/log4j/Priority;)Z
10: ireturn

As you see the log4j’s Category’s isEnabledFor method takes an object of type Priority as an argument which is right. After googling a little bit I found that this has been corrected with the new commons-logging jar available at http://www.ibiblio.org/maven/commons-logging/jars/commons-logging-1.1-dev.jar.

_uacct = “UA-2684269-2″;
urchinTracker();