Scrivio Interview library
DebuggingIntermediate7 min read · updated 13 November 2026

A Spring Boot service now requires client certificates (server.ssl.client-auth=need). One calling Java service fails every call; the server logs javax.net.ssl.SSLHandshakeException: Empty client certificate chain, although the caller has a keystore configured.

Why does the client send no certificate, and how do you find and fix the cause?

In the handshake, the server's CertificateRequest lists the certificate authorities it accepts, and the Java client's key manager offers only a certificate whose chain leads to one of them; if none matches, it sends an empty chain and the server rejects it. The usual causes are a certificate issued by a different or new intermediate CA, a keystore without the intermediate certificates, a key manager never wired into the HTTP client, or a certificate whose extended key usage lacks clientAuth or that has expired. We find which one with -Djavax.net.debug=ssl:handshake or openssl s_client, fix the trust or the chain, configure the client with Spring Boot SSL bundles, and monitor certificate expiry.

Why this question is asked

Empty client certificate chain is a frustrating error because it seems to contradict the configuration: the client has a keystore, yet the server says it received nothing. Interviewers ask this because solving it requires understanding how the handshake chooses a certificate, not just where to put files. In this answer, we will recap the mTLS handshake, see how Java picks a client certificate, list the common causes, debug them step by step, and fix them in a way that stays fixed.

1A Quick Recap: The Client's Part of the mTLS Handshake

With server.ssl.client-auth=need, the server requires a client certificate. During the handshake it sends a CertificateRequest message, which includes a list of certificate authority names it accepts, the issuers of client certificates it trusts. The client must answer with a Certificate message containing its certificate chain, its own certificate followed by any intermediate CA certificates, and then prove it holds the private key.

The client is allowed to answer with an empty Certificate message, meaning I have nothing suitable. A server that only wants client certificates sends that answer to its error log, and with need it then fails the handshake. That is exactly what the server logged here, so the question is why the client decided it had nothing suitable.

2How Java Chooses the Client Certificate

In Java, the KeyManager decides which certificate to send. The standard X509KeyManager looks through the keystore for a private key entry whose key type fits the handshake and whose certificate chain is issued by one of the CA names in the CertificateRequest. Only if it finds such an entry does it return its alias. If no entry matches, it returns nothing, and the JSSE layer sends an empty chain. It does not send the certificate anyway and let the server decide.

Step throughHow the Java client decides what to send
  1. Server sends CertificateRequestaccepted CA names: Partner Clients CA
  2. Key manager wired into this HTTP client?
    YesLook at keystore entriesNoSend empty chain
  3. Entry chain issued by a listed CA?
    YesCheck key usage and validityNoSend empty chain
  4. clientAuth allowed and not expired?
    YesSend chain, sign proofNoSkip entry, maybe empty chain

4 steps in order. Play them, or step through them one at a time.

Every 'no' leads to the empty chain that the server reports.

So a keystore with a perfectly valid certificate can still produce an empty chain, if the issuer the server lists is not in that certificate's chain as the key manager sees it.

3The Common Causes

The first cause is a mismatch of issuers. The client certificate was issued by a different CA than the one the server trusts, or, very often, by a new intermediate CA after a rotation. If the server's truststore holds only the old intermediate, its CertificateRequest lists only that name, and the client's certificate does not match.

The second cause is an incomplete chain in the client keystore. If the keystore holds only the leaf certificate, without the intermediate, and the server lists the root or the intermediate, the key manager cannot connect the leaf to the listed issuer and treats the entry as unsuitable.

The third cause is wiring. The keystore was configured, perhaps with javax.net.ssl.keyStore system properties or a Spring property, but the HTTP client in use builds its own SSLContext without a key manager, so the configured keystore is never consulted. This is common with clients created by hand or by a library.

Finally, the certificate itself. If it has an extended key usage extension that lists only serverAuth, it is not valid for client authentication and is not offered. An expired certificate may be skipped or rejected depending on the implementation.

4Debugging It Step by Step

Start on the client with the JSSE debug output, which prints the handshake messages. Look for the CertificateRequest and its list of authorities, and for the key manager's choice of alias or the message that no suitable certificate was found. Then check the keystore: how many certificates are in the chain of the entry, which issuer each has, and the key usage extensions. openssl s_client gives the server's view: it prints the acceptable client certificate CA names and lets us try a specific certificate and key.

Properties
# 1. What does the server ask for, and what does the Java client choose?
java -Djavax.net.debug=ssl:handshake -jar caller.jar
# CertificateRequest ... certificate_authorities: CN=Partner Clients CA G2 <- server wants G2
# No available client authentication scheme / no suitable certificate <- nothing matched
# 2. What is in the client keystore?
keytool -list -v -keystore client.p12 -storetype PKCS12
# Certificate chain length: 1 <- no intermediate
# Issuer: CN=Partner Clients CA G3 <- issued by the new G3 intermediate
# ExtendedKeyUsages [ clientAuth ]
# 3. Try it outside Java
openssl s_client -connect orders.internal:8443 -cert client.crt -key client.key -CAfile ca.pem
# Acceptable client certificate CA names: CN=Partner Clients CA G2

In this example output the cause is clear: the client certificate was issued by the new G3 intermediate, but the server trusts only G2. The server must add G3 to its truststore, and the client keystore should also hold the full chain. The exact debug wording differs between JDK versions, so read it for the meaning, not the exact text.

5Fixing It So It Stays Fixed

The immediate fix is in the trust or the chain: add the new intermediate or its root to the server's client truststore, and rebuild the client keystore with the full chain. If wiring was the problem, configure the client's key and trust material in one place. Spring Boot SSL bundles do that: we declare the bundle once and apply it to the HTTP client.

Java
# application.properties on the calling service
spring.ssl.bundle.pem.orders-client.keystore.certificate=classpath:tls/client-chain.pem # leaf + intermediate
spring.ssl.bundle.pem.orders-client.keystore.private-key=classpath:tls/client.key
spring.ssl.bundle.pem.orders-client.truststore.certificate=classpath:tls/orders-ca.pem
// Java: apply the bundle to the client
RestTemplate rest = builder.sslBundle(sslBundles.getBundle("orders-client")).build();
// on older Boot versions the method is setSslBundle(...); check your version

Finally, add monitoring. Client certificates expire too, and a forgotten one causes the same outage a year later. Export the expiry date of every certificate in use as a metric and alert 30 days ahead, and record which intermediate issued each client certificate, so a CA rotation is planned rather than discovered.

6Follow-up questions

How would you rotate the client CA without an outage?

In overlapping steps. First, add the new CA to the server's client truststore alongside the old one and deploy, so the server accepts both and lists both in its CertificateRequest. Then issue new client certificates from the new CA and roll them out to callers gradually, checking the debug output or server logs that each caller is presenting the new one. When no caller uses the old CA, and old certificates have expired or been replaced, remove the old CA from the truststore. Never switch both sides at once.

Why does the server list CA names at all?

So a client with several certificates, for example for different partners, can pick the one the server will accept without trying each. The cost is exactly this kind of failure: if the lists do not overlap, a Java client sends nothing rather than guessing.

7Conclusion

In this answer, we saw that the server's CertificateRequest lists acceptable issuers and that Java's key manager sends a certificate only when its chain matches one of them, otherwise an empty chain. The common causes are a new or different intermediate CA, a keystore without intermediates, a key manager never wired into the client, and certificates without clientAuth or past expiry. We debug with javax.net.debug, keytool and openssl s_client, fix the trust or chain, configure clients with SSL bundles and alert before certificates expire.

What to say in the interviewAbout 90 seconds aloud

Open with

The client is not ignoring its keystore; it is deciding that nothing in it is acceptable. In the handshake the server sends a CertificateRequest that lists the CA names it trusts for clients, and Java's key manager only offers a certificate whose chain leads to one of those issuers.

Then, if they want more

If nothing matches, it sends an empty chain, and with client-auth need the server fails the handshake with exactly this error.

The common causes are: the client certificate was issued by a different or new intermediate CA that the server does not list, the client keystore holds only the leaf without the intermediate, the key manager was never wired into the HTTP client actually used, or the certificate itself is unsuitable, for example its extended key usage has no clientAuth, or it has expired.

To find which, I run the client with -Djavax.net.debug=ssl:handshake to see the requested authorities and whether an alias was chosen, check the chain and issuers with keytool -list -v, and test with openssl s_client using the certificate and key, which also prints the acceptable CA names.

Then I fix the truststore or the chain, configure the client through a Spring Boot SSL bundle so key and trust material are in one place, and add expiry monitoring with alerts a month ahead.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Why does the client send no certificate, and how do you find and fix the cause?": https://scrivio-interview-library.netlify.app/architecture/load-balancing-networking/b50b99c180/