๐ด The Error You're Seeing
Confirm this matches your console output. If it does, you're in the right place.
2026-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)
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.p12Move 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/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
Tomcat 9 embedded SSL.
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.