Select to view content in your preferred language

Need some help on evaluating the Automation Exception in Network Analysis

1928
15
03-24-2013 11:42 PM
pavan_kumarmuttigi
Emerging Contributor
Hi,

Can any one please help me evaluating the following Automation Exception I am getting while I am trying to get the state of Network Dataset through the INALocator reference in arcobjects Java.

The following is the Exception I am getting.


AutomationException: 0x80004001 - Not implemented
at com.esri.arcgis.interop.Dispatch.vtblInvoke(Unknown Source)
at com.esri.arcgis.geodatabase.INetworkDatasetProxy.getState(Unknown Source).


Thanks in Advance.
0 Kudos
15 Replies
LeoDonahue
Deactivated User
Plus.. in Java:  

String.valueOf(null); will debug with the line of error using the JDK.

which is:

Exception in thread "main" java.lang.NullPointerException
    at java.lang.String.<init>(String.java:177)
    at java.lang.String.valueOf(String.java:2840)
    at AimsConnectDemo.main(AimsConnectDemo.java:20)


If you check the Java Source code for the String class, you will find that line 177 tries to the get length of null.  But this is probably not related to Pavan's issue - I hope.


Unknown source seems like an appropriate error message since it could be that Pavan's network dataset might not have been created properly?  I can only point people in certain directions, they have to figure out the rest.
0 Kudos
JasonPike
Frequent Contributor
Plus.. in Java:  

String.valueOf(null); will debug with the line of error using the JDK.

which is:

Exception in thread "main" java.lang.NullPointerException
    at java.lang.String.<init>(String.java:177)
    at java.lang.String.valueOf(String.java:2840)
    at AimsConnectDemo.main(AimsConnectDemo.java:20)


If you check the Java Source code for the String class, you will find that line 177 tries to the get length of null.  But this is probably not related to Pavan's issue - I hope.

Unknown source seems like an appropriate error message since it could be that Pavan's network dataset might not have been created properly?  I can only point people in certain directions, they have to figure out the rest.


Leo,

I agree that the exception in the article I linked to has nothing to do with Pavan's issue. I was just confused when you mentioned "Unknown source" as something that helped identify the problem. You have correctly pointed out that it is probably an incorrect initialization of the object that is the root of the problem.

I still think "(Unknown source)" is a red herring--the contents parentheses after the stack frame information is used to give the source code file name (e.g. String.java) and the line number in that source file. When it says "Unknown source", that indicates that the runtime doesn't know the name of the source code file or the line number in that source code file for that particular stack frame.

Sorry for detracting from the actual problem and creating noise on the thread--I'm just trying to learn from how the senior members, like yourself, analyze problems so that I can be a better problem solver.
0 Kudos
LeoDonahue
Deactivated User

Sorry for detracting from the actual problem and creating noise on the thread--I'm just trying to learn from how the senior members, like yourself, analyze problems so that I can be a better problem solver.

No noise, no detractions, no worries.  I hope you don't think I was nitpicking.

I think it means the origination of the exception is unknown at the time.
http://docs.oracle.com/javase/6/docs/api/java/lang/Exception.html
0 Kudos
pavan_kumarmuttigi
Emerging Contributor
Hi Leo Donahue,

I am creating the NAContext reference through  ArcGIS Map Service through the naLayer reference like in the following way

INAContext naContext = naLayer.getContext();

And I am not setting the LocatorByRef to naLocator.
BTW, I am not adding any LocatorAgent to my naLocator reference.I am justing setting the snapTolerance for naLocator like in the
following way.

naLocator.setSnapTolerance(0.005);


Let me know if any information needed in order to help me in resolving the issue.


Thanks in Advance.
0 Kudos
LeoDonahue
Deactivated User
Have you checked out the java sample in the ArcObjects Developer Kit samples from the install?  This method shows how ESRI created an instance of the NetworkDataset object.  It might help you to compare this to your code.

 /**
  * Solves a route based on specified network dataset and stops fc
  * @param workspacePath
  * @param inputStopsFC
  * @param shapeInputNameField
  * @param networkDatasetName
  * @param outLayerPath
  */
 public void solveRoute(
   String workspacePath
   ,String inputStopsFeatureDataset, String inputStopsFC
   ,String shapeInputNameField
   ,String networkDatasetFeatureDataset, String networkDatasetName
   ,String outLayerPath
 ){
  // Open the feature workspace, input feature class, and network dataset
  try
  {
   //open file geodatabase
   IWorkspaceFactory workspaceFactory = new FileGDBWorkspaceFactory();
   IFeatureWorkspace featureWorkspace = new IFeatureWorkspaceProxy(workspaceFactory.openFromFile(workspacePath, 0));
   //open input feature class
   IFeatureDataset featureDataset = featureWorkspace.openFeatureDataset(inputStopsFeatureDataset);
   IFeatureClassContainer inputStopsFeatureCC = new IFeatureClassContainerProxy(featureDataset);
   IFeatureClass inputStopsFClass = inputStopsFeatureCC.getClassByName(inputStopsFC);
   
   //open network dataset
   featureDataset = featureWorkspace.openFeatureDataset(networkDatasetFeatureDataset);
   IFeatureDatasetExtensionContainer fdsExtCont = new IFeatureDatasetExtensionContainerProxy(featureDataset);
   IFeatureDatasetExtension fdsExt = fdsExtCont.findExtension(esriDatasetType.esriDTNetworkDataset);
   IDatasetContainer2 dsCont = new IDatasetContainer2Proxy(fdsExt);
   
   IDataset dataset = dsCont.getDatasetByName(esriDatasetType.esriDTNetworkDataset, networkDatasetName);
   NetworkDataset networkDataset = new NetworkDataset(dataset);
   
   // Create the Route NALayer
   INALayer naLayer = createRouteAnalysisLayer("Route", networkDataset);
   INAContext naContext = naLayer.getContext();
   INAClass stopsNAClass = (INAClass) naContext.getNAClasses().getItemByName("Stops");
   // Load the Stops
   INAClassFieldMap naClassFieldMap = new NAClassFieldMap();
   naClassFieldMap.setMappedField("Name", shapeInputNameField);
   INAClassLoader naLoader = new NAClassLoader();
   naLoader.setLocatorByRef(naContext.getLocator());
   naLoader.setNAClassByRef(stopsNAClass);
   naLoader.setFieldMapByRef(naClassFieldMap);
   int[] rowsInCursor = { 0 };
   int[] rowsLocated = { 0 };
   ITrackCancel cancelTracker = new CancelTracker();
   FeatureCursor cursor = new FeatureCursor(inputStopsFClass.search(new QueryFilter(), false));
   naLoader.load(cursor, cancelTracker, rowsInCursor, rowsLocated);
   // Solve
   INASolver naSolver = naContext.getSolver();
   naSolver.solve(naContext, new GPMessages(), cancelTracker);
   // Save the layer to disk
   saveLayerToDisk(naLayer, outLayerPath);
  }
  catch (Exception e)
  {
   e.printStackTrace();
  }
 }

0 Kudos
pavan_kumarmuttigi
Emerging Contributor
Hi Leo Donahue,

Actually what I did was , I followed the same sample code snippet which is there in ArcObjects Developer Kit samples install.I had
requirement like to get the state of NetworkDataset during the course running the solver.while I am trying to do that I am getting the above I mentioned exception.

So, can you please help me in resolving this issue?

Thanks in Advance.
0 Kudos