Beware of StringUtils.containsIgnoreCase method in weblogic10.3

In one of the web applications we use Apache commons-lang API version 2.3. We have put this library as part of web-inf/lib of the web application. But Weblogic10.3 also has it own version(2.1.0) under $BEA_home\module folder. So there was a conflict but weblogic would not throw any error :) We use StringUtils.containsIgnorecase() in one of the java classes. When this method is getting called weblogic simply hung.

So we had to tell weblogic to load classes from web-inf not from original class loader. So in weblogic.xml we need to set prefer-web-inf-classes flag to true. This tells weblogic to load classes from web-inf folder first.

weblogic.xml:

    <container-descriptor>
      <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>   

This fixed the issue. I will take that.

P.S:  For some web applications doing the above change might not help. In that case, commons-lang-2.4.jar needs to be added to PRE_CLASSPATH in domain's setDomainEnv.cmd. This should fix the issue.
set PRE_CLASSPATH=C:\temp\commons-lang-2.4.jar;
If you are running as a windows service, the jar needs to be added to beginning of the classpath.

1 comment: