elabuschagne

ArcGIS Server Java API Connection Problem

Discussion created by elabuschagne on Nov 25, 2010
Latest reply on Dec 14, 2012 by ldonahue
Occasionally I get a "AutomationException: 0x5 - Access is denied. in 'Invoke'" error when trying to connect to ArcGIS. 

This is using code and credentials that worked fine, then one day it will just stop working.  Usually a combination of swearing, restarting the machine and restarting ArcGIS will resolve the problem.

A pattern seems to be emerging that Windows updates on the ArcGIS machine seem to trigger this, though I have had it happen without a Windows update too.

I have had this on various machines, running both Java and .NET versions of the server (ArcGIS 9.3.1, running on Windows) , but always with Java code on the client side (usually a Java web app hosted in Tomcat).

What it's NOT:
- Wrong credentials - I don't touch the credentials, it just stops working. Then works again after some restarts with the same credentials.
- Firewall issue - happens on machines where the firewall is off and also connecting to localhost

Any suggestions?

My code:
...
ServerInitializer serverInitializer = new ServerInitializer();
serverInitializer.initializeServer(domain, username, password); 
ServerConnection connection = new ServerConnection();
connection.connect(serverHost); // exception happens here
...


Typical exception trace:
AutomationException: 0x5 - Access is denied. in 'Invoke'
 at com.esri.arcgis.server.ServerConnection.connect(Unknown Source)
 at com.gims.printing.server.MapServerWrapper.buildServerObject(MapServerWrapper.java:107)
 at com.gims.printing.server.MapServerWrapper.getServerObject(MapServerWrapper.java:77)
 at com.gims.printing.server.MapServerWrapper.getServerContext(MapServerWrapper.java:87)
 at com.gims.printing.api.Printing.reprojectEnvelope(Printing.java:373)
 at com.gims.printing.rest.PrintingREST.reprojectEnvelope(PrintingREST.java:125)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$TypeOutInvoker._dispatch(EntityParamDispatchProvider.java:138)
 at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
 at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:154)
 at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
 at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)
 at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
 at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63)
 at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:543)
 at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:502)
 at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:493)
 at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:308)
 at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:314)
 at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:239)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
 at java.lang.Thread.run(Unknown Source)

Outcomes