aspose file tools*
The moose likes BEA/Weblogic and the fly likes how to reset application classloader Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "how to reset application classloader" Watch "how to reset application classloader" New topic
Author

how to reset application classloader

shailesh pandit
Greenhorn

Joined: Jun 14, 2007
Posts: 2
hi,

i want reset the application classloader in weblogic.

when i tried following code in one of the servlet:



it gave output like this:

Hello, world

ClassLoader I am using :: 'weblogic.utils.classloaders.ChangeAwareClassLoader@16a8e18( finder: weblogic.utils.classloaders.CodeGenClassFinder@103d792, annotation: war@war, parent: weblogic.utils.classloaders.GenericClassLoader@13ec1db( finder: weblogic.utils.classloaders.CodeGenClassFinder@ff42c9, annotation: war@, parent: weblogic.utils.classloaders.GenericClassLoader@793536( finder: weblogic.utils.classloaders.CodeGenClassFinder@16e523d, annotation: ApplicationClassLoader@, parent: weblogic.utils.classloaders.GenericClassLoader@3cbb4b( finder: weblogic.utils.classloaders.CodeGenClassFinder@1d93f39, annotation: null, parent: sun.misc.Launcher$AppClassLoader@53ba3d))))'
System ClassLoader :: 'sun.misc.Launcher$AppClassLoader@53ba3d'

when i changed the servlet class and refreshed the page it gave following output:

Hello, world1

ClassLoader I am using :: 'weblogic.utils.classloaders.ChangeAwareClassLoader@1cb4cb5( finder: weblogic.utils.classloaders.CodeGenClassFinder@5c0662, annotation: war@war, parent: weblogic.utils.classloaders.GenericClassLoader@13ec1db( finder: weblogic.utils.classloaders.CodeGenClassFinder@ff42c9, annotation: war@, parent: weblogic.utils.classloaders.GenericClassLoader@793536( finder: weblogic.utils.classloaders.CodeGenClassFinder@16e523d, annotation: ApplicationClassLoader@, parent: weblogic.utils.classloaders.GenericClassLoader@3cbb4b( finder: weblogic.utils.classloaders.CodeGenClassFinder@1d93f39, annotation: null, parent: sun.misc.Launcher$AppClassLoader@53ba3d))))'
System ClassLoader :: 'sun.misc.Launcher$AppClassLoader@53ba3d'

see just the ChangeAwareClassLoader with annotation: war@war was reset i.e. got the new instance..
is there any way i can reset the application classloader with annotation: ApplicationClassLoader?

thanks in advance.

the purpose is to reload the any changed application class..
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6657
    
    5

You should go for an exploded deployment in order to automatically have the changed app deployed. The change aware classloader does that. The classloader should aldo be able to pick up changes to the EAR and auto deploy if needed.

Coding specific changes that depend on weblogic or class loader hierarchy can be dangerous


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
shailesh pandit
Greenhorn

Joined: Jun 14, 2007
Posts: 2
my weblogic 9 is in dev mode and the ear is exploded then also it does not pick the APP-INF/classes changes.
i guess the ApplicationClassLoader being not changeawareclassloader causing this..
(weblogic.utils.classloaders.GenericClassLoader@793536( finder: weblogic.utils.classloaders.CodeGenClassFinder@16e523d, annotation: ApplicationClassLoader@)

is ther some configuration change which will solve this..

or can you please give details of the coding method..

Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6657
    
    5

This is not a coding related change. Some EARs are known to have problems with exploded deployment. You will have to consult the weblogic user guide for more details. Coding / config changes to class loader hierarchy are a bad idea. It is hard enough trying to guess what classes weblogic loads at runtime since V 9.2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to reset application classloader
 
Similar Threads
classloader
Why getting ClassCastException?
Is this how I properly make it use my AppClassLoader?
access ejb from outside container
log4j.properties not found