[GIS] AutomationException: 0x80040228 – The Product License has not been initialized

agent-analystarcobjectsjavalicense

After installation of Java SDK for ArcGIS version 10.0, authorization of the SDK I still can't run the simple code in agent analyst:

def IWorkspace():

self.IAoInitialize = AoInitialize()

self.IAoInitialize.initialize
(self.esriLicenseProductCode.esriLicenseProductCodeArcInfo)
self.IAoInitialize.shutdown();

self.IWorkspaceFactory = FileGDBWorkspaceFactory();

self.IFeatureWorkspace = IFeatureWorkspaceProxy(self.IWorkspaceFactory.openFromFile(self.dataPath, 0));

when running the agent analyst it fails executing last line:

Exception in thread "Thread-14" AutomationException: 0x80040228 - The Product License has not been initialized. in 'ESRI GeoDatabase'
    at com.esri.arcgis.datasourcesGDB.FileGDBWorkspaceFactory.openFromFile(Unknown Source)
    at default_package.GISModel.IWorkspace(Unknown Source)
    at default_package.GISModel._schedule2(Unknown Source)
    at BAB_SYNTH_6.execute(Unknown Source)
    at uchicago.src.sim.engine.ScheduleGroup.execute(ScheduleGroup.java:81)
    at uchicago.src.sim.engine.RandomScheduleGroup.execute(RandomScheduleGroup.java:52)
    at uchicago.src.sim.engine.Schedule.execute(Schedule.java:349)
    at uchicago.src.sim.engine.BaseController$1.run(BaseController.java:397)
    at java.lang.Thread.run(Thread.java:619)

What should I do?

Best Answer

You appear to be binding to an ArcGIS product before calling initialize.

Call RuntimeManager.Bind(ProductCode.Desktop) before calling AoInitilize.Initialize.

Related Question