Select to view content in your preferred language

How to use layers from different geodatabases in a LocalFeatureService ?

2202
3
10-08-2012 04:37 AM
JFr
by
Emerging Contributor
Hello,

I'd like to know how to use a map package which contains layers from different geodatabases in a local feature service. Map packages which use layers from only one geodatabase are working in a local feature service without difficulties. The use of layers from more than one geodatabase in a map package results the following exception when the application tries to start the service:
java.lang.NullPointerException
 at com.esri.client.local.LocalFeatureService.completeStart(Unknown Source)
 at com.esri.client.local.LocalService.a(Unknown Source)
 at com.esri.client.local.LocalService$a.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)

The layers in the map packages are accessed through ArcGISFeatureLayer in the local feature service.
The used layers are all displayed correct in the mxd-file and the use of the map package through an ArcGISLocalDynamicMapServiceLayer works without trouble too. What could be the reason for this ? Is it even possible to do that ?

Thanks,

J.
0 Kudos
3 Replies
EricBader
Honored Contributor
Hello!

Would you be able to share your code which is failing?
0 Kudos
JFr
by
Emerging Contributor
Hello Eric,

Would you be able to share your code which is failing?

this is the part of the code where the feature service is started and the layers from the map package are accessed. The application seems to throw the exception in this section:
    //Path of workspace directory
    String dir = System.getProperty("user.dir");
    //Basemap
    ArcGISLocalDynamicMapServiceLayer basemap = new ArcGISLocalDynamicMapServiceLayer(dir+"\\shapes.mpk");
    map.getLayers().add(basemap);
    //new local feature service
    LocalFeatureService service = new LocalFeatureService(dir+"\\myPackage.mpk");
    //Getting details of all feature layers in the package
    details = service.getFeatureLayers();
    service.addLocalServiceStartCompleteListener(new LocalServiceStartCompleteListener() {
            @Override
         public void localServiceStartComplete(LocalServiceStartCompleteEvent arg0) {
                     //initialize a new feature layer for every layer in the package and add it to the map
                  for(int i = 0; i<details.size();i++)
                  {     
                 featureLayer = new ArcGISFeatureLayer(details.get(i).getUrl());
                 map.getLayers().add(featureLayer);
                  }
             
                }
            });
        //start the service asynchronous
     service.startAsync();
0 Kudos
JFr
by
Emerging Contributor
I attached a map package with geodata from different geodata sources to demonstrate this problem.

Regards
J.
0 Kudos