๐Ÿ”ด The Error You're Seeing

Confirm this matches your console output. If it does, you're in the right place.

ERROR LOG2026-03-01 23:45:00.500 ERROR 8842 --- [ main] o.s.boot.SpringApplication : Application run failed java.lang.IllegalArgumentException: Resource 'keystore.p12' not found at org.springframework.util.Assert.notNull(Assert.java:201) at org.springframework.boot.web.embedded.tomcat.SslConnectorCustomizer.configureSsl(SslConnectorCustomifier.java:75)

โšก Quick Fix Works 80% of the time

Ensure the keystore file is in src/main/resources and the path in application.properties starts with classpath:.

server.ssl.key-store=classpath:keystore.p12

๐Ÿง  Why this Happens

Tap to expand the deep technical explanation

You configured server.ssl.key-store in application.properties to enable HTTPS. When Spring Boot started, it tried to load the keystore file from the specified path, but the file was missing from the classpath or file system.

The HITEC City Parking Spot Analogy:

Imagine a security guard asking for the building's master key. You tell them it's in the safe, but when they go to the safe, the key isn't there. The guard (Spring Boot) refuses to open the building.

๐Ÿ” How to Reproduce Confirm this is your error

Set server.ssl.key-store to a path where keystore.p12 does not exist (or it is not inside src/main/resources), then start the app with HTTPS. Spring throws FileNotFoundException: class path resource [keystore.p12] cannot be resolved.

๐Ÿ› ๏ธ Solutions (3 Ways to Fix)

Solution 1โœ“ Most common cause

Fix the keystore path in properties

๐Ÿ‘‰ Use this if the file is in src/main/resources but Spring can't find it.

Spring Boot needs the 'classpath:' prefix to find files inside the JAR. Without it, it looks at the absolute file system path.

# Bad (Looks for C:/keystore.p12) server.ssl.key-store=keystore.p12 # Good (Looks inside src/main/resources) server.ssl.key-store=classpath:keystore.p12
Solution 2

Move the keystore to src/main/resources

๐Ÿ‘‰ Use this if the file is outside the standard resource folder.

Maven only packages files inside src/main/resources into the final JAR. If your keystore is in the project root, it won't be included.

# Move the file mv keystore.p12 src/main/resources/
Solution 3

Check file extension and permissions

๐Ÿ‘‰ Use this if the path is correct but the file is unreadable.

Ensure the file isn't locked by another process and has the correct extension (.p12, .jks).

# Check file exists ls -l src/main/resources/keystore.p12

๐Ÿ“‹ Version Notes

Spring Boot 2.x

Tomcat 9 embedded SSL.

Spring Boot 3.x

Tomcat 10 embedded SSL. Uses Jakarta.

๐Ÿ›ก๏ธ How to Prevent This Next Time

Always use the 'classpath:' prefix for resources packaged inside the JAR. Ensure the file is physically present in src/main/resources before building.

Course Search
Search across all chapters & stages
๐Ÿ“–

Search the course

Type any topic โ€” branching, stash, rebase, hooks โ€” and jump straight to that chapter.

merge branchesgit stashundo commitrebase