In the ArcObjects 10.8.1 (Java) code, initialized ArcGIS Server license.
_aoInitialize.initialize(esriLicenseProductCode.esriLicenseProductCodeArcServer);
Trying to open a Personal Geodatabase using the below Esri provided code snippet.
[Java]
//For example, pathToFile= "C:\\myData\\mypGDB.mdb".
static IWorkspace openFromFile_pGDB_Workspace(String pathToFile)throws Exception{
IWorkspaceFactory workspaceFactory = new AccessWorkspaceFactory();
return workspaceFactory.openFromFile(pathToFile, 0);
}
Getting an exception as below.
AutomationException: 0x80040154 - Class not registered
at com.esri.arcgis.interop.NativeObjRef.init(Unknown Source)
at com.esri.arcgis.interop.NativeObjRef.<init>(Unknown Source)
at com.esri.arcgis.interop.Dispatch.createDispatch(Unknown Source)
at com.esri.arcgis.interop.Dispatch.<init>(Unknown Source)
at com.esri.arcgis.geodatabase.IWorkspaceFactoryProxy.<init>(Unknown Source)
at com.esri.arcgis.datasourcesGDB.AccessWorkspaceFactory.<init>(Unknown Source)
at com.esri.arcgis.datasourcesGDB.AccessWorkspaceFactory.<init>(Unknown Source)
Where as, the below code for File Geodatabase was WORKING FINE with out any issue.
[Java]
//For example, pathToFile= "C:\\myData\\myfGDB.gdb".
static IWorkspace openFromFile_fGDB_Workspace(String pathToFile)throws Exception{
IWorkspaceFactory workspaceFactory = new FileGDBWorkspaceFactory();
return workspaceFactory.openFromFile(pathToFile, 0);
}
As per the API documentation, AccessWorkspaceFactory is available with ArcGIS Server too. Then what could be the reason for exception?
Can someone throw some light here.