{channel.title!channel.name} - 楚淮公司周东林

LINUX系统下TOMCAT没有安装Native跑JEECMS报错

Tomcat Native 是一个利用 APR 来提升Tomcat性能的本地API,可以让 Tomcat 使用 Apache 的 apr 包来处理包括文件和网络IO操作,以提升性能。在Windows不用单独安装自动运行tcnative-1.dll


先贴上部分报错日志

21-Nov-2016 16:46:05.376 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal perfor
mance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
21-Nov-2016 16:46:05.544 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-801"]
21-Nov-2016 16:46:05.595 SEVERE [main] org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to initialize component [Connector[HTTP/1.1-801]]
 org.apache.catalina.LifecycleException: Protocol handler initialization failed
        at org.apache.catalina.connector.Connector.initInternal(Connector.java:944)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
        at org.apache.catalina.core.StandardService.initInternal(StandardService.java:530)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
        at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:875)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:606)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:629)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:311)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)
Caused by: java.net.BindException: Address already in use
        at sun.nio.ch.Net.bind0(Native Method)
        at sun.nio.ch.Net.bind(Net.java:433)
        at sun.nio.ch.Net.bind(Net.java:425)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
        at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:229)
        at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:875)
        at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:542)
        at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:65)
        at org.apache.catalina.connector.Connector.initInternal(Connector.java:941)
        ... 13 more


Tomcat-Native 安装方法:

1.安装依赖包

yum install apr-devel openssl-devel

2.到Tomcat-Native目录下安装

./configure --with-apr=/usr/bin/apr-1-config \
            --with-java-home=/usr/java/jdk1.8.0_60
            --with-ssl=yes \
            --prefix=$CATALINA_HOME

注意:--with-java-home=/usr/java/jdk1.8.0_60需要改成你自己的JDK目录

3.拷贝快捷方式到运行目录

cp /opt/tomcat1/bin/tomcat-native-1.1.30-src/jni/native/.libs/libtcnative-1*  /usr/lib

注意:/opt/tomcat1/bin/tomcat-native-1.1.30-src要换成你自己的Native安装目录。


浏览.发表于:2016-11-24 10:48:21