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.