Select to view content in your preferred language

CreateFeature : Class is not licensed for use (Exception from HRESULT: 0x80040112)

3799
2
01-10-2012 07:48 AM
RoobeshModi
Deactivated User
Hi,

We are trying to create a point into an existing point feature class using CreateFeature option. We are creating this in a Versioned geodatabase Arcgis 10

steps.
1. initialized ArcInfo license
2.opened workspace
3. Start an edit operation.
4. Performing edits

Public Shared Sub CreateFeature(ByVal featureClass As IFeatureClass, ByVal pnt As IPoint)
    
        Dim feature As IFeature = featureClass.CreateFeature()
        feature.Shape = pnt
        feature.Store()
    End Sub

5.Save the edit operation. To cancel an edit operation, the AbortEditOperation

We are getting error in step 4. at feature.Store() line.
The error message is :
Class is not licensed for use (Exception from HRESULT: 0x80040112)

we have a free ArcInfo license available during run time . But still we are getting the same error. Any help in resolving this problem is highly appreciated.

Thanks.
0 Kudos
2 Replies
JakeSkinner
Esri Esteemed Contributor
Do you have ArcFM enabled for this geodatabase?  If you do, I believe you have to initialize the ArcFM license.

http://forums.esri.com/Thread.asp?c=93&f=993&t=183747
0 Kudos
PallaviDubey
Deactivated User
Hi,

I am also facing the same issue while updating the feature. Everything goes fine until the code reaches feature.store().
It throws "Class is not licensed for use (Exception from HRESULT: 0x80040112)" error.
I have tried initializing the ArcFM license as well as suggested in above link. But it is not working for me. 😞

I m posting my code. Any help will be appriciated.

            IFeatureWorkspace pFeatureWorkspace = null;
            IWorkspace pWorkSpace = null;
            try
            {
                pWorkSpace = GetWorkSpace(strSdeVersionName);
                pFeatureWorkspace = pWorkSpace as IFeatureWorkspace;
               
                // Open the feature class to rematch.
                IFeatureClass featureClass = pFeatureWorkspace.OpenFeatureClass(strFeatureClassName);

                IWorkspaceEdit workspaceEdit = pFeatureWorkspace as ESRI.ArcGIS.Geodatabase.IWorkspaceEdit;
                bool isBeingEdited = workspaceEdit.IsBeingEdited();
                if (isBeingEdited)
                {
                    throw new Exception("Workspace is already being edited");
                }
                workspaceEdit.StartEditing(false);
                workspaceEdit.StartEditOperation();

                try
                {
                    ESRI.ArcGIS.Geodatabase.IQueryFilter pQueryFilter = (IQueryFilter)pSvrContext.CreateObject("esriGeoDatabase.QueryFilter");
                    pQueryFilter.WhereClause = strWhereClause;
                    ESRI.ArcGIS.Geodatabase.IFeatureCursor pFeatureCursor = featureClass.Search(pQueryFilter, false);

                    ESRI.ArcGIS.Geodatabase.IFeature pFeature = pFeatureCursor.NextFeature();
                    if (pFeature == null)
                    {
                        throw new Exception("Feature with " + strWhereClause + "could not be found/edited.");
                    }
                    while (pFeature != null)
                    {
                        foreach (KeyValuePair<string, string> keyValue in fieldValuePair)
                        {
                                pFeature.set_Value(pFeature.Fields.FindField(keyValue.Key), keyValue.Value);
                        }

                        pFeature.Store(); //Error is thrown at this line
                        if (UpdateOneFeatureOnly)
                            break;
                        pFeature = pFeatureCursor.NextFeature();
                    }
                    if (pFeatureCursor != null)
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureCursor);
                    workspaceEdit.StopEditOperation();
                    workspaceEdit.StopEditing(true);