'ClassDefNotFound exception' trying to use instanceof method - JBoss

Discussion created by Sagi_Gabay Employee on Oct 12, 2011

You might have developed an Event Listener and deployed your class into the \identityminder.ear\custom folder as documented. If your class will generate the following stack trace then continue reading this document to understand the reason for this problem:

2010-09-21 15:52:23,427 DEBUG [ims.tmt.eventlistener] Evaluating listeners: [com.eventlistener.AccountUnlockEventListener@1ee470d]
2010-09-21 15:52:23,427 INFO [ims.tasktrack.custom] Service com.eventlistener.AccountUnlockEventListener : Entering before
2010-09-21 15:52:23,427 DEBUG [ims.default] java.lang.NoClassDefFoundError java.lang.NoClassDefFoundError:
com/ca/identitymanager/provisioning/event/AccountUnlockEvent at com.eventlistener.AccountUnlockEventListener.before(AccountUnlock at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

The above error trace will take place if your event listener is using the java 'instanceof' method such as in this example:

if (evt instanceof AccountUnlockEvent ) {

In this example the Java Virtual Machine is trying to find the AccountUnlockEvent class so that it can compare your 'evt' object to confirm if it is an instance of that class. However, Java Virtual Machine under JBoss 4.2.3 is unable to compare the classes if they are deployed into two separate folders. If you happened to deploy your custom class into the 'custom' folder ( as documented ) and in case the 'AccountUnlockEvent' class is deployed in another folder then this comparison will fail with the above exception.

In that case you will need to move your custom class and deploy it in the \identityminder.ear\user_console.war\WEB-INF\classes to overcome this issue.

This information is also available on CA Support's web site as Tech Doc 556245:


Sagi Gabay
CA Technologies.