cancel
Showing results for 
Search instead for 
Did you mean: 

Unity Java API Application#Connect: Unauthorized

Jacob_Andersen
Confirmed Champ
Confirmed Champ

Hello all,


I am working with the Unity Java API and cannot get connected through our application server. I have tried both our sandbox and production app server and multiple credentials. I have ensured they are assigned client licenses on their workstations and I have ensured the users are not locked.

I am receiving this stack trace:

Hyland.Unity.UnityAPIException: An error occurred within the Unity API---------------------Server Source: nullServer TargetSite: nullServer Exception: null ---> null at Hyland.Unity.OnBaseAuthenticationProperties.connectNormalMode(OnBaseAuthenticationProperties.java:182) at Hyland.Unity.OnBaseAuthenticationProperties.ConnectAndGetIntegrationApplicationOptions(OnBaseAuthenticationProperties.java:144) at Hyland.Unity.Application.Connect(Application.java:666) at com.rabobank.css.OnBaseConnection.connect(OnBaseConnection.java:20) at com.rabobank.css.ConsumerShareScanner.run(ConsumerShareScanner.java:46) at com.rabobank.css.ConsumerShareScanner.main(ConsumerShareScanner.java:16)Caused by: java.io.IOException: Unauthorized at Hyland.Services.OptimizedSoapServiceClient.executeVersion2(OptimizedSoapServiceClient.java:331) at Hyland.Services.OptimizedSoapServiceClient.Execute(OptimizedSoapServiceClient.java:114) at Hyland.Unity.AuthenticationProperties.trySendRequestToAuthSvc(AuthenticationProperties.java:369) at Hyland.Unity.AuthenticationProperties.executeConnectRequest(AuthenticationProperties.java:315) at Hyland.Unity.OnBaseAuthenticationProperties.connectNormalMode(OnBaseAuthenticationProperties.java:178) ... 5 more


I have checked the Diagnostics console, but nothing appears when I attempt to authenticate.

This is my test class:

public class OnBaseConnection implements AutoCloseable {    private final String appserver;    private final OnBaseAccount account;    private final String datasource;    private Application application;    public OnBaseConnection(String appserver, OnBaseAccount account, String datasource) {        this.appserver = appserver;        this.account = account;        this.datasource = datasource;    }    public final void connect() {        try {            application = Application.Connect(                    Application.CreateOnBaseAuthenticationProperties(                            appserver,                            account.getUsername(),                            account.getPassword(),                            datasource                    )            );        } catch (UnityAPIException ex) {            ex.printStackTrace(System.err);            System.exit(1);        }    }    @Override    public final void close() {        if (application == null) return;        System.out.println("Closing OnBase Connection...");        application.Disconnect();        System.out.println("Connection closed.");    }    public final Application getApplication() {        return application;    }    public static class OnBaseAccount {        private final String username;        private final String password;        public OnBaseAccount(String username, String password) {            this.username = username;            this.password = password;        }        public final String getUsername() {            return username;        }        public final String getPassword() {            return password;        }    }}


Hoping for some help. Thanks 🙂

1 ACCEPTED ANSWER

Robert_Angus
Star Contributor
Star Contributor

Jacob,

I had a similar issue and it came down to our Application Pool being set up for Windows authentication. I ended up standing up a separate instance of the AppServer with Anonymous Authentication enabled (and all other Authentication options disabled) and then I was able to connect.

View answer in original post

3 REPLIES 3

Robert_Angus
Star Contributor
Star Contributor

Jacob,

I had a similar issue and it came down to our Application Pool being set up for Windows authentication. I ended up standing up a separate instance of the AppServer with Anonymous Authentication enabled (and all other Authentication options disabled) and then I was able to connect.

Thanks for the answer. I went to IIS and disabled Windows authentication first on the Application, then on the Web Site, then on the entire server itself as well as set the authentication mode in Web.config to None. According to this answer, I should be able to connect but no such luck.

I have run iisreset multiple times.

Update: Near the bottom of web.config are authorization strategies. In my case, anonymous users were blocked from accessing the authorization endpoint at all. Thanks Robert.