HTTP Status 404 - /
This error is caused due to many problems for example:
- Mostly this error is thrown due to invalid path. make sure the following folders exists:
> $cataline_home/webapps/your-project|
> -->html,css,images, etc.
> -->WEB-INF|
> -->classes (your java files)
> -->lib (your libraries)
- Make sure java is install on your machine. You can check it by running simply
javac
on command prompt or using java -version
- You are typing wrong URL address or incomplete URL or URL without tomcat port
- Also make sure you added your classes properly in web.xml file
installing Tomcat APR in MAC is HERE
and for Linux following is tested by myself
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path
Prerequisites for installing APR
APR library
APR-util library
OpenSSL library
yum install openssl-devel
yum groupinstall "Development Tools"
mkdir tomcat-apr
cd tomcat-apr
wget http://www.us.apache.org/dist//apr/apr-1.5.2.tar.gz
tar -zxvf apr-1.5.2.tar.gz
cd apr-1.5.2
./configure
make
make install
The default installation path is /usr/local/apr
Download and Install APR-util
wget http://www.eu.apache.org/dist//apr/apr-util-1.5.4.tar.gz
tar -zxvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure --with-apr=/usr/local/apr
make
make install
The default path of installation is /usr/local/apr/lib
Install JNI Wrapper for APR used by Tomcat (libtcnative)
cd $CATALINA_HOME/bin
tar -zxvf tomcat-native.tar.gz
cd tomcat-native-1.1.29-src/jni/native
./configure --with-apr=/usr/local/apr --with-java-home=/var/java/jdk1.7.0_45
make
make install
The native libraries were installed in /usr/local/apr/lib
Integrate APR with Tomcat
There are two ways to set Tomcat integrate with APR.
One is you can add the following parameter when start up the Tomcat in bin/catalina.sh:
CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib"
The other is to add a new environment variable LD_LIBRARY_PATH in /etc/profile:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib
Then makes it effect via:
source /etc/profile
After restarting the Tomcat service, we can get the following message in catalina.out log if APR was installed successfully.
Oct 07, 2015 8:08:54 AM org.apache.catalina.core.AprLifecycleListener
init INFO: Loaded APR based Apache Tomcat Native library 1.1.29 using
APR version 1.5.2. Oct 07, 2015 8:08:54 AM
org.apache.catalina.core.AprLifecycleListener init INFO: APR
capabilities: IPv6 [true], sendfile [true], accept filters [false],
random [true].