Solved! Go to Solution.
The service is not secured::
ArcGISTiledMapServiceLayer tiledLayer = new ArcGISTiledMapServiceLayer(
"http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");
//LayerList layers = map.getLayers();
// layers.add(tiledLayer);
map.getLayers().add(tiledLayer);
even this is also not being displayed... i am getting same error.
Great! Thanks.
I just have one question. May be the proxy parameters are not correct. How can you catch this connection exception (org.apache.http.conn.HttpHostConnectException) since it's not thrown by JMap class itself. I need to catch this error and take suitable actions or an appropriate warning message about the proxy parameters correctness.
I tried:
MapOptions mapOptions = new MapOptions(MapType.STREETS, 24.43261, -102.92041, 4);
try{
JMap jMap = new JMap(mapOptions);
jMap.setWrapAroundEnabled(true);
}
catch(org.apache.http.conn.HttpHostConnectException){
// Handle error connection due to incorrect proxy parameters
}
But, of course, the compiler claims "Out of Reach try catch clause"
First of all, good "catch". by the way.
What happens when you try to catch a general Exception?
This is what works for me. Surround your layer definition code with a try/catch for Exception, instead of a specific one. I know it sounds improper, but this may get you farther along, hopefully?