1

I tried to add a new field to an existing feature class using ArcObjects and Java. This is the code:

IFeatureClass FcTes=sdeConnexion.connectionSDE().openFeatureClass("name of feature class");
    IField testField=new Field();
    IFieldEdit testField2=(IFieldEdit2)testField;
    testField2.setName("symbol1");
    testField2.setAliasName("symbol1");
    FeatureClass FC=new FeatureClass(FcTes);
    ISchemaLock schemaLock = (ISchemaLock)FC;
    try{
    schemaLock.changeSchemaLock(esriSchemaLock.esriExclusiveSchemaLock);

    FcTes.addField(testField2);

    }catch(Exception e){
        e.printStackTrace();
    }
    finally{
        schemaLock.changeSchemaLock(esriSchemaLock.esriSharedSchemaLock);
    }

when I executed it, this exception fired:

AutomationException: 0x80040220 - The application is not licensed to create or modify schema for this type of data in 'Esri GeoDatabase' at com.esri.arcgis.interop.NativeObjRef.nativeVtblInvokeNative(Native Method) at com.esri.arcgis.interop.NativeObjRef.a(Unknown Source) at com.esri.arcgis.interop.NativeObjRef.a(Unknown Source) at com.esri.arcgis.interop.Dispatch.vtblInvoke(Unknown Source) at com.esri.arcgis.geodatabase.IClassProxy.addField(Unknown Source) at travaux.ConnectGeoDB2.main(ConnectGeoDB2.java:58)

Can anyone see what I did wrong?

I have ArcGIS 10.2 Advanced (Server and Desktop) and in my project I'm working with arcobject.jar of ArcGIS Server.

  • 1
    Please edit the question to contain the version of ArcGIS and license level. – Vince Oct 10 '15 at 23:21
  • I'have arcgis 10.2 advanced(server and desktop) and in my project i'm working with arcobject.jar of arcgis server – ahlemg Oct 12 '15 at 13:12
  • Please edit the question to contain critical details. It's not fair to those who would answer your question to need to mine the comments for this information. – Vince Oct 12 '15 at 13:31
  • As the answer below indicates, you must tell ArcObjects about you license(s). – Vince Oct 12 '15 at 13:34
1

Even if your ArcGIS license supports this particular feature (let's say you have an advanced license) you still need to specify the license level in your ArcEngine code. For example:

RuntimeManager.BindLicense(ProductCode.EngineOrDesktop, LicenseLevel.GeodatabaseUpdate);
-1

It seems like a licence issue. Please have a look at the following link: http://resources.esri.com/help/9.3/ArcGISengine/java/doc/06e45adf-ad58-4c3b-8f79-4300a1ce045d.htm

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.