An error occurred while "no certificate file specified or invalid file format" was reported during SSL configuration at tomcat6.0.33.

Source: Internet
Author: User
Tags apache tomcat

In the SSL bidirectional handshake configuration for Tomcat, APR is enabled by default in version 6.0.33 (APR is a portable library accessed through JNI, which can improve Tomcat performance and scalability ), therefore, an exception is reported when you use the traditional configuration method (as shown below;

 

Traditional SSL Configuration:

XML Code
  1. <Connector Port = "443" protocol = "HTTP/1.1" sslenabled = "true"
  2. Maxthreads = "150" Scheme = "HTTPS" secure = "true"
  3. Clientauth = "true" sslprotocol = "TLS"
  4. Keystorefile = "CONF/keystore/test. jks" keystorepass = "111111"
  5. Truststorefile = "CONF/keystore/test. jks" truststorepass = "111111"

 

 

 

The exception is as follows:

Java code
  1. 2011-10-27 9:26:03 org. Apache. Coyote. http11.http11aprprotocol init
  2. Severe: Error initializing endpoint
  3. Java. Lang. Exception: no certificate file specified or invalid file format
  4. At org. Apache. tomcat. JNI. sslcontext. setcertificate (native method)
  5. At org.apache.tomcat.util.net. aprendpoint. INIT (aprendpoint. Java: 733)
  6. At org. Apache. Coyote. http11.http11aprprotocol. INIT (http11aprprotocol. Java: 107)
  7. At org. Apache. Catalina. connector. connector. initialize (connector. Java: 1022)
  8. At org. Apache. Catalina. Core. standardservice. initialize (standardservice. Java: 703)
  9. At org. Apache. Catalina. Core. standardserver. initialize (standardserver. Java: 838)
  10. At org. Apache. Catalina. startup. Catalina. Load (Catalina. Java: 538)
  11. At org. Apache. Catalina. startup. Catalina. Load (Catalina. Java: 562)
  12. At sun. Reflect. nativemethodaccessorimpl. invoke0 (native method)
  13. At sun. Reflect. nativemethodaccessorimpl. Invoke (nativemethodaccessorimpl. Java: 39)
  14. At sun. Reflect. delegatingmethodaccessorimpl. Invoke (delegatingmethodaccessorimpl. Java: 25)
  15. At java. Lang. Reflect. method. Invoke (method. Java: 585)
  16. At org. Apache. Catalina. startup. Bootstrap. Load (Bootstrap. Java: 261)
  17. At org. Apache. Catalina. startup. Bootstrap. Main (Bootstrap. Java: 413)
  18. 2011-10-27 9:26:03 org. Apache. Catalina. Core. standardservice initialize
  19. Severe: failed to initialize connector [connector [http/1.1-443]
  20. Lifecycleexception: protocol handler initialization failed: Java. Lang. Exception: no certificate file specified or invalid file format
  21. At org. Apache. Catalina. connector. connector. initialize (connector. Java: 1024)
  22. At org. Apache. Catalina. Core. standardservice. initialize (standardservice. Java: 703)
  23. At org. Apache. Catalina. Core. standardserver. initialize (standardserver. Java: 838)
  24. At org. Apache. Catalina. startup. Catalina. Load (Catalina. Java: 538)
  25. At org. Apache. Catalina. startup. Catalina. Load (Catalina. Java: 562)
  26. At sun. Reflect. nativemethodaccessorimpl. invoke0 (native method)
  27. At sun. Reflect. nativemethodaccessorimpl. Invoke (nativemethodaccessorimpl. Java: 39)
  28. At sun. Reflect. delegatingmethodaccessorimpl. Invoke (delegatingmethodaccessorimpl. Java: 25)
  29. At java. Lang. Reflect. method. Invoke (method. Java: 585)
  30. At org. Apache. Catalina. startup. Bootstrap. Load (Bootstrap. Java: 261)
  31. At org. Apache. Catalina. startup. Bootstrap. Main (Bootstrap. Java: 413)

The solution is to use the following Configuration:

XML Code
  1. <Connector Port = "443" protocol = "org. Apache. Coyote. http11.http11protocol" sslenabled = "true"
  2. Maxthreads = "150" Scheme = "HTTPS" secure = "true"
  3. Clientauth = "true" sslprotocol = "TLS"
  4. Keystorefile = "CONF/keystore/testpsira. jks" keystorepass = "111111"
  5. Truststorefile = "CONF/keystore/testpsira. jks" truststorepass = "111111"

The solution is to replace Protocol = "HTTP/1.1" with protocol = "org. Apache. Coyote. http11.http11protocol;

APR plays a major role in improving Tomcat performance. We recommend that you configure Apr.

 

Digress:

If you identify whether Tomcat uses APR:

When Tomcat is started, if APR is used, the following information is displayed in the log:

Python code
  1. Information: Apr capabilities: ipv6 [True], sendfile [True], accept filters [false], random [True].

 

If APR is not used, a similar message is displayed at startup:

Python code
  1. Information: The APR based Apache Tomcat native library which allows optimal performance in production environments was not found on the java. Library. Path :...

 

Tomcat6.0.33 is automatically integrated with APR. Earlier versions are not integrated and need to be manually configured. There are many tutorials on this issue during online search.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.