dhemsworth

geoprocessor.execute() AutomationException (java ArcObjects 10.2.1)

Discussion created by dhemsworth on Jan 29, 2014
We've got a process that worked up to the 10.2 update. It was a simple ArcPy script that Converted MXD to MSD, with some java to create a map server from the MSD and extracting JSON from a layer.

As of  the 10.2 update, it's broken and no longer functions due to the change from MSD's to SD's.

I think I've figured out the updates required to the Python code. I've updated the original Python code to create an SDDraft and an SD using the:

arcpy.mapping.CreateMapSDDraft(mapdoc, sddraft, "MPCM")

method, and staging using

arcpy.StageService_server(sddraft, sd)

However, this python script is in a Toolbox file, which is called by the Java code:

GeoProcessor gp = new GeoProcessor();
gp.setOverwriteOutput(true);
gp.addToolbox(toolBoxLocation);

VarArray params = new VarArray();
       
IPropertySet serverProps = serverPropertyMap.get(targetEnv);
params.add(mxdFilePath);
params.add(serverProps.getProperty(PropertyConstants.SERVER));
params.add(serverProps.getProperty(PropertyConstants.INSTANCE));
params.add(serverProps.getProperty(PropertyConstants.USER));
params.add(serverProps.getProperty(PropertyConstants.PASSWORD));

IGeoProcessorResult gpResult = gp.execute("ConvertMXDToSD", params, null);
        
ExtractLayerProcessor.checkForErrors(gpResult);


I haven't altered any of this code from the original, aside from updating the name of the python script from ConvertMXDToMSD to ConvertMXDToSD, however when the Java code is executed now the gp.execute call throws an "AutomationException: 0x80004005 - Unspecified error" error, and I'm having a hard time figuring out why.

I assumed it's a problem with the script, but the Python code doesn't appear to be throwing any errors (testing through PythonWin), but I don't think the python script is even being called before the AutomationException is thrown. I tried to run a built in geoprocessing tool (Buffer), just to see if that would work, and it failed with the same error.

I'm hoping someone has any suggestions I can try to figure out why this error keeps popping up! Thanks!

Outcomes