Error Message
When attempting to run an application that uses ArcObjects to connect to ArcGIS Server, the following error message is returned:
"Could not load native libraries. ArcGIS/bin should be added to the system PATH environment variable.
java.lang.UnsatisfiedLinkError: no ntvauth in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)"
Cause
This error message is returned when the ServerInitializer.initializeServer method is not used for connecting to ArcGIS Server.
Solution or Workaround
Before any use of ArcObjects in a Java program either ServerInitializer or EngineInitializer needs to be called. ServerInitializer is used whenever ArcObjects calls are going to be made against an ArcGIS Server machine.
- If a connection is going to be made against only one ArcGIS Server machine then make a call of this form:
ServerInitializer.initializeServer("DOMAIN", "Username", "password");
If the user is a local user, replace DOMAIN with the name of the machine where the user has been created. This call needs to be made before calling ServerConnection::connect(machine). All ServerConnections in all threads will use these credentials when connecting to ArcGIS Server. - If connections are going to be made to multiple ArcGIS Servers or multiple username/password, credentials need to be used; then call ServerInitializer.initializeServer() without any arguments and before starting any additional threads.
When making a connection to ArcGIS Server, use the four argument method ServerConnection::connect to provide the credentials and make the call.