centos7.3 启动tomcat 出现错误:
八月 08, 2017 4:58:47 下午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/7.0.55 八月 08, 2017 5:09:26 下午 org.apache.catalina.core.AprLifecycleListener init 信息: Loaded APR based Apache Tomcat Native library 1.1.31 using APR version 1.4.8. 八月 08, 2017 5:09:26 下午 org.apache.catalina.core.AprLifecycleListener init 信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 八月 08, 2017 5:09:26 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 严重: Failed to initialize the SSLEngine. org.apache.tomcat.jni.Error: 70023: This function has not been implemented on this platform at org.apache.tomcat.jni.SSL.initialize(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.catalina.core.AprLifecycleListener.initializeSSL(AprLifecycleListener.java:270) at org.apache.catalina.core.AprLifecycleListener.lifecycleEvent(AprLifecycleListener.java:124) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:99) at org.apache.catalina.startup.Catalina.load(Catalina.java:638) at org.apache.catalina.startup.Catalina.load(Catalina.java:663) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:454) 八月 08, 2017 5:09:26 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-apr-80"] 八月 08, 2017 5:09:26 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["ajp-apr-8009"] 八月 08, 2017 5:09:26 下午 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 622 ms 八月 08, 2017 5:09:26 下午 org.apache.catalina.core.StandardService startInternal 信息: Starting service Catalina 八月 08, 2017 5:09:26 下午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/7.0.55
解决方案:
1、网上有贴,说关闭ssl 即可:
修改server.xml
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="off" />
2、但如果确实需要SSL的话怎么办?得从根本上解决问题:
a、yum install openssl-devel
b、yum groupinstall "Development Tools"
c、yum apr apr-util
d、解压$TOMCAT_HOME/bin目录下tomcat-native.tar.gz 文件
e、进入 cd tomcat-native-1.1.31-src/jni/native/目录:
如果运行./configure,出现如下情况
[root@root native]# ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for working mkdir -p... yes
Tomcat Native Version: 1.1.31
checking for chosen layout... tcnative
checking for APR... no
configure: error: APR could not be located. Please use the --with-apr option.
则:
[root@root native]# ./configure --with-apr=/usr/bin/apr-1-config
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for working mkdir -p... yes
Tomcat Native Version: 1.1.31
checking for chosen layout... tcnative
checking for APR... yes
setting CC to "gcc"
setting CPP to "gcc -E"
checking for JDK location (please wait)... /opt/jdk from environment
checking Java platform... checking Java platform...
checking for sablevm... NONE
adding "-I/opt/jdk/include" to TCNATIVE_PRIV_INCLUDES
checking os_type directory... linux
adding "-I/opt/jdk/include/linux" to TCNATIVE_PRIV_INCLUDES
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for OpenSSL library... not found
setting TCNATIVE_LIBS to ""
setting TCNATIVE_LIBS to " /usr/lib64/libapr-1.la -lpthread -ldl"
setting TCNATIVE_LDFLAGS to ""
configure: creating ./config.status
config.status: creating tcnative.pc
config.status: creating Makefile
config.status: executing default commands
f、make && make install
g、重启tomcat