Migration from 9.3 to 10.0 getting solver failure.

1047
1
12-02-2011 01:58 AM
Highlighted
New Contributor III
We migrated from ArcGIS 9.3. to 10.0 and we are using ODCostMatrix and RouteSolver API in our application using C++ (COM) API and seeing solver failure issue when we are requesting for either ODCostMatrix or RouterSolver. Code snippet and return value as follows.

     IGPMessagesPtr pGPMessages;
     if(hr == S_OK)
     {
       pGPMessages.CreateInstance(CLSID_GPMessages);
       if(m_bRNSolverCancel)
         hr = pSolver->Solve(m_pNAContext, pGPMessages, m_PtrTrackCancel, &isPartial);
       else
         hr = pSolver->Solve(m_pNAContext, pGPMessages, NULL, &isPartial);
     }

Here solver returns hr as -2147221230 (0x80040112).

we also added new code in before Checkout license as well. details as follows.

// New for ArcGIS 10.0
IArcGISVersionPtr ipVersion(CLSID_VersionManager);
VARIANT_BOOL succeeded = VARIANT_FALSE;
HRESULT hr = ipVersion->LoadVersion(esriArcGISEngine, L"10.0", &succeeded);

Let us know, if we are missing anything here.

Thanks in advance.

Regards,
Murali Choudari.
Tags (2)
Reply
0 Kudos
1 Reply
Highlighted
New Contributor III
This error suggests you have a licensing issue. Have you properly checked out the Network Analyst extension license before running your solves? Here is the general pattern for initialization and checking out the appropriate licenses:


  ::CoInitialize(NULL);
  {
    HRESULT hr;

    IArcGISVersionPtr ipVer(__uuidof(VersionManager)); 
    VARIANT_BOOL succeeded;
    if (FAILED(hr = ipVer->LoadVersion(esriArcGISEngine, CComBSTR(L"10.0"), &succeeded)))
      return hr;

    IAoInitializePtr ipAoInitialize(CLSID_AoInitialize);
    esriLicenseStatus ls;
    ipAoInitialize->Initialize(esriLicenseProductCodeArcInfo, &ls);
    ipAoInitialize->CheckOutExtension(esriLicenseExtensionCodeNetwork, &ls);

    // Do something else...e.g., solve in Network Analyst
 
    ipAoInitialize->Shutdown();
    ipAoInitialize = NULL;
  }

  // Uninitialize COM
  ::CoUninitialize();