cast from IFeatureClass to ISchemaLock  (ARCGIS)

Discussion created by frmap1 on Apr 23, 2013
Latest reply on Apr 23, 2013 by mbaird-esristaff

I'm programming with the ARCGIS Java SDK, in Eclipse.

I need to cast an IFeatureClass to an ISchemalock. This cast is supposed to be allowed. There is an example of this cast in:

However, when I try to perform this cast in my code, an exception appears:

Exception in thread "main" java.lang.ClassCastException: com.esri.arcgis.geodatabase.IFeatureClassProxy cannot be cast to com.esri.arcgis.geodatabase.ISchemaLock

Are you able to make this cast on an IFeatureClass ? Here is the code to perform this:
//Attempt to acquire an exclusive schema lock on the feature class.
ISchemaLock schemaLock = (ISchemaLock)featureClass;

I would appreciate if you could try this simple line of code in one of your programs, and let me know if you get an exception.

Keep me posted...