프로그램/java

tomcat native connector 설치 및 활성화 tip, tomcat apr

mulderu 2012. 10. 23. 20:49

Tomcat 성능향상을 위해  APR + OPENSSL + Native-Connector 를 추가 설치 !!!

이렇게 하면 믿거나 말거나 성능이 엄청 올라가서 apache httpd서버를 이용할 필요가 없다고 한다. ???

특히 SSL을 톰캣이 직접처리하도록 하려면 반드시 해야될 작업이라고 합니다.


APR  라이브러리 설치하기 

(참조 :

http://tomcat.apache.org/tomcat-7.0-doc/apr.html

http://evgeny-goldin.com/blog/ubuntu-installing-apr-tomcat/

 http://www.gurubee.net/pages/viewpage.action?pageId=3902222

)


Most Linux distributions will ship packages for APR and OpenSSL. The JNI wrapper (libtcnative) will then have to be compiled. It depends on APR, OpenSSL, and the Java headers.

Requirements:

  • APR 1.2+ development headers (libapr1-dev package)
  • OpenSSL 0.9.7+ development headers (libssl-dev package)
  • JNI headers from Java compatible JDK 1.4+
  • GNU development environment (gcc, make)

The wrapper library sources are located in the Tomcat binary bundle, in the bin/tomcat-native.tar.gz archive. Once the build environment is installed and the source archive is extracted, the wrapper library can be compiled using (from the folder containing the configure script):

./configure && make && make install




멀더의 경우 아래와 같이 에러가 ... 난다.

mulder@vlinux:~/apps/tomcat7/bin$ rm ../logs/* && sh startup.sh && sleep 3 && cat ../logs/catalina.out

Using CATALINA_BASE:   /home/mulder/apps/tomcat7

Using CATALINA_HOME:   /home/mulder/apps/tomcat7

Using CATALINA_TMPDIR: /home/mulder/apps/tomcat7/temp

Using JRE_HOME:        /home/mulder/downs/jdk1.6.0_27

Using CLASSPATH:       /home/mulder/apps/tomcat7/bin/bootstrap.jar:/home/mulder/apps/tomcat7/bin/tomcat-juli.jar

Oct 23, 2012 4:34:25 AM 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: /home/mulder/downs/jdk1.6.0_27/jre/lib/amd64/server:/home/mulder/downs/jdk1.6.0_27/jre/lib/amd64:/home/mulder/downs/jdk1.6.0_27/jre/../lib/amd64:$LD_LIBRARY_PATH:/usr/local/apr/lib:/usr/local/apr/lib:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib

Oct 23, 2012 4:34:25 AM org.apache.coyote.AbstractProtocol init

INFO: Initializing ProtocolHandler ["http-bio-8080"]

Oct 23, 2012 4:34:25 AM org.apache.catalina.core.StandardService initInternal

SEVERE: Failed to initialize connector [Connector[HTTP/1.1-8443]]

org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-8443]]

at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)

at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)

at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)

at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:814)

at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)

at org.apache.catalina.startup.Catalina.load(Catalina.java:633)

at org.apache.catalina.startup.Catalina.load(Catalina.java:658)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)

Caused by: org.apache.catalina.LifecycleException: The configured protocol [org.apache.coyote.http11.Http11AprProtocol] requires the APR/native library which is not available

at org.apache.catalina.connector.Connector.initInternal(Connector.java:975)

at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)

... 12 more

Oct 23, 2012 4:34:25 AM org.apache.coyote.AbstractProtocol init

INFO: Initializing ProtocolHandler ["ajp-bio-8009"]

Oct 23, 2012 4:34:25 AM org.apache.catalina.startup.Catalina load

INFO: Initialization processed in 1067 ms

Oct 23, 2012 4:34:25 AM org.apache.catalina.core.StandardService startInternal

INFO: Starting service Catalina

Oct 23, 2012 4:34:25 AM org.apache.catalina.core.StandardEngine startInternal

INFO: Starting Servlet Engine: Apache Tomcat/7.0.32

Oct 23, 2012 4:34:25 AM org.apache.catalina.startup.HostConfig deployDirectory

INFO: Deploying web application directory /home/mulder/apps/apache-tomcat-7.0.32/webapps/docs



설치한 apr을 인식하지 못하는경우다...

아래와 같이 처리함.


$CATALINA_HOME/bin/catalina.sh 파일안에 아래와 같이   LD_LIBRARY_PATH 를 추가 해준다.

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/mulder/apps/tomcat7/lib"


아래와 같이 로그가 올라오면 성공이다.

root@turbine01:/usr/local/tomcat7/logs# cat catalina.out

10월 26, 2012 12:47:22 오후 org.apache.catalina.core.AprLifecycleListener init

INFO: Loaded APR based Apache Tomcat Native library 1.1.24 using APR version 1.4.6.

10월 26, 2012 12:47:22 오후 org.apache.catalina.core.AprLifecycleListener init