这里,之所以研究这个问题,是因为我们的生产系统Linux环境下的tomcat日志里面,启动信息的地方有这么一个WARNING。

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

这个虽然对应有没有什么影响,但是看到这个信息,总是有些不愉快。

关于APR是啥或者有什么好处,请参考这个官方文档介绍Apache Portable Runtime (APR) based Native library for Tomcat

为了将这个警告或者提醒信息去除,其实也很简单,只需要做几步配置就好:

1. 安装apr

2. 安装apr-util

3. 安装tomcat-native

首先,说下,我的环境信息:

1. Linux

[root@localhost bin]# uname -a
Linux localhost.localdomain 3.10.-.el7.x86_64 # SMP Thu Jan :: EST x86_64 x86_64 x86_64 GNU/Linux

2. Tomcat

[root@localhost bin]# pwd
/opt/shihuc/apache-tomcat-7.0./bin
[root@localhost bin]# ./version.sh
Using CATALINA_BASE: /opt/shihuc/apache-tomcat-7.0.
Using CATALINA_HOME: /opt/shihuc/apache-tomcat-7.0.
Using CATALINA_TMPDIR: /opt/shihuc/apache-tomcat-7.0./temp
Using JRE_HOME: /usr/java/jdk1..0_144
Using CLASSPATH: /opt/shihuc/apache-tomcat-7.0./bin/bootstrap.jar:/opt/shihuc/apache-tomcat-7.0./bin/tomcat-juli.jar
Server version: Apache Tomcat/7.0.
Server built: Aug :: UTC
Server number: 7.0.64.0
OS Name: Linux
OS Version: 3.10.-.el7.x86_64
Architecture: amd64
JVM Version: 1.8.0_144-b01
JVM Vendor: Oracle Corporation

接下来,进行三步走策略,完成APR的环境配置。

1. 安装apr

在官网下载最新的apr,下载地址为http://mirrors.shu.edu.cn/apache//apr/apr-1.6.3.tar.gz

下载后,进行解压,并进入到根目录进行configure,make以及make install

[root@localhost apr-1.6.]# pwd
/opt/shihuc/apr-1.6.

这个操作,比较简单,不做过多描述。

2.安装apr-util

在官网下载最新的apr-util,下载地址为http://mirrors.shu.edu.cn/apache//apr/apr-util-1.6.1.tar.gz

下载后,进行解压,并进入到根目录进行configure,make以及make install

[root@localhost apr-util-1.6.]# pwd
/opt/shihuc/apr-util-1.6.
[root@localhost apr-util-1.6.]# ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for working mkdir -p... yes
APR-util Version: 1.6.
checking for chosen layout... apr-util
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
Applying apr-util hints file rules for x86_64-pc-linux-gnu
checking for APR... no
configure: error: APR could not be located. Please use the --with-apr option.

注意,这里报错了,并且提醒了,要加--with-apr选项进行配置。意思是说,告知apr-util配置的时候apr的路径在什么地方

[root@localhost apr-util-1.6.]# ./configure --with-apr=/usr/local/apr
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for working mkdir -p... yes
APR-util Version: 1.6.
checking for chosen layout... apr-util
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
Applying apr-util hints file rules for x86_64-pc-linux-gnu
checking for APR... yes
setting CPP to "gcc -E"
adding "-pthread" to CFLAGS
setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for ldap support...
checking for default DBM... sdbm (default)
checking for pg_config... /usr/bin/pg_config
adding "-I/usr/include" to CPPFLAGS
setting LDFLAGS to "-L/usr/lib64"
checking libpq-fe.h usability... no
checking libpq-fe.h presence... no
checking for libpq-fe.h... no
checking postgresql/libpq-fe.h usability... no
checking postgresql/libpq-fe.h presence... no
checking for postgresql/libpq-fe.h... no
checking sqlite3.h usability... no
checking sqlite3.h presence... no
checking for sqlite3.h... no
checking sqlite.h usability... no
checking sqlite.h presence... no
checking for sqlite.h... no
checking for odbc_config... /home/anaconda2/bin/odbc_config
adding "-I/home/anaconda2/include" to CPPFLAGS
setting LDFLAGS to "-L/home/anaconda2/lib"
setting LIBS to "-L/home/anaconda2/lib -lodbc"
checking sql.h usability... yes
checking sql.h presence... yes
checking for sql.h... yes
checking for SQLAllocHandle in -lodbc... yes
adding "-I/home/anaconda2/include" to APRUTIL_PRIV_INCLUDES
setting LDADD_dbd_odbc to "-L/home/anaconda2/lib -lodbc -L/home/anaconda2/lib -lodbc"
checking Expat 1.95.x... yes
setting APRUTIL_EXPORT_LIBS to "-lexpat"
setting APRUTIL_LIBS to "-lexpat"
checking iconv.h usability... yes
checking iconv.h presence... yes
checking for iconv.h... yes
checking for type of inbuf parameter to iconv... char **
checking for iconv.h... (cached) yes
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking for nl_langinfo... yes
checking for CODESET in langinfo.h... yes
checking whether APR has DSO support... yes
checking for library containing crypt... -lcrypt
checking if system crypt() function is threadsafe... no
checking for crypt_r... yes
checking style of crypt_r... struct_crypt_data
checking whether the compiler handles weak symbols... yes
checking for memset_s support... no
checking for explicit_bzero support... no
adding "/usr/local/apr/lib/libapr-1.la" to APRUTIL_LIBS
adding "-lrt" to APRUTIL_LIBS
adding "-lcrypt" to APRUTIL_LIBS
adding "-lpthread" to APRUTIL_LIBS
adding "-ldl" to APRUTIL_LIBS
configure: creating ./config.status
config.status: creating Makefile
config.status: creating export_vars.sh
config.status: creating build/pkg/pkginfo
config.status: creating apr-util.pc
config.status: creating apu--config
config.status: creating include/private/apu_select_dbm.h
config.status: creating include/apr_ldap.h
config.status: creating include/apu.h
config.status: creating include/apu_want.h
config.status: creating test/Makefile
config.status: creating include/private/apu_config.h
config.status: executing default commands
[root@localhost apr-util-1.6.]#

这次OK了,没有再报错。

3. 安装tomcat-native

注意,我们的tomcat是tomcat7了,这个版本以及之后的版本,是不需要单独下载tomcat-native的包的,在tomcat的bin目录下,已经带上了,我们只需要在这个目录下进行解压和安装即可。

[root@localhost apache-tomcat-7.0.]# cd bin/
[root@localhost bin]# ll
总用量
-rw-r--r--. root root 8月 bootstrap.jar
-rw-r--r--. root root 8月 catalina.bat
-rwxr-xr-x. root root 8月 catalina.sh
-rw-r--r--. root root 8月 catalina-tasks.xml
-rw-r--r--. root root 8月 commons-daemon.jar
-rw-r--r--. root root 8月 commons-daemon-native.tar.gz
-rw-r--r--. root root 8月 configtest.bat
-rwxr-xr-x. root root 8月 configtest.sh
-rwxr-xr-x. root root 8月 daemon.sh
-rw-r--r--. root root 8月 digest.bat
-rwxr-xr-x. root root 8月 digest.sh
-rw-r--r--. root root 8月 setclasspath.bat
-rwxr-xr-x. root root 8月 setclasspath.sh
-rw-r--r--. root root 8月 shutdown.bat
-rwxr-xr-x. root root 8月 shutdown.sh
-rw-r--r--. root root 8月 startup.bat
-rwxr-xr-x. root root 8月 startup.sh
-rw-r--r--. root root 8月 tomcat-juli.jar
-rw-r--r--. root root 8月 tomcat-native.tar.gz
-rw-r--r--. root root 8月 tool-wrapper.bat
-rwxr-xr-x. root root 8月 tool-wrapper.sh
-rw-r--r--. root root 8月 version.bat
-rwxr-xr-x. root root 8月 version.sh

将这个tomcat-native.tar.gz解压并进入到native目录下,进行configure,make以及make install。因为,我们的tomcat配置中,涉及apr的地方,启用了SSL,所以,我们的环境里面,必须要有SSL的支持能力。

<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
--> 下面的省略了。。。

所以SSL的环境必须要有,检查后发现,我的Linux系统,因为之前其他项目的需要,已经安装了openssl了,通过rpm查看。

[root@localhost native]# rpm -qa|grep openssl
openssl-devel-1.0.2k-.el7.x86_64
openssl098e-0.9.8e-.el7_0..x86_64
openssl-1.0.2k-.el7.x86_64
openssl-libs-1.0.2k-.el7.x86_64
[root@localhost native]#

系统当前已经安装有openssl了,版本为openssl-devel-1.0.2k-8.el7.x86_64。

或者通过这种方式,也可以查看是否安装openssl,直接执行openssl,看是否存在。那么openssl的安装路径是啥呢?

[root@localhost native]# which openssl
/home/anaconda2/bin/openssl

下面检查tomcat-native的JDK环境:

[root@localhost native]# echo $JAVA_HOME
/usr/java/jdk1..0_144

tomcat-native的依赖都有了,接下来,就是直接安装操作了。

[root@localhost native]# ./configure --with-apr=/usr/local/apr --with-ssl=/home/anaconda2/bin --with-java-home=/usr/java/jdk1.8.0_144
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.
checking for chosen layout... tcnative
checking for APR... yes
setting CC to "gcc"
setting CPP to "gcc -E"
checking for JDK location (please wait)... /usr/java/jdk1..0_144
checking Java platform... checking Java platform...
checking for sablevm... NONE
adding "-I/usr/java/jdk1.8.0_144/include" to TCNATIVE_PRIV_INCLUDES
checking os_type directory... linux
adding "-I/usr/java/jdk1.8.0_144/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... using openssl from /home/anaconda2/bin/lib and /home/anaconda2/bin/include
checking OpenSSL library version... ok
checking for OpenSSL DSA support... no
adding "-I/home/anaconda2/bin/include" to TCNATIVE_PRIV_INCLUDES
setting TCNATIVE_LDFLAGS to "-L/home/anaconda2/bin/lib -Wl,-rpath,/home/anaconda2/bin/lib -lssl -lcrypto"
adding "-DHAVE_OPENSSL" to CFLAGS
setting TCNATIVE_LIBS to ""
setting TCNATIVE_LIBS to " /usr/local/apr/lib/libapr-1.la -lrt -lcrypt -lpthread -ldl"
configure: creating ./config.status
config.status: creating tcnative.pc
config.status: creating Makefile
config.status: executing default commands

接下来,就执行make以及make install了。

[root@localhost native]# make && make install
make[]: 进入目录“/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native”
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/address.lo -c src/address.c && touch src/address.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/bb.lo -c src/bb.c && touch src/bb.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/dir.lo -c src/dir.c && touch src/dir.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/error.lo -c src/error.c && touch src/error.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/file.lo -c src/file.c && touch src/file.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/info.lo -c src/info.c && touch src/info.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/jnilib.lo -c src/jnilib.c && touch src/jnilib.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/lock.lo -c src/lock.c && touch src/lock.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/misc.lo -c src/misc.c && touch src/misc.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/mmap.lo -c src/mmap.c && touch src/mmap.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/multicast.lo -c src/multicast.c && touch src/multicast.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/network.lo -c src/network.c && touch src/network.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/os.lo -c src/os.c && touch src/os.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/poll.lo -c src/poll.c && touch src/poll.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/pool.lo -c src/pool.c && touch src/pool.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/proc.lo -c src/proc.c && touch src/proc.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/shm.lo -c src/shm.c && touch src/shm.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/ssl.lo -c src/ssl.c && touch src/ssl.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/sslcontext.lo -c src/sslcontext.c && touch src/sslcontext.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/sslinfo.lo -c src/sslinfo.c && touch src/sslinfo.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/sslnetwork.lo -c src/sslnetwork.c && touch src/sslnetwork.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/sslutils.lo -c src/sslutils.c && touch src/sslutils.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/stdlib.lo -c src/stdlib.c && touch src/stdlib.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/thread.lo -c src/thread.c && touch src/thread.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o src/user.lo -c src/user.c && touch src/user.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o os/unix/system.lo -c os/unix/system.c && touch os/unix/system.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -o os/unix/uxpipe.lo -c os/unix/uxpipe.c && touch os/unix/uxpipe.lo
/bin/sh /usr/local/apr/build-/libtool --silent --mode=link gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -DHAVE_OPENSSL -I/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native/include -I/usr/java/jdk1..0_144/include -I/usr/java/jdk1..0_144/include/linux -I/home/anaconda2/bin/include -I/usr/local/apr/include/apr- -version-info :: -o libtcnative-.la -rpath /usr/local/apr/lib src/address.lo src/bb.lo src/dir.lo src/error.lo src/file.lo src/info.lo src/jnilib.lo src/lock.lo src/misc.lo src/mmap.lo src/multicast.lo src/network.lo src/os.lo src/poll.lo src/pool.lo src/proc.lo src/shm.lo src/ssl.lo src/sslcontext.lo src/sslinfo.lo src/sslnetwork.lo src/sslutils.lo src/stdlib.lo src/thread.lo src/user.lo os/unix/system.lo os/unix/uxpipe.lo -L/home/anaconda2/bin/lib -Wl,-rpath,/home/anaconda2/bin/lib -lssl -lcrypto /usr/local/apr/lib/libapr-.la -lrt -lcrypt -lpthread -ldl
make[]: 离开目录“/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native”
make[]: 进入目录“/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native”
make[]: 对“local-all”无需做任何事。
make[]: 离开目录“/opt/shihuc/apache-tomcat-7.0./bin/tomcat-native-1.1.-src/jni/native”
/usr/local/apr/build-/mkdir.sh /usr/local/apr/include/apr- /usr/local/apr/lib/pkgconfig \
/usr/local/apr/lib /usr/local/apr/bin
/usr/bin/install -c -m tcnative.pc /usr/local/apr/lib/pkgconfig/tcnative-.pc
list=''; for i in $list; do \
( cd $i ; make DESTDIR= install ); \
done
/bin/sh /usr/local/apr/build-/libtool --mode=install /usr/bin/install -c -m libtcnative-.la /usr/local/apr/lib
libtool: install: /usr/bin/install -c -m .libs/libtcnative-.so.0.1. /usr/local/apr/lib/libtcnative-.so.0.1.
libtool: install: (cd /usr/local/apr/lib && { ln -s -f libtcnative-.so.0.1. libtcnative-.so. || { rm -f libtcnative-.so. && ln -s libtcnative-.so.0.1. libtcnative-.so.; }; })
libtool: install: (cd /usr/local/apr/lib && { ln -s -f libtcnative-.so.0.1. libtcnative-.so || { rm -f libtcnative-.so && ln -s libtcnative-.so.0.1. libtcnative-.so; }; })
libtool: install: /usr/bin/install -c -m .libs/libtcnative-.lai /usr/local/apr/lib/libtcnative-.la
libtool: install: /usr/bin/install -c -m .libs/libtcnative-.a /usr/local/apr/lib/libtcnative-.a
libtool: install: chmod /usr/local/apr/lib/libtcnative-.a
libtool: install: ranlib /usr/local/apr/lib/libtcnative-.a
libtool: finish: PATH="/usr/local/cuda-7.5/bin:/home/mongo/mongodb-linux-x86_64-rhel70-3.4.4/bin:/usr/local/cuda-7.5/bin:/home/mongo/mongodb-linux-x86_64-rhel70-3.4.4/bin:/usr/local/cuda-7.5/bin:/home/mongo/mongodb-linux-x86_64-rhel70-3.4.4/bin:/usr/local/cuda-7.5/bin:/home/mongo/mongodb-linux-x86_64-rhel70-3.4.4/bin:/usr/local/cuda-7.5/bin:/home/mongo/mongodb-linux-x86_64-rhel70-3.4.4/bin:/home/cuda-8.0/bin:/home/anaconda2/bin:/usr/local/cuda-7.5/bin:/home/mongo/mongodb-linux-x86_64-rhel70-3.4.4/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/apache-maven-3.3.9/bin:/home/mwwPro/tools/R2017a/bin/:/root/bin:/opt/shihuc/QANLP/idea-IC-172.4574.11/bin:/opt/apache-maven-3.3.9/bin:/opt/apache-maven-3.3.9/bin:/opt/apache-maven-3.3.9/bin:/opt/apache-maven-3.3.9/bin:/opt/apache-maven-3.3.9/bin:/sbin" ldconfig -n /usr/local/apr/lib
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/apr/lib If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the 'LD_RUN_PATH' environment variable
during linking
- use the '-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to '/etc/ld.so.conf' See any operating system documentation about shared libraries for
more information, such as the ld() and ld.so() manual pages.
----------------------------------------------------------------------
[root@localhost native]#

所有的安装操作都OK了,接下来,还有一点,注意,不要遗忘了配置环境变量,就是APR的环境变量。

修改/etc/profile,然后做下面的红色内容的新增,写上apr的安装路径:

export LD_LIBRARY_PATH=/usr/local/apr/lib:/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH

然后,source一下/etc/profile.启用这个新的环境配置。

所有的操作都结束了,最后就是验证是否APR生效。很简单,只需要将tomcat重启一下,查看catalina.out的日志,看看是否存在开篇提到的APR的那个提醒信息即可。我的环境配置,安装上述步骤,这个APR的提醒信息已经解除,的确不存在了。

下面对比一下,没有做上述APR配置和做了这个配置的启动日志有什么不同:

没有配置APR的日志:

五月 ,  :: 下午 org.apache.catalina.startup.SetAllPropertiesRule begin
警告: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'maxSpareThreads' to '' did not find a matching property.
五月 , :: 下午 org.apache.catalina.startup.SetAllPropertiesRule begin
警告: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'maxProcessors' to '' did not find a matching property.
五月 , :: 下午 org.apache.catalina.startup.SetAllPropertiesRule begin
警告: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'minProcessors' to '' did not find a matching property.
五月 , :: 下午 org.apache.catalina.startup.SetAllPropertiesRule begin
警告: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'useURIValidationHack' to 'false' did not find a matching property.
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version: Apache Tomcat/7.0.
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built: Aug :: UTC
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number: 7.0.64.0
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name: Linux
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version: 3.10.-.el7.x86_64
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture: amd64
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home: /usr/java/jdk1..0_144/jre
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version: 1.8.0_144-b01
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor: Oracle Corporation
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE: /opt/shihuc/apache-tomcat-7.0.
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME: /opt/shihuc/apache-tomcat-7.0.
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.util.logging.config.file=/opt/shihuc/apache-tomcat-7.0./conf/logging.properties
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=/opt/shihuc/apache-tomcat-7.0./endorsed
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=/opt/shihuc/apache-tomcat-7.0.
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=/opt/shihuc/apache-tomcat-7.0.
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.io.tmpdir=/opt/shihuc/apache-tomcat-7.0./temp
五月 , :: 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /home/cuda-8.0/lib64:/home/cuda-8.0/extras/CUPTI/lib64:/home/cudnn/lib64:/usr/local/cuda-7.5/lib64::/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
五月 , :: 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-bio-8080"]
五月 , :: 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-bio-8009"]
五月 , :: 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in ms
五月 , :: 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
五月 , :: 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.

下面是做了这个APR配置后的启动日志:

五月 ,  :: 下午 org.apache.catalina.startup.SetAllPropertiesRule begin
警告: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'maxSpareThreads' to '' did not find a matching property.
五月 , :: 下午 org.apache.catalina.startup.SetAllPropertiesRule begin
警告: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'maxProcessors' to '' did not find a matching property.
五月 , :: 下午 org.apache.catalina.startup.SetAllPropertiesRule begin
警告: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'minProcessors' to '' did not find a matching property.
五月 , :: 下午 org.apache.catalina.startup.SetAllPropertiesRule begin
警告: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'useURIValidationHack' to 'false' did not find a matching property.
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version: Apache Tomcat/7.0.
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built: Aug :: UTC
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number: 7.0.64.0
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name: Linux
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version: 3.10.-.el7.x86_64
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture: amd64
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home: /usr/java/jdk1..0_144/jre
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version: 1.8.0_144-b01
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor: Oracle Corporation
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE: /opt/shihuc/apache-tomcat-7.0.
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME: /opt/shihuc/apache-tomcat-7.0.
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.util.logging.config.file=/opt/shihuc/apache-tomcat-7.0./conf/logging.properties
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=/opt/shihuc/apache-tomcat-7.0./endorsed
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=/opt/shihuc/apache-tomcat-7.0.
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=/opt/shihuc/apache-tomcat-7.0.
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.io.tmpdir=/opt/shihuc/apache-tomcat-7.0./temp
五月 , :: 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: Loaded APR based Apache Tomcat Native library 1.1.33 using APR version 1.6.3.
五月 02, 2018 5:09:09 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
五月 02, 2018 5:09:09 下午 org.apache.catalina.core.AprLifecycleListener initializeSSL
信息: OpenSSL successfully initialized (OpenSSL 1.0.2k 26 Jan 2017
)
五月 , :: 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-apr-8080"]
五月 , :: 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-apr-8009"]
五月 , :: 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in ms
五月 , :: 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
五月 , :: 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.

总结:

1. APR这个就算没有配置,也不影响tomcat的正常使用,无非就是性能稍微差点。

2. 在tomcat-native的configure操作中,若不正确配置--with-ssl这个选项的话,其他的就算都配置好了,依然会出现开篇提到的APR提醒信息。也就是说APR功能不启用。

3.关于tomcat启动日志中,下面的这些警告信息,我没有找到最终的解释,但是个人基于http://tomcat.apache.org/tomcat-7.0-doc/config/http.html#Standard_Implementation的介绍,认为是这些警告的信息涉及到的配置在tomcat7里面已经过期了,也就是说找不到相关的配置,即使有这个警告,也没什么问题。若有高人对这个有确切的了解,还请分享下。

五月 ,  :: 下午 org.apache.catalina.startup.SetAllPropertiesRule begin
警告: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'maxSpareThreads' to '' did not find a matching property.
五月 , :: 下午 org.apache.catalina.startup.SetAllPropertiesRule begin
警告: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'maxProcessors' to '' did not find a matching property.
五月 , :: 下午 org.apache.catalina.startup.SetAllPropertiesRule begin
警告: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'minProcessors' to '' did not find a matching property.
五月 , :: 下午 org.apache.catalina.startup.SetAllPropertiesRule begin
警告: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'useURIValidationHack' to 'false' did not find a matching property.

Tomcat里面的APR配置问题研究的更多相关文章

  1. Unity3D研究之Prefab里面的Prefab关联问题

    Unity研究院之Prefab和GameObject的正向和逆向查找引用 我发现很多美工兄弟都爱问程序Unity3d为什么总丢材质? 我不排除U3d有BUG的情况下会丢材质?但是其实很多时候是人为操作 ...

  2. Activity往另外一个Activity传值,Fragment获取另外一个Activity里面的值。

    在oneActivity中实现跳转到MainActivity //intent 用来跳转另外一个MainActivity,bundle传值到MainActivity         Intent Ma ...

  3. procps包里面的sysctl命令

    procps包里面的sysctl命令 --http://www.cnblogs.com/createyuan/p/3740917.html?utm_source=tuicool&utm_med ...

  4. (转)tomcat与地址栏图标之研究(多浏览器)

    原文:http://hi.baidu.com/hebo_thu/item/fc8c81bb164f5cee4fc7fd90 tomcat与地址栏图标之研究(多浏览器) 最近在做一个java网络应用程序 ...

  5. tomcat bio nio apr 模式性能测试

    转自:tomcat bio nio apr 模式性能测试与个人看法 11.11活动当天,服务器负载过大,导致部分页面出现了不可访问的状态.那后来主管就要求调优了,下面是tomcat bio.nio.a ...

  6. koa2 use里面的next到底是什么

    koa2短小精悍,女人不爱男人爱. 之前一只有用koa写一点小程序,自认为还吼吼哈,知道有一天某人问我,你说一下 koa或者express中间件的实现原理.然后我就支支吾吾,好久吃饭都不香. 那么了解 ...

  7. 使用eclipse启动tomcat里的项目时报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    1.这种错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener刚开始看的时候 ...

  8. 在Tomcat中部署Web项目的操作方法,maven项目在Tomcat里登录首页报404

     maven项目在Tomcat里登录首页报404, 解决:编辑conf/server.xml进行配置<Host>里的<Context>标签里的path. <Context ...

  9. koa2 中间件里面的next到底是什么

    koa2短小精悍,女人不爱男人爱. 之前一只有用koa写一点小程序,自认为还吼吼哈,知道有一天某人问我,你说一下 koa或者express中间件的实现原理.然后我就支支吾吾,好久吃饭都不香. 那么了解 ...

随机推荐

  1. wx小程序入门&坑

    1.腾讯云的nodejs版服务代码,在本地用吹cnpm install安装依赖之后,初始化数据库不成功: 换成npm install 并 npm run initdb 之后 可以了.... 2.屏蔽页 ...

  2. mongoDB安装windows 64 bit

    mongoDB安装windows 64 bit   https://www.mongodb.org/downloads?_ga=1.207888916.746558625.1410501054 下载, ...

  3. lftp的安装

    lftp的安装 安装依赖的包 yum -y install make  readline-devel  gnutls* 解压上传的包 tar -jxf lftp-4.0.1.tar.bz2 cd到解压 ...

  4. 20165228 2017-2018-2 《Java程序设计》第5周学习总结

    20165228 2017-2018-2 <Java程序设计>第5周学习总结 教材学习内容总结 内部类和匿名类 通过throw关键字抛出异常对象,终止方法的继续执行 使用try-catch ...

  5. php经典算法实现(转)

    <?  //--------------------  // 基本数据结构算法 //--------------------  //二分查找(数组里查找某个元素)  function bin_s ...

  6. USB抓包工具Bus Hound

    /********************************************************************** * USB抓包工具Bus Hound * 说明: * 之 ...

  7. 百练-16年9月推免-B题-字符串判等

    2743:字符串判等 查看 提交 统计 提示 提问 总时间限制:  1000ms 内存限制:  65536kB 描述 判断两个由大小写字母和空格组成的字符串在忽略大小写,且忽略空格后是否相等. 输入 ...

  8. Linux命令学习之路——档案拷贝:cp

    使用权限:所有角色 使用方式:cp [ -arf ] source dest / cp [ -arf ] source... Directory 作用:把一个档案拷贝到另一个档案(档案复制),或将多个 ...

  9. 用纯JS实现,点击一个列表时,输出对应的索引(不能用JQuery哦)

    你运行一下代码会发现,无论你点击哪个列表,控制台都是输出10.这是因为var声明的变量是函数作用域的,而不是块级作用域的.也就是说,for循环10次,每次都是改变同一个i,所以它的值会从0一直加到10 ...

  10. Nginx访问日志、 Nginx日志切割、静态文件不记录日志和过期时间

    1.Nginx访问日志 配制访问日志:默认定义格式: log_format combined_realip '$remote_addr $http_x_forwarded_for [$time_loc ...