I modified the "Dynamic Layers - Simple Renderer Sample" by using a LocalMapService and added a new WorkspaceInfo instance as dynamic workspace. After modifying the data source by using DynamicLayerInfo::setLayerSource and refreshing the layer by ArcGISDynamicMapServiceLayer::refresh, an EsriServiceException "Requested an image but received content type text. Either the token used to access this server has expired or the parameters of this request are invalid." occurs. The workspace is a copy of the unpacked usa.gdb from the package folder.It would be nice to have a sample showing how to use dynamic workspaces.Thanks in advance.Modifed code:private WorkspaceInfo workspaceInfo; private JMap createMap() { ... // Add a new workspace LocalMapService mapService = new LocalMapService(getPathSampleData() + "MPKs/USCitiesStates.mpk"); mapService.setEnableDynamicLayers(true); WorkspaceInfoSet dynamicWorkspaces = mapService.getDynamicWorkspaces(); workspaceInfo = new WorkspaceInfo("WORKSPACE", WorkspaceInfo.WorkspaceFactoryType.FILE_GDB, "DATABASE=C:/data/arcgis/USA/usa.gdb"); dynamicWorkspaces.add(workspaceInfo); mapService.start(); dynamicLayer = new ArcGISDynamicMapServiceLayer(mapService.getUrlMapService()); ... } private void render(Renderer<Graphic> renderer, int layerId) { // Create new drawing info from our renderer, with set transparency DrawingInfo drawingInfo = new DrawingInfo(renderer, TRANSPARENCY); // Get the layerInfo from the dynamic layer and set the drawing info DynamicLayerInfoCollection layerInfos = dynamicLayer.getDynamicLayerInfos(); DynamicLayerInfo layerInfo = layerInfos.get(layerId); layerInfo.setDrawingInfo(drawingInfo); TableDataSource tableDataSource = new TableDataSource(); tableDataSource.setWorkspaceId(workspaceInfo.getId()); tableDataSource.setDataSourceName("Cities"); LayerDataSource layerDataSource = new LayerDataSource(); layerDataSource.setDataSource(tableDataSource); layerInfo.setLayerSource(layerDataSource); // Refresh the layer dynamicLayer.refresh(); }