... 2013-04-12 12:09:24,821: INFO rid=31 'server' mpk3 - Request handled. 2013-04-12 12:09:24,852: INFO rid=32 'server' mpk - Request handled. 2013-04-12 12:09:25,055: INFO rid=33 'server' mpk2 - Request handled. -> Here we see that there are 3 localmapservice already loaded 2013-04-12 12:09:29,305: INFO rid=34 'server' AdminWebService - POST admin/createService -> Here I just select a 4th shapefile java.lang.NullPointerException at com.esri.map.Layer.setUrl(Unknown Source) at com.esri.map.DynamicLayer.setUrl(Unknown Source) at com.esri.map.DynamicLayer.<init>(Unknown Source) at com.esri.map.ArcGISDynamicMapServiceLayer.<init>(Unknown Source) at com.esri.client.samples.datasources.LocalShapefileApp.addShapefile(LocalShapefileApp.java:103) at com.esri.client.samples.datasources.LocalShapefileApp.access$3(LocalShapefileApp.java:73) at com.esri.client.samples.datasources.LocalShapefileApp$3.actionPerformed(LocalShapefileApp.java:247) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6505) at javax.swing.JComponent.processMouseEvent(JComponent.java:3321) at java.awt.Component.processEvent(Component.java:6270) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) at java.awt.Container.dispatchEventImpl(Container.java:2273) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:723) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:682) at java.awt.EventQueue$3.run(EventQueue.java:680) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87) at java.awt.EventQueue$4.run(EventQueue.java:696) at java.awt.EventQueue$4.run(EventQueue.java:694) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:693) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139) at java.awt.EventDispatchThread.run(EventDispatchThread.java:97) 2013-04-12 12:09:35,071: INFO rid= '' WebServer - Lost connection on port 50000 Stopping server -> I've closed the application from here 2013-04-12 12:09:37,790: INFO rid= '' WebServer - Lost connection on port 50000 2013-04-12 12:09:37,790: INFO rid=35 'server' AdminWebService - POST admin/shutdown?f=json 2013-04-12 12:09:37,790: INFO rid= 'server' ServerMain - Shutting down 2013-04-12 12:09:37,790: INFO rid= 'server' ServerMain - Terminating web services 2013-04-12 12:09:37,790: INFO rid= 'server' AdminWebService - Terminating service blankMap.mpk 2013-04-12 12:09:37,790: INFO rid= 'server' mpk_host - Terminate 2013-04-12 12:09:37,790: INFO rid= 'server' AdminWebService - Terminating service blankMap.mpk2 2013-04-12 12:09:37,790: INFO rid= 'server' mpk2_host - Terminate 2013-04-12 12:09:37,790: INFO rid= 'server' AdminWebService - Terminating service blankMap.mpk3 2013-04-12 12:09:37,790: INFO rid= 'server' mpk3_host - Terminate 2013-04-12 12:09:37,790: INFO rid= 'server' ServerMain - Waiting for 3 worker processes to exit. Timeout=10s. 2013-04-12 12:09:37,899: INFO rid= '' WebServer - Lost connection on port 50000 2013-04-12 12:09:37,899: INFO rid= 'server' ServerMain - Worker processes exited. 2013-04-12 12:09:37,899: INFO rid= 'server' ServerMain - Deleting data directory C:/Windows/Temp/arcgisruntime_6452 2013-04-12 12:09:37,899: INFO rid= 'server' ServerMain - 10 filesystem object(s) removed. 2013-04-12 12:09:37,899: INFO rid= 'server' ServerMain - Server process exiting. Local server exited, code: 0
// set up a local dynamic layer final ArcGISDynamicMapServiceLayer localDynamicLayer = new ArcGISDynamicMapServiceLayer( localMapService.getUrlMapService());
Solved! Go to Solution.
To continu previous discussion...
I would like to create a "blank mpk" with 10 sub layers (more than 1 is my concern), instead of only one today...
So when creating my dynamic map service layer, for each sub layer I can update the dynamic layer infos to point to my Raster datasource (10 rasters from same directory).
I was able to create a blank MPK with 1 sub layer, because it's just an empty map.
But how can I prepare additional empty sub layers in ArcMap ?
Thanks for your help...
// create a local map service and enable dynamic layers LocalMapService localMapService = new LocalMapService(resourceMPKFile); localMapService.setEnableDynamicLayers(true); localMapService.start(); // Iterate on all files to add them with new WorkspaceInfo // pass the Local Map Service here as parameter for (File file: fileList) { addRaster(file.getName(), file.getParent(), transparency, localMapService); }
private void addMultipleRaster(final String fileName, final String fileDir, final int transparency, final LocalMapService localMapService) { // First stop the service localMapService.stop(); // get dynamic workspaces from service WorkspaceInfoSet workspaceInfoSet = localMapService.getDynamicWorkspaces(); // an arbitrary unique string final String workspaceId = ""+count++; // create a workspace info via the static method according to data type // e.g. raster folder connection WorkspaceInfo workspaceInfo = WorkspaceInfo.CreateRasterFolderConnection(workspaceId, fileDir); // also: // --> WorkspaceInfo.CreateSDEConnection // --> WorkspaceInfo.CreateShapefileFolderConnection // --> WorkspaceInfo.CreateFileGeoDatabaseConnection // Add this one raster workspaceInfo to the set of workspaces workspaceInfoSet.add(workspaceInfo); // set dynamic workspaces for our local map service localMapService.setDynamicWorkspaces(workspaceInfoSet); // now (re)start the service... localMapService.start(); ...
.... seems to work fine, but it can take some time, because of the stop/restart issue for each file.
and I still need to perform stress test on this solution...
Consider the asynchronous operations of stopAsync with a addLocalServiceStopCompleteListener event to load the rasters, and the startAsync with a addLocalServiceStartCompleteListener event to keep your app responsive.
Does this not work if you stop the service for all work space creation/file loading? Have you tried using the geodatabase connection method to persist loaded rasters on app restart?
You're right, and after some time, I was able to implement a solution with asynchronous operations ! It's much better for user as it can take some time to load DTED or CADRG Tiles...
I also tried to use another solution : I definitly can only start a local service once with several workspace info ... I'm still looking at this, but hope it can be a better solution, as it definitly use less memory with only one process.
also, in my case I can't use geodatabase / ESRI specific data format, so no geodatabase. we persist our map configuration by serialization. (in fact, I would need to be able to create new geodatabase, then generate Mosaic Dataset with my local tiles - all this by Geoprocessing Package with ArcGIS Runtime... but I guess I need some Tools to be authorized for ArcGIS Runtime first)
I have the same problem, that I cannot load more than one tif file at the same time. They are just loaded one after another...
So one question is about the following what Jeremie Joalland wrote:
"In fact I was trying to add blank layers, when the blank map Package only need to contain blank Group Layer.
So If I add 10 "new Group Layer" and create my blank Map Package, then I can add 10 rasters by changing the 10 corresponding datasources. issue resolved !"
What do you mean with corresponding datasource? Where do I need to change this? (And what exactly do I have to change?)
Second question you wrote that you have only 1 local server running, but 14 Processes. I'm not sure if it works by you or not. So this means you load 14 times a different tile at the same time?
But this only works with the mpk file changed to allow the number of processes (14)? Right?