Trouble connecting to Solace and no descriptive error is being received? Certificate auth

nomassama
nomassama Member Posts: 11 ✭✭

Hi, I am trying to connect to event-broker. but could not connect. also the exception I am receiving is not very descriptive about what could be wrong.

I have double checked:

  • trust store path.
  • certificate path
  • certificate password.

SSLValidateCertificate is set to true.

HostName VPN and ClientName are all double checked.

I have another Solace deployment for testing with Basic Auth and it does work. but need to check where in the certs is the issue and if its related to certs or not. Kind of clueless about this I have scoured through community and stack overflow but could not find much.

Any help is appreciated. thanks.

here are the logs.

24/09/26 10:24:49.031|1|0|Info|aspire| Solace   Assembly Informational Version: 10.24.0
  Assembly File Version: 10.24.0
  Assembly Version: 10.24.0.0
  Assembly Build Date: Mar 21 2024 07:47:00
  solClient Version: 7.29.0.6
  solClient Build Date: Mar 21 2024 07:17:00
  solClient Variant: Win64_vs2015_opt - C SDK

24/09/26 10:24:49.031|1|0|Info|aspire| SolaceManager initialization started. 
24/09/26 10:24:49.031|1|0|Info|aspire| Configuration values loaded. 
24/09/26 10:24:49.031|1|0|Info|aspire| Client Certificate Path C:\Users\Desktop\Avanza - Nouman\certs\app-test-user.pfx and Password ******
24/09/26 10:24:49.204|1|0|Info|aspire| Connecting to Solace... 
24/09/26 10:24:49.220|1|0|Info|aspire| Solace context created... 
24/09/26 10:24:49.282|1|0|Info|aspire| Solace session created... 
24/09/26 10:25:09.383|1|0|Error|aspire| Exception: Failed to connect session Line:0 Stacktrace:   at SolaceSystems.Solclient.Utils.Types.Utilities.GuardAgainstFailOrNotReady(ReturnCode returnCode, String message, Boolean includeSdkError, ISolLogger logger)
   at SolaceSystems.Solclient.Messaging.Native.SessionImpl.Connect()
   at Aspire.Core.SolaceManager.Initialize()

Answers

  • nicholasdgoodman
    nicholasdgoodman Member, Employee Posts: 43 Solace Employee
    edited September 30 #2

    As you observe, it is quite difficult to troubleshoot what is going wrong with the available logs, but the good news is that we can squeeze a lot more information out of the client SDK by configuring its built-in logging callbacks.

    From another one of your posts, I see you are using some kind of static logging library and are logging your various session and Solace events using something like Logger.Instance.Log(…).

    In order to redirect your SolClient SDK logs to the same place, you should initialize your session as follows:

    var contextFactoryProps = new ContextFactoryProperties()
    {
      SolClientLogLevel = SolLogLevel.Debug  // or whatever preferred log level is needed
    };
    
    contextFactoryProps.LogDelegate = (logInfo) =>
    {
      var logType = logInfo.LogLevel switch  // If using C#8 and above
      {
        SolLogLevel.Info => LogType.Info,
        SolLogLevel.Debug => LogType.Debug,
        //... other log level mappings ...
    _ => LogType.Info }; Logger.Instance.Log(LogSectionType.POC, logType, $"Solace SDK: {logInfo.LogMessage}"); }; ContextFactory.Instance.Init(contextFactoryProps); var contextProperties = new ContextProperties(); var sessionProperties = new SessionProperties() { //... session properties defined here }; // contextEventHandler and sessionEventHandler defined elsewhere... using (var context = ContextFactory.Instance.CreateContext(contextProperties, contextEventHandler)) using (var session = context.CreateSession(sessionProperties, null, sessionEventHandler)) { var connectResult = session.Connect(); // hopefully we can see what went wrong in more detail now }

  • nomassama
    nomassama Member Posts: 11 ✭✭

    I have already enabled the debug level, also I have some update I managed to get some information by using random certs and checking behavior turns out certificate might have an issue since it got past the point where it was causing issue.

    Apart from this I am seeing the session connecting happens and if something is wrong it takes forever to return causing our windows service to throw not responding error. we tweaked the connect timeout but still issue persists randomly. What would be the suitable value for that in a SIT environment and production. If you have any examples. I am relatively new to solace so your advise will be very beneficial.