List of Class Loader in Weblogic
System Class Loader - Weblogic Classes in weblogic system directory
Domain Class Loader - Domain Classes in domain directory
Application Class Loader - Library from Weblogic-application.xml , APP-INF/lib
WEB APP Class loader - Library from weblogic.xml , WEB-INF/lib , WEB-INF/classes
JSP class loader
Class Conflict
Until Weblogic 10.3.4 there was no tool available in weblogic to identify class conflict. However , Now weblogic has a tool called CAT (Classloader Analysis Tool) to perform class conflict check.
Let us say you have class call ClassLoadingExample.class in your Ear Application $CLASSPATH.
Also, you have same class in $CLASSPATH of weblogic.
So when you run the application then Weblogic class will be considered ,not the EAR one giving you surprising result.
Filtering Class Loader
This provide us option to configure our deployment description to make sure that our WAR/EAR class are loaded ,not the one in weblogic.
FilteringClassLoader sits between Application and System Class loader. It is child of System Class Loader and Parent of Applicatino Class Loader.
FilteringClassLoader intercept loadClass method and compare className with list of package specified in weblogic-application.xml file. If package matches class name , FilteringClassLoader throws ClassNotFoundException. This exception notifies applicatino classloader to load class from application.
Configure Filtering Class Loader
Add
prefer-application-packages description in weblogic-applicatino.xml which detail is of package to be loaded from application.
<prefer-application-packages>
<package-name>thirdparty package in your application which may be in weblogic</package-name>
</prefer-application-packages>
Installing CAT
CAT is a Web-based class analysis tool provided by weblogic and we need to deploy wls-cat.war which is located in “WL_HOME
/server/lib/wls-cat.war”
After deploying it can be accessed in.
http://weblogichost:port/wls-cat/
CAT Display all currently running applications and modules.
You can use this tool to check
Classloading conflicts , Check system and application classloaders and even generate report. For further information please refer to oracle documentation.
For me wls-cat.war is located in
I login to weblogic console
Install war as application , not as lib.
Finally deployed with following context
Go to testing and access the application.
CAT TOOL GUI
We can use this “Analyze Conflict” , Generate Report etc.
Click analyze conflict. It showed me conflicting classes and gave me suggested solution that I can use in my weblogic-application.xml or weblogic.xml.
No comments:
Post a Comment