Solved! Go to Solution.
"Class not registered" is likely related to the licensing changes which came in version 10.
This topic has been discussed many times on the forum and elsewhere. Google on "arcgis 10 bind license".
import com.esri.arcgis.carto.Map; import com.esri.arcgis.carto.MapServer; import com.esri.arcgis.interop.AutomationException; import com.esri.arcgis.server.IServerContext; import com.esri.arcgis.server.IServerObjectManager; import com.esri.arcgis.server.ServerConnection; import com.esri.arcgis.system.ServerInitializer; import java.io.IOException; public class AGSConnection { private ServerInitializer serverinitializer; private ServerConnection connection; private IServerObjectManager som; private IServerContext context; private MapServer mapserver; private Map map; public AGSConnection(){ // Initialize server with impersonation information. <domain> <user name> <password>... serverinitializer = new ServerInitializer(); serverinitializer.initializeServer("", "arcgis", "arcgispassword"); try { // Open a connection to server. connection = new ServerConnection(); connection.connect("arcgis 10.2 server name"); // Get reference to ServerObjectManager class. som = connection.getServerObjectManager(); // Create a server context... <configName>,<typeName> context = som.createServerContext("mapservicefolder/mapservicename", "MapServer"); // Get a MapServer object from the server context mapserver = (MapServer) context.getServerObject(); // Get the Map from the MapServer object specified by the map (DataFrame) name map = (Map) mapserver.getMap("Layers"); } catch (AutomationException ae) { ae.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public ServerInitializer getServerinitializer() { return serverinitializer; } public ServerConnection getConnection() { return connection; } public IServerObjectManager getSom() { return som; } public IServerContext getContext() { return context; } public MapServer getMapserver() { return mapserver; } public Map getMap() { return map; } }
Just had a nice talk with ESRI customer service. Local connections to ArcGIS Server are gone as of 10.1 The online help has not been updated to reflect this yet.