Menu

Showing posts with label Troubleshooting. Show all posts
Showing posts with label Troubleshooting. Show all posts

6 Nov 2025

πŸ“ŒWebSphere Outbound SSL & SNI – Troubleshooting Guide

  • ERROR : javax.net.ssl.SSLHandshakeException: No name matching found.
  • This guide helps you diagnose and fix WebSphere outbound HTTPS failures when the target requires SNI.
  • You'll get exact OpenSSL checks, JVM flags, and a support matrix.

WebSphere Outbound SSL & SNI – Troubleshooting Guide

πŸ“‘ Table of Contents

πŸ”Ž What is SNI?

  • Server Name Indication (SNI) is a TLS extension
  • Client includes the target hostname in the ClientHello message
  • Allows servers to present the correct certificate when multiple virtual hosts share the same IP address
Without SNI you often receive a default certificate → CN/SAN mismatch → hostname validation fails even if the trust chain is fine.

🎯 Why SNI matters in WebSphere

  • Outbound calls from WebSphere to cloud APIs, SaaS, and WAF/CDN fronted apps often terminate on shared VIPs
  • Older or non-default Java settings may not send SNI (Server Name Indication).
  • Without SNI, the remote server sends a default certificate.
  • Your client fails with hostname mismatch error.

🚨 Common error patterns

javax.net.ssl.SSLHandshakeException: No name matching <api.company.com> found
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
PKIX path building failed: unable to find valid certification path to requested target
CWPKI0022E: SSL HANDSHAKE FAILURE
GSK_ERROR_BAD_CERT

πŸ§ͺ Confirming an SNI issue (OpenSSL)

Compare results with and without SNI from the WebSphere host:

# Baseline ( May still send SNI implicitly)
openssl s_client -connect api.company.com:443 -showcerts

# Force SNI (ClientHello includes hostname) openssl s_client -connect api.company.com:443 -servername api.company.com -showcerts
πŸ’¬ Interpretation
If CN/SAN only matches when -servername is used, the endpoint requires SNI and your client must send it.

⚙️ How to enable SNI in WebSphere

Add this JVM system property to the server's Generic JVM Arguments:

-Djsse.enableSNIExtension=true

Console path: Servers → Server Types → WebSphere application servers → <server> → Java and Process Management → Process Definition → Java Virtual Machine → Generic JVM Arguments

Save, synchronize nodes, restart the JVM.


Optional: align TLS baseline

-Dhttps.protocols=TLSv1.2

🧭 Best practices checklist

  • Verify CN/SAN with openssl s_client -servername before go-live or on UAT
  • Standardize JVM args across environments; document SNI-dependent endpoints.
  • Keep Java 8+; enforce TLS1.2+ to match common provider baselines.

❓ FAQ

Question Answer
What is SNI and why does it matter? SNI makes the server present the right certificate on shared IPs. Without it, you'll likely hit hostname mismatch in WebSphere even if trust is correct.
How do I enable SNI? Add -Djsse.enableSNIExtension=true to Generic JVM Arguments, then save, sync, and restart.
Which versions support SNI? WAS 8.5.5.x (Java 8) and WAS 9.x (Java 8/11) support SNI; WAS 7.x doesn't; WAS 8.0.x is partial/inconsistent.
How do I confirm an SNI issue? Compare openssl s_client with/without -servername. If only the SNI run shows the correct CN/SAN, you need SNI.

4 Oct 2023

How to Check DB latency using Datasource Test-Connection.

1. Create JdbcLatencyTest.java file and copy below code.


2. Do the changes for respective DB Driver class name and JDBC string along with Username & Password.

// ###################### JdbcLatencyTest.java File Contents ############# //

**********************************************************
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class JdbcLatencyTest {
    private static final int NUM_ITERATIONS = 10;


    public static void main(String[] args) {
        // JDBC driver class name and database URL string
        String driver = "oracle.jdbc.xa.client.OracleXADataSource";
        String url = "jdbc:oracle:thin:@123.789.123.456/SERVICENAME";


        // JDBC connection properties for Username and password
        String username = "username";
        String password = "Password";


        // Array to store latency measurements
        long[] latencyArray = new long[NUM_ITERATIONS];
        for (int i = 0; i < NUM_ITERATIONS; i++) {
            Connection conn = null;
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
            String connectionStartTime = null;
            String connectionEndTime = null;
            try {
                // Load the JDBC driver
                Class.forName(driver);
                // Start the timer for connection establishment
                long startConnectionTime = System.currentTimeMillis();
                // Capture the timestamp when the connection is created
                connectionStartTime = dateFormat.format(new Date());
                // Create the connection
                conn = DriverManager.getConnection(url, username, password);
                // Calculate the elapsed time for connection establishment
                long endConnectionTime = System.currentTimeMillis();
                long connectionLatency = endConnectionTime - startConnectionTime;
                // Capture the timestamp when the connection is closed
                connectionEndTime = dateFormat.format(new Date());
                // Store the latency value in the array
                latencyArray[i] = connectionLatency;
                // Print detailed latency information
                System.out.println("Iteration " + (i + 1) + ":");
                System.out.println("    Connection Start Time: " + connectionStartTime);
                System.out.println("    Connection End Time:   " + connectionEndTime);
                System.out.println("    Latency:               " + connectionLatency + " ms");
                // Close the connection
                conn.close();
            } catch (ClassNotFoundException e) {
                // Handle driver loading exception
                e.printStackTrace();
            } catch (SQLException e) {
                // Handle connection exception
                e.printStackTrace();
            }
        }
        // Print the overall latency statistics
        System.out.println("Connection Latency Measurements:");
        for (int i = 0; i < NUM_ITERATIONS; i++) {
            System.out.println("Iteration " + (i + 1) + ": " + latencyArray[i] + " ms");
        }
    }
}
***************************************************



FYI, JDBC Driver Class Name to connect respective DB:
  • oracle.jdbc.xa.client.OracleXADataSource   (for Oracle 19c and 12c DB , ojdbc8.jar with JDK8 complied)
  • oracle.jdbc.pool.OracleConnectionPoolDataSource  (for Oracle 11g with minimum jDK7, JDK8 complied)
  • org.postgresql.Driver (for POSTGRESQL DB , with postgresql-42.6.0.jar  )
  • com.microsoft.sqlserver.jdbc.SQLServerXADataSource (for MSSQL DB, with mssql-jdbc-12.2.0.jre8.jar)



3. Execute the below commands for compile and run.

$JAVA_HOME/java/8.0/bin/javac -cp /home/wasadmin/ojdbc8.jar JdbcLatencyTest.java

$JAVA_HOME/java/8.0/bin/java  -cp .:/home/wasadmin/ojdbc8.jar JdbcLatencyTest


################# Output #######################

[user@newhost ~]$ $JAVA_HOME/java/8.0/bin/javac -cp /home/wasadmin/ojdbc8.jar JdbcLatencyTest.java
[user@newhost ~]$ $JAVA_HOME/java/8.0/bin/java -cp .:/home/wasadmin/ojdbc8.jar JdbcLatencyTest


Iteration 1:
    Connection Start Time: 2023-10-03 06:42:24.018
    Connection End Time:   2023-10-03 06:42:30.189
    Latency:               6171 ms
Iteration 2:
    Connection Start Time: 2023-10-03 06:42:30.212
    Connection End Time:   2023-10-03 06:42:30.537
    Latency:               325 ms
Iteration 3:
    Connection Start Time: 2023-10-03 06:42:30.549
    Connection End Time:   2023-10-03 06:42:30.842
    Latency:               293 ms
Iteration 4:
    Connection Start Time: 2023-10-03 06:42:30.854
    Connection End Time:   2023-10-03 06:42:31.150
    Latency:               296 ms
Iteration 5:
    Connection Start Time: 2023-10-03 06:42:31.162
    Connection End Time:   2023-10-03 06:42:31.446
    Latency:               284 ms
Iteration 6:
    Connection Start Time: 2023-10-03 06:42:31.458
    Connection End Time:   2023-10-03 06:42:31.694
    Latency:               236 ms
Iteration 7:
    Connection Start Time: 2023-10-03 06:42:31.708
    Connection End Time:   2023-10-03 06:42:31.946
    Latency:               238 ms
Iteration 8:
    Connection Start Time: 2023-10-03 06:42:31.958
    Connection End Time:   2023-10-03 06:42:32.215
    Latency:               257 ms
Iteration 9:
    Connection Start Time: 2023-10-03 06:42:32.226
    Connection End Time:   2023-10-03 06:42:32.459
    Latency:               233 ms
Iteration 10:
    Connection Start Time: 2023-10-03 06:42:32.472
    Connection End Time:   2023-10-03 06:42:32.729
    Latency:               257 ms
Connection Latency Measurements:
Iteration 1: 6171 ms
Iteration 2: 325 ms
Iteration 3: 293 ms
Iteration 4: 296 ms
Iteration 5: 284 ms
Iteration 6: 236 ms
Iteration 7: 238 ms
Iteration 8: 257 ms
Iteration 9: 233 ms
Iteration 10: 257 ms
[user@newhost ~]$