APR based Apache Tomcat Native library was not found on the java.library.path? - apache

When trying to run my app with eclipse/linux on tomcat
I got the following info message:
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-6-sun-1.6.0.20/jre/lib/amd64/server:/usr/lib/jvm/java-6-sun-1.6.0.20/jre/lib/amd64:/usr/lib/jvm/java-6-sun-1.6.0.20/jre/../lib/amd64:/usr/lib64/xulrunner-addons:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
How do I resolve this issue?

My case:
Seeing the same INFO message.
Centos 6.2 x86_64
Tomcat 6.0.24
This fixed the problem for me:
yum install tomcat-native
boom!

For Ubntu Users
1. Install compilers
#sudo apt-get install make
#sudo apt-get install gcc
2. Install openssl and development libraries
#sudo apt-get install openssl
#sudo apt-get install libssl-dev
3. Install the APR package (Downloaded from http://apr.apache.org/)
#tar -xzf apr-1.4.6.tar.gz
#cd apr-1.4.6/
#sudo ./configure
#sudo make
#sudo make install
You should see the compiled file as
/usr/local/apr/lib/libapr-1.a
4. Download, compile and install Tomcat Native sourse package
tomcat-native-1.1.27-src.tar.gz
Extract the archive into some folder
#tar -xzf tomcat-native-1.1.27-src.tar.gz
#cd tomcat-native-1.1.27-src/jni/native
#JAVA_HOME=/usr/lib/jvm/jdk1.7.0_21/
#sudo ./configure --with-apr=/usr/local/apr --with-java-home=$JAVA_HOME
#sudo make
#sudo make install
Now I have compiled Tomcat Native library in /usr/local/apr/libtcnative-1.so.0.1.27 and symbolic link file /usr/local/apr/#libtcnative-1.so pointed to the library
5. Create or edit the $CATALINA_HOME/bin/setenv.sh file with following lines :
export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/local/apr/lib'
6. Restart tomcat and see the desired result:

Download the appropriate APR based tomcat native library for your operating system so that Apache tomcat server can take some advantage of the feature of your OS which is not included by default in tomcat. For windows it will be a .dll file.
I too got the warning while starting the server and you don't have to worry about this if you are testing or developing. This is meant to be on production purposes.
After putting the tcnative-1.dll file inside the bin folder of Apache Tomcat 7 following are the output in the stderr file,
Apr 07, 2015 1:14:12 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.33 using APR version 1.5.1.
Apr 07, 2015 1:14:12 PM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Apr 07, 2015 1:14:14 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized (OpenSSL 1.0.1m 19 Mar 2015)
Apr 07, 2015 1:14:14 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-127.0.0.1"]

I resolve this (On Eclipse IDE) by delete my old server and create the same again. This error is because you don't proper terminate Tomcat server and close Eclipse.

Related

Apache upgrade in CentOS 7

This is my current version of Apache:
httpd -V
Server version: Apache/2.4.6 (CentOS)
Server built: Apr 24 2019 13:45:48
Server's Module Magic Number: 20120211:24
Server loaded: APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
I am using CentOS 7; when I try to update Apache, it says there are no upgrades. I know the latest version is 2.4.39: mine is 2.4.6.
I would recommend looking at RHEL's security backports page. It explains the process RH uses to update version numbers. Basically, even though your httpd -V says 2.4.6, RH may have updated the features and fixed issues from the CVE without updating the version number. Run rpm -q --changelog httpd | grep CVE-yyyy-nnnn, filling in yyyy-nnnn with a recent timestamp from the CVE list, and see if your version has received those updates.
Alternatively, you may not have the latest CentOS version, which may not have the updated list of software. Run yum update to be sure you have the latest version.

Apache prefolk module cannot run concurrently with php7.2 module

1.Environment
Uname 4.15.0-48-generic #51-Ubuntu SMP Wed Apr 3 08:28:49 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Apache/2.4.29 (Ubuntu)
PHP 7.2.17-0ubuntu0.18.04.1 (cli)
2.Problem
I use the a2dismod command to close the mpm_prefolk and php7.2 modules, continue to use a2enmod to open the mpm_event module, open the event successfully, but after I continue to try to open the php7.2 module, an error occurred.
Operation process & ErrorCode
So I just turned off mpm_prefolk and then opened php7.2 as it said, php7.2 loaded successfully, but it automatically loaded the mpm_prefolk module.
Operation process
But at this time, the mpm_event module cannot be loaded.
ErrorCode
It needs to let me close mpm_prefolk,Just like an infinite loop, I don't know if I should reinstall the php environment or apache server, or php7.2 can only work with apache mpm_prefolk working mode, so I can only temporarily change it back.
3.Solution & Analyze
I solved the problem by reinstall the suit of php and apache ,and i read the apache documentation. So i found that apache mod_php only spport the prefolk module. You must install the php fpm Module

Certificate error when pulling docker images

When trying to pull a image from the docker hub, I am receiving some weird errors. The specific error that the docker daemon returns is:
Error getting v2 registry: Get https://registry-1.docker.io/v2/1:
x509: certificate signed by unknown authority
The weird thing is that running "docker search x" runs fine and returns what was expected. Also curling the page(curl -vL registry-1.docker.io) and running the openssl s_client(openssl s_client -connect registry-1.docker.io:443) doesn't return any certificate errors.
I am not behind a corporate proxy or anything like that. I've tried a lot of solutions like adding certs to the /etc/docker/certs.d directory, reinstalling the ca-certificates package, rebooting my machine, and almost everything that google searches suggested.
I am running CentOS version 6.8.
My docker version:
Client:
Version: 1.12.2
API version: 1.24
Go version: go1.6.3
Git commit: bb80604
Built: Tue Oct 11 17:00:50 2016
OS/Arch: linux/amd64
Server:
Version: 1.12.2
API version: 1.24
Go version: go1.6.3
Git commit: bb80604
Built: Tue Oct 11 17:00:50 2016
OS/Arch: linux/amd64
Thanks!

Apache crashes with munmap_chunk(): invalid pointer after update to php7 on Jessie

I recently updated to php 7.0.4 on my server running a Debian 8.
here is what dpkg -l | grep php gives me:
ii libapache2-mod-php7.0 7.0.4-1~dotdeb+8.1 amd64 server-side, HTML-embedded scripting language (Apache 2 module)
ii php-common 21-1~dotdeb+8.1 all Common files for PHP packages
ii php-readline 21-1~dotdeb+8.1 all readline module for PHP [default]
ii php7.0 7.0.4-1~dotdeb+8.1 all server-side, HTML-embedded scripting language (metapackage)
ii php7.0-cli 7.0.4-1~dotdeb+8.1 amd64 command-line interpreter for the PHP scripting language
ii php7.0-common 7.0.4-1~dotdeb+8.1 all Common files for packages built from the PHP source
ii php7.0-curl 7.0.4-1~dotdeb+8.1 amd64 CURL module for PHP
ii php7.0-gd 7.0.4-1~dotdeb+8.1 amd64 GD module for PHP
ii php7.0-imap 7.0.4-1~dotdeb+8.1 amd64 IMAP module for PHP
ii php7.0-intl 7.0.4-1~dotdeb+8.1 amd64 Internationalisation module for PHP
ii php7.0-json 7.0.4-1~dotdeb+8.1 amd64 JSON module for PHP
ii php7.0-mcrypt 7.0.4-1~dotdeb+8.1 amd64 libmcrypt module for PHP
ii php7.0-mysql 7.0.4-1~dotdeb+8.1 amd64 MySQL module for PHP
ii php7.0-opcache 7.0.4-1~dotdeb+8.1 amd64 Zend OpCache module for PHP
ii php7.0-readline 7.0.4-1~dotdeb+8.1 amd64 readline module for PHP
My php applications run fine most of the time.But on some requests I just get a Page being generated for no foreseeable reason.
The /var/log/apache2/error.log states in such a case:
*** Error in `/usr/sbin/apache2': munmap_chunk(): invalid pointer: 0x00007efc6ddb4a50 ***
*** Error in `/usr/sbin/apache2': munmap_chunk(): invalid pointer: 0x00007efc6dd5cad0 ***
[Wed Mar 09 11:26:44.940931 2016] [core:notice] [pid 28486] AH00052: child pid 29338 exit signal Aborted (6)
[Wed Mar 09 11:26:44.941017 2016] [core:notice] [pid 28486] AH00052: child pid 29344 exit signal Aborted (6)
*** Error in `/usr/sbin/apache2': munmap_chunk(): invalid pointer: 0x00007efc6dd5cad0 ***
[Wed Mar 09 11:26:46.942581 2016] [core:notice] [pid 28486] AH00052: child pid 29347 exit signal Aborted (6)
I'll give some more information:
Syntax:
$ apachectl configtest
Syntax OK
Version:
apachectl -v
Server version: Apache/2.4.10 (Debian)
Server built: Nov 28 2015 14:05:48
Before the php update I did not see those errors. What is wrong here? Or how can I better find the source? I am lost here because this error occures kind of random. Sometimes the same request succeeds that faild with this error a minute ago. I would apprechiate your help.
That's now the second time we have been hit hard by the very same issue.
It happens when running PHP 7.0 on a up to date debian.
This will break any type of website system which heavily uses regular expression.
We have seen it iwth Neos (neos.io) or Typo3 (starting with 6.2).
In case it's not possible to use the testing version of the libpcre3.
Someone can disable the just in time compiling within the php.ini
Edit your php.ini add pcre.jit=0 anywhere you like
Restart your apache
Be happy
I have the same version and solved by upgrading libpcre3 like #Kevin Fischer write.
I was upgrade libpcre3 package form 2:8.35-3.3+deb8u4 (stable) to 2:8.38-3.1 (testing) version.
Step by step:
Add line deb http://ftp.us.debian.org/debian testing main contrib non-free to /etc/apt/sources.list
Create file /etc/apt/apt.conf.d/99default-release with content: APT::Default-Release "stable";
Run command apt-get update from root
Run command apt-get -t testing install libpcre3 to install testing version of libpcre3 package
Restart your server and check logs, error should be disappears.
For more info to install testing package see this question.
Warning! Testing packages can works incorrectly! Update in your own risk or wait new release.
We've just had a similiar situation, where one of our framework's components would fail us with:
*** Error in `php': munmap_chunk(): invalid pointer: 0x00007fdce5550060 ***
I can't tell you anything about the bug itself, but the cause of it was a broken libpcre3 version, namely 8.35-3.3+deb8u4. We we're running a custom build, because PHP7 requires JIT support from libpcre3, which isn't included in the default one our Ubuntu version comes with (Ubuntu 14.04 LTS, 8.31-2ubuntu2.3). Upgrading the libpcre3 version solved the problem for us.
I also kept getting those nasty apache crashes, but none of the solutions above and on other websites were working for me.
After a lot of trial and error, I found out the root cause on my system.
I manually edited the PHP configuration and added two extensions. Both for Microsoft's SQL Server.
I added the following lines to the php.ini
extension=sqlsrv.so
extension=pdo_sqlsrv
I did not notice that I fogot the ".so" at the pdo driver.
After changing the lines as shown below, the Apache service is running fine again.
extension=sqlsrv.so
extension=pdo_sqlsrv.so

Apache Apr and Apr-util installlation?

I am installing Apache for first time in ubuntu 12.04 and i looked up in the link Compiling and installing apache
It says we should have APR and APR-util first i follow the procedure and untar them into
/usr/local/srclib/apr and /usr/local/srclib/apr-util directory.
Every where it is written
./configure's --with-included-apr
Now i just do ./configure in /usr/local/srclib/apr after that i do ./configure in /usr/local/srclib/apr-util then it throws me error configure: error: APR could not be located. Please use the --with-apr option.
then i add /configure --with-apr it throws an error
error: --with-apr requires a directory or file to be provided.
Please tell me what i am doing wrong here
Try running this:
./configure --with-apr=<directory path where apr is installed>
Eg: If your APR installation exists at /usr/local/apr(default installation location of APR), you should run:
./configure --with-apr=/usr/local/apr
As you are running ./configure in Apache source directory, ./srclib means srclib directory within Apache directory, not in /usr/local.
Suppose you place your Apache directory as /usr/local/httpd-2.x.x, then the path for apr and apr-util are as follows:
/usr/local/httpd-2.x.x/srclib/apr
/usr/local/httpd-2.x.x/srclib/apr-util
Now you can use --with-included-apr while configuring apache without any glitch. Just make sure that directories are named exactly as apr and apr-util and do not contain any version number etc. and yo don't need to run configure in apr and apr-util directory. Just place apr and apr-util as mentioned and start building your apache.
Rename both utilities as apr and apr-utils without any version tail,
While installing from source mention exact path of apr directory like below.
./configure --with-apr=/usr/local/scrib/apr
make
make install
cd httpd-2.4.x/srcib/
chmod +x */build/*
./configure --with-included-apr....