Thursday, October 31, 2013

Running HTTPS services in Tomcat - java.io.FileNotFoundException: /home/user/.keystore (No such file or directory)

I found today a tomcat server which was complaining about:
Oct 31, 2013 8:26:22 PM org.apache.catalina.startup.SetAllPropertiesRule begin
WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'SSLCertificateFile' to '/opt/tomcat/certs/sample.com.crt' did not find a matching property.
Oct 31, 2013 8:26:22 PM org.apache.catalina.startup.SetAllPropertiesRule begin
WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'SSLCertificateKeyFile' to '/opt/tomcat/certs/bsample.com.key' did not find a matching property.
...
Oct 31, 2013 8:26:23 PM org.apache.tomcat.util.net.jsse.JSSESocketFactory getStore
SEVERE: Failed to load keystore type JKS with path /home/user/.keystore due to /home/user/.keystore 
(No such file or directory)
java.io.FileNotFoundException: /home/user/.keystore (No such file or directory)
I was convinced my APR was installed correctly but Tomcat was giving me the clue lines above (despite I missed them because basically it was INFO level ;)
Oct 31, 2013 8:40:47 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
This was the result of a missing line in setenv:
...
JAVA_OPTS="$JAVA_OPTS \
-Djava.library.path=/usr/local/apr/lib \
...
So make sure the APR path is set in setenv.sh and that you have no INFO stating that APR was not found.

No comments:

Followers