Home>

Recently setting up a virtual machine environment,Installed centosql version 6.5, then installed openjdk1.7, downloaded a pure tomcat in apache and put it on the virtual machine to start error

There are two errors here:

1. The first error,apr problem, error details:

the apr based apache tomcat native library which allows optimal performance in production environments was not found on the java.library.path

2. The second error,Error details:

exception in thread "main" java.lang.internalerror

at sun.security.ec.sunec.initialize (native method)

at sun.security.ec.sunec.access $000 (sunec.java:49)

at sun.security.ec.sunec $1.run (sunec.java:61)

Solution to the first problem:

This is an apr problem, because tomcat depends on apr to optimize performance,You need to install apr

1. Install apr first, using source installation method,Installed by default at:/usr/local/apr

wget http://mirrors.cnnic.cn/apache//apr/apr-1.5.2.tar.gz
tar -zxvf apr-1.5.0.tar.gz
cd apr-1.5.0
./configure
make
make install

2. Next install tomcat-native. This gz package already exists in the tomcat bin directory.Decompress tomcat-native directly;

Go to the directory:cd tomcat-native-1.2.7-src/native, then compile and install:

./configure --with-apr =/usr/local/apr --with-java-home="/usr/lib/jvm/java-1.7.0" --with-ssl=yes

If the downloaded version of tomcat is newer,Compilation and installation will lead to inconsistent versions of openssl,Unable to install,The following error:

checking openssl library version>= 1.0.2 ... configure:error:your version of openssl is not compatible with this version of tcnative

This requires downloading a lower version of the tomcat-native package:

wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-connectors/native/1.1.34/source/tomcat-native-1.1.34-src.tar.gz

After downloading the above gz package,Put it in the bin directory of tomcat,Unzip, enter the directory:cd tomcat-native-1.1.20-src/jni/native, then compile and install

3. After compiling and installing successfully,In the tomcat bin directory, create a new file named setenv.sh

Add content to the new file:

ld_library_path=$ld_library_path:$catalina_home/lib

export ld_library_path

4. After the above three steps,The first retreat can be resolved;

Solution to the second problem:

This is a problem caused by the jdk version,I installed openjdk, and the missing jar package will appear.Leading to start errorSo here needs to be replaced by the official jdk given by oracle

1. Go to the Oracle official and download a package like this:jdk-7u79-linux-x64.tar.gz

2. After decompression,Move to/usr/local/java

3. Add environment variables:vim/etc/profile, add the following lines at the end of the file

export java_home =/usr/local/java/jdk1.7.0_79 //The actual jdk path
export classpath =.:$java_home/jre/lib/rt.jar:$java_home/lib/dt.jar:$java_home/lib/tools.jar
export path=$path:$java_home/bin

4. After completing the above installation,Then start tomcat and find that it will report an error:either the java_home nor the jre_home environment variable is defined

The problem is because tomcat does not recognize the environment variables of jdk

5. Modify the catalina.sh file in the bin directory in tomcat, at the beginning of the file,Add the following code:

export java_home =/usr/local/java/jdk1.7.0_79 ////The actual jdk path
export jre_home =/usr/local/java/jdk1.7.0_79/jre

Finally start tomcat, the log prints normally,The browser is also accessible,problem solved

exception in thread "main" java.lang.internalerror

at sun.security.ec.sunec.initialize (native method)

at sun.security.ec.sunec.access $000 (sunec.java:49)

at sun.security.ec.sunec $1.run (sunec.java:61)

  • Previous A comprehensive introduction to Java IO streams
  • Next Ajax method for verifying the existence of a single number