POST
|
Hello! Do you call EngineInitializer.initializeEngine() anywhere? You need to call this before you do AoInitialize. Thanks very much! I add EngineInitializer.initializeEngine() into the front of AoInitialize , but the same error. code : String workspacePath = arcGISHome + "/java/samples/data/usa"; String featureClassName = "states.shp"; File shapefileFile = new File(workspacePath, featureClassName); if (!shapefileFile.exists()) { System.out.println("Shapefile " + shapefileFile.getAbsolutePath() + " doesn't exist. Exiting."); System.exit(-1); } System.out.println("Shapefile: " + shapefileFile.getAbsolutePath()); try { EngineInitializer.initializeEngine() ; AoInitialize aoInitializer = new AoInitialize(); aoInitializer.initialize(esriLicenseProductCode.esriLicenseProductCodeEngine); ShapefileWorkspaceFactory shapefileWorkspaceFactory = new ShapefileWorkspaceFactory(); Workspace workspace = new Workspace(shapefileWorkspaceFactory.openFromFile(workspacePath, 0)); FeatureClass featureClass = new FeatureClass(workspace.openFeatureClass(featureClassName)); int numFeatures = featureClass.featureCount(null); System.out.println("There are " + numFeatures + " features:"); for (int i = 0; i < numFeatures; i++){ IFeature feature = featureClass.getFeature(i); IGeometry geometry = feature.getShapeCopy(); System.out.println("Feature " + i + ": "); System.out.println(getStringFromShape(geometry)); if (i >= 9) { break; // 10 is enough } } aoInitializer.shutdown(); System.out.println("Sample finished."); } catch (Exception e) { e.printStackTrace(); } error: "AutomationException: 0x80004005 - Unspecified error". at com.esri.arcgis.geodatabase.Workspace.openFeatureClass(Unknown Source)
... View more
03-26-2011
12:42 AM
|
0
|
0
|
118
|
POST
|
I use arcengine for java in linux operation. The exception I got was "AutomationException: 0x80004005 - Unspecified error". My product version is arcengine 9.3 java for linux. error in at com.esri.arcgis.geodatabase.Workspace.openFeatureClass(Unknown Source) code { String workspacePath = arcGISHome + "/java/samples/data/usa"; String featureClassName = "states.shp"; File shapefileFile = new File(workspacePath, featureClassName); if (!shapefileFile.exists()) { System.out.println("Shapefile " + shapefileFile.getAbsolutePath() + " doesn't exist. Exiting."); System.exit(-1); } System.out.println("Shapefile: " + shapefileFile.getAbsolutePath()); try { AoInitialize aoInitializer = new AoInitialize(); aoInitializer.initialize(esriLicenseProductCode.esriLicenseProductCodeEngine); ShapefileWorkspaceFactory shapefileWorkspaceFactory = new ShapefileWorkspaceFactory(); Workspace workspace = new Workspace(shapefileWorkspaceFactory.openFromFile(workspacePath, 0)); FeatureClass featureClass = new FeatureClass(workspace.openFeatureClass(featureClassName)); int numFeatures = featureClass.featureCount(null); System.out.println("There are " + numFeatures + " features:"); for (int i = 0; i < numFeatures; i++){ IFeature feature = featureClass.getFeature(i); IGeometry geometry = feature.getShapeCopy(); System.out.println("Feature " + i + ": "); System.out.println(getStringFromShape(geometry)); if (i >= 9) { break; // 10 is enough } } aoInitializer.shutdown(); System.out.println("Sample finished."); } catch (Exception e) { e.printStackTrace(); } } why use workspace.openFeatureClass in some errors,the shapefile's path and name is correct . Any solution or workaround this? Thank you very much in advance
... View more
03-25-2011
07:51 PM
|
0
|
2
|
484
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|