Failed to Start Local Server

5043
11
Jump to solution
02-18-2015 09:28 AM
VijdanDemir
New Contributor III

Hello, I am new at using ArcGis runtime sdk 10.2.3 for Qt. I am trying MyFirstMap application.   It gives :     failed to start local server runtime in the following locations: /ArcGISRuntime10.2.3/LocalServer32/bin   "USCitiesStates.mpk failed to start" Failed to create local service.  

  My license status: 2

My license level : 1  

  What can be the problem? I am working on Ubuntu 12.04.

I enabled server logging from the LocalServerUtility but there ar no log files under /tmp.

0 Kudos
1 Solution

Accepted Solutions
VijdanDemir
New Contributor III

Finally, I have solved my problem.

I add the ARCGISRUNTIMESDKQT_10_2_3="/home..", RUNTIMEHOME="/home/..", ARCH="64" to the /etc/environment file

and restart  computer. It works.

I think running ./init_sdk_qt64.sh before opening Qt Creator does not  work so I was getting the errors.

By adding the variable to /etc/environment it is ok.

But I have one small question more:

I tried the code on two different machines.

The code on desktop pc  works  successfully.

The code on leptop starts server but gives the error " USCitiesStates.mpk failed to start. Failed to create local service."   Any idea ?

Thank in advance.

View solution in original post

0 Kudos
11 Replies
JeanneTrieu
Occasional Contributor

Hi Vijdan,

can you try the local Dynamic Layer sample and see and let us know if the layer loads?

Can you also share your code?

Thanks,

Jen Trieu | Product Eng.

0 Kudos
VijdanDemir
New Contributor III

Hi Jeanne,

I tried local Dynamic Layer sample from the QtSampleApplication.sh. It loaded layer.

But when I opened a new project from the Qt Creator then the error above occurs.

The code below comes automatically when we create a new arcgis qt project from the Qt Creator.

My Code MyFirstMap.cpp is:

// Copyright 2014 ESRI

//

// All rights reserved under the copyright laws of the United States

// and applicable international laws, treaties, and conventions.

//

// You may freely redistribute and use this sample code, with or

// without modification, provided you include the original copyright

// notice and use restrictions.

//

// See the Sample code usage restrictions document for further information.

//

#include "MyFirstMap.h"

#include "MapGraphicsView.h"

#include "ArcGISRuntime.h"

// Uncomment if needed

#include "Graphic.h"

#include "SimpleMarkerSymbol.h"

#include "Point.h"

//#include "ServiceInfoTask.h"

//#include "GeodatabaseFeatureServiceTable.h"

MyFirstMap::MyFirstMap(QWidget *parent)

    : QMainWindow(parent)

{

    // set to openGL rendering

    EsriRuntimeQt::ArcGISRuntime::setRenderEngine(EsriRuntimeQt::RenderEngine::OpenGL);

    m_mapGraphicsView = EsriRuntimeQt::MapGraphicsView::create(m_map, this);

    setCentralWidget(m_mapGraphicsView);

    m_map.setWrapAroundEnabled(false);

    // show Esri logo by default

    m_map.setEsriLogoVisible(true);

    QString path = EsriRuntimeQt::ArcGISRuntime::installDirectory();

    printf("PATH :: %s\n", path.toLatin1().data());

    path.append("/home/adnan/arcgis/runtime_sdk/qt10.2.3/sdk/samples/data");

    QDir dataDir(path); // using QDir to convert to correct file separator

    QString pathSampleData = dataDir.path() + QDir::separator();

    //// ArcGIS Online Tiled Basemap Layer

   // m_tiledServiceLayer = EsriRuntimeQt::ArcGISTiledMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");

   // m_map.addLayer(m_tiledServiceLayer);

    //// Local Tiled Basemap Layer using: sdk/samples/data/tpks/Topographic.tpk

  /* QString tiledBaseMapLayer = pathSampleData + "tpks" + QDir::separator() + "Topographic.tpk";

   m_tiledLayer = EsriRuntimeQt::ArcGISLocalTiledLayer(tiledBaseMapLayer);

   m_map.addLayer(m_tiledLayer);

    //// ArcGIS Online Dynamic Map Service Layer

    m_dynamicServiceLayer = EsriRuntimeQt::ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapSe...");

    m_map.addLayer(m_dynamicServiceLayer);*/

//Local Dynamic Layer using: sdk/samples/data/mpks/USCitiesStates.mpk

  QString dataPath = pathSampleData + "mpks" + QDir::separator() + "USCitiesStates.mpk";

  printf("DATA: %s\n", dataPath.toLatin1().data());

  m_localMapService = EsriRuntimeQt::LocalMapService(dataPath);

  // connect to signal that is emitted when the service is created successfully

  connect(&m_localMapService, SIGNAL(serviceCreationSuccess(const QString&, const QString&)), this, SLOT(onLocalServiceCreationSuccess(const QString&, const QString&)));

  // connect to signal that is emitted when the service failed

  connect(&m_localMapService, SIGNAL(serviceCreationFailure(const QString&)), this, SLOT(onLocalServiceCreationFailure(const QString&)));

  printf("start oncesi\n");

  // start the service and the Local Server

  EsriRuntimeQt::LocalServiceStatus  serst = m_localMapService.startAndWait();

   printf("SR STATUS = %d\n", serst );

    // Graphics Layer

  EsriRuntimeQt::Point point1(0, 0);

  EsriRuntimeQt::SimpleMarkerSymbol redCircle(Qt::red, 8, EsriRuntimeQt::SimpleMarkerSymbolStyle::Circle);

  EsriRuntimeQt::Graphic graphic1(point1, redCircle);

  m_graphicsLayer.addGraphic(graphic1);

  m_map.addLayer(m_graphicsLayer);

    //// connect to signal that is emitted when the map is ready

    //// the mapReady signal is emitted when the Map has obtained a

    //// spatial reference from an added layer

    // connect(&m_map, SIGNAL(mapReady()), this, SLOT(onMapReady()));

}

MyFirstMap::~MyFirstMap()

{

    // stop the Local Map Service

    /*

  if(m_localMapService.status() == EsriRuntimeQt::LocalServiceStatus::Running)

     m_localMapService.stopAndWait();

  */

    // stop the Local Feature Service

    /*

  if(m_localFeatureService.status() == EsriRuntimeQt::LocalServiceStatus::Running)

    m_localFeatureService.stopAndWait();

  */

    // stop the Local Server Instance for local service

    /*

  if (EsriRuntimeQt::LocalServer::instance().isRunning())

    EsriRuntimeQt::LocalServer::instance().shutdownAndWait();

  */

    //// disconnect signals for Local Map Service

    //disconnect(&m_localMapService, SIGNAL(serviceCreationSuccess(const QString&, const QString&)), this, SLOT(onLocalServiceCreationSuccess(const QString&, const QString&)));

    //disconnect(&m_localMapService, SIGNAL(serviceCreationFailure(const QString&)), this, SLOT(onLocalServiceCreationFailure(const QString&)));

    //// disconnect signals for Feature Service

    //disconnect(&m_localFeatureService, SIGNAL(serviceCreationSuccess(const QString&, const QString&)), this, SLOT(onFeatureServiceCreationSuccess(const QString&, const QString&)));

    //disconnect(&m_localFeatureService, SIGNAL(serviceCreationFailure(const QString&)), this, SLOT(onFeatureServiceCreationFailure(const QString&)));

    // disconnect signal for Map

    //disconnect(&m_map, SIGNAL(mapReady()), this, SLOT(onMapReady()));

    m_map.dispose();

    delete m_mapGraphicsView;

}

void MyFirstMap::onLocalServiceCreationSuccess(const QString& url, const QString& name)

{

  Q_UNUSED(url);

  Q_UNUSED(name);

    printf("AAA");

    printf("%s", name.toLatin1().data());

   // create the ArcGISDynamicMapServiceLayer using the LocalMapService's url

   m_dynamicLocalServiceLayer = EsriRuntimeQt::ArcGISDynamicMapServiceLayer(m_localMapService.urlMapService());

   m_map.addLayer(m_dynamicLocalServiceLayer);

}

void MyFirstMap::onLocalServiceCreationFailure(const QString& name)

{

    printf("%s", name.toLatin1().data());

  qWarning() << name + " failed to start";

  qWarning() << m_localMapService.error().what();

}

Thanks,

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Vijdan-

Did you set a client id and license? If so, try commenting it out while you are testing, as the developer mode will give you all capabilities. If you did license your app, it will need a Standard license to use local server - License your app—ArcGIS Runtime SDK for Qt | ArcGIS for Developers . However, like I said, you can just not set a client id/license while developing your app.

Also, are you using 32-bit Linux?

Thanks,

Luke

0 Kudos
VijdanDemir
New Contributor III

Hi Luke,

I am using 64 - bit linux. (Ubuntu 12.04.1)

Firstly I did not set client id.But in this case, it also did not work.

Secondly I tried to  set client id.But in this case, it also did not work.

I tried many things. The error goes on.

0 Kudos
VijdanDemir
New Contributor III

Hi again,

Although I am using 64 bit system and I run init_sdk_qt64.sh before running my exe. It countinues to

say failed to start local server runtime in the following locations: /ArcGISRuntime10.2.3/LocalServer32/bin

At least it must say /LocalServer64.

help please.. Is there any way to start local server directly.?? I tried  the local server examples under QtSampleApplication. they  work correctly. I also copy my exe in QtSampleApplication folder. but it does not work.

0 Kudos
SachinKanaujia
Occasional Contributor III

Can you check if you have the 32 bit or a 64 bit version of QT installed? Somewhere its not picking up things correctly. Why is it going for a 32 bit Local Server?

0 Kudos
VijdanDemir
New Contributor III

Yes I am sure I set up qt-enterprise-5.1.1-linux-x86_64-offline.run..

0 Kudos
VijdanDemir
New Contributor III

Yes I am sure I set up qt-enterprise-5.1.1-linux-x86_

64-offline.run..

0 Kudos
VijdanDemir
New Contributor III

I think this is the problem with arcgis + Qt Creator integration.

installDirectory() function returns empty string.

Maybe the prf file does not handled correctly.

I also need to add INCLUDEPATH + LIBS to my pro file.

I added the QMAKE_TARGET.arch = x86_64 to the pro file. This does not work also..

0 Kudos