Suppose your web application wants to load classes from its own class loader first without delegating to parent. Then the following simple configurations will help you to override default delegation pattern in BEA WebLogic (version 8.* or 10) and JBOSS 4.2.*.
Set <prefer-web-inf-classes> to true in WEB-INF/weblogic.xml of your war.
Read WebLogic Server application classloading for more information.
Set java2ParentDelegation to false in WEB-INF/jboss-web.xml as follows.
For more information about JBoss class loading, have a look at JBoss classloading configuration guide