LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   TOMCAT ERROR:Error: Could not find or load main class org.apache.catalina.startup.Bootstrap (https://www.linuxquestions.org/questions/linux-newbie-8/tomcat-error-error-could-not-find-or-load-main-class-org-apache-catalina-startup-bootstrap-4175619665/)

businesscat 12-15-2017 06:57 AM

TOMCAT ERROR:Error: Could not find or load main class org.apache.catalina.startup.Bootstrap
 
Hi everyone,

I'm installed on a new AWS machine JAVA and TOMCAT, uncompressing the officials zips on opt:

Code:

ls -lah
total 16K
drwxr-xr-t.  4 root  root  4,0K dic 13 03:56 .
dr-xr-xr-t. 26 root  root  4,0K dic  7 12:01 ..
drwx------  11 tomcat tomcat 4,0K dic 15 04:26 apache-tomcat-8.5.11-src
lrwxrwxrwx  1 tomcat tomcat  13 dic 12 05:36 java -> jdk1.8.0_151/
drwxr-xr-x  8 tomcat tomcat 4,0K sep  5 22:32 jdk1.8.0_151
lrwxrwxrwx  1 tomcat tomcat  25 dic 13 03:56 tomcat8 -> apache-tomcat-8.5.11-src


And this is my config file:

Code:

#!/bin/bash
#
# tomcat
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start:
# Default-Stop:
# Description: Tomcat Service script
# Short-Description: start and stop tomcat
### END INIT INFO

## Source function library.
#. /etc/rc.d/init.d/functions
export CATALINA_PID=/opt/tomcat8/temp/tomcat.pid
export CATALINA_HOME=/opt/tomcat8
export CATALINA_BASE=/opt/tomcat8
export JAVA_HOME=/opt/java
#export JAVA_OPTS=-DJENKINS_HOME=/opt/jenkins
#export JAVA_OPTS="-Dfile.encoding=UTF-8 \
#  -Dnet.sf.ehcache.skipUpdateCheck=true \
#  -XX:+UseConcMarkSweepGC \
#  -XX:+CMSClassUnloadingEnabled \
#  -XX:+UseParNewGC \
#  -XX:MaxPermSize=256m \
#  -Xms512m -Xmx512m"
#export PATH=$JAVA_HOME/bin:$PATH
TOMCAT_HOME=/opt/tomcat8
TOMCAT_USER=tomcat
SHUTDOWN_WAIT=20

tomcat_pid() {
  echo `ps aux | grep org.apache.catalina.startup.Bootstrap | grep -v grep | awk '{ print $2 }'`
}

start() {
  pid=$(tomcat_pid)
  if [ -n "$pid" ]
  then
    echo "Tomcat is already running (pid: $pid)"
  else
    # Start tomcat
    echo "Starting tomcat"
    ulimit -n 100000
    umask 007
    /bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
  fi


  return 0
}

stop() {
  pid=$(tomcat_pid)
  if [ -n "$pid" ]
  then
    echo "Stoping Tomcat"
    /bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh

    let kwait=$SHUTDOWN_WAIT
    count=0;
    until [ `ps -p $pid | grep -c $pid` = '0' ] || [ $count -gt $kwait ]
    do
      echo -n -e "\nwaiting for processes to exit";
      sleep 1
      let count=$count+1;
    done

    if [ $count -gt $kwait ]; then
      echo -n -e "\nkilling processes which didn't stop after $SHUTDOWN_WAIT seconds"
      kill -9 $pid
    fi
  else
    echo "Tomcat is not running"
  fi

  return 0
}

case $1 in
start)
  start
;;
stop)
  stop
;;
restart)
  stop
  start
;;
status)
  pid=$(tomcat_pid)
  if [ -n "$pid" ]
  then
    echo "Tomcat is running with pid: $pid"
  else
    echo "Tomcat is not running"
  fi
;;
esac
exit 0


When I'm launch the tomcat, the console shows:

Code:


sudo service tomcat8 start
Starting tomcat
Using CATALINA_BASE:  /opt/tomcat8
Using CATALINA_HOME:  /opt/tomcat8
Using CATALINA_TMPDIR: /opt/tomcat8/temp
Using JRE_HOME:        /opt/java
Using CLASSPATH:      /opt/tomcat8/bin/bootstrap.jar:/opt/tomcat8/bin/tomcat-juli.jar
Using CATALINA_PID:    /opt/tomcat8/temp/tomcat.pid
Existing PID file found during start.
Removing/clearing stale PID file.
Tomcat started.


And in the catalina.out shows:

Code:

Error: Could not find or load main class org.apache.catalina.startup.Bootstrap
I'm searching on the net, but don't see anything clear.


Thanks for your time

bathory 12-16-2017 02:37 AM

Quote:

And in the catalina.out shows:

Error: Could not find or load main class org.apache.catalina.startup.Bootstrap

I'm searching on the net, but don't see anything clear.
You've downloaded tomcat source, not the binary distribution (note the "src" at the end of the filename: apache-tomcat-8.5.11-src)
Download the binary from here and you'll be fine

Regards

businesscat 01-03-2018 10:06 AM

Quote:

Originally Posted by bathory (Post 5793818)
You've downloaded tomcat source, not the binary distribution (note the "src" at the end of the filename: apache-tomcat-8.5.11-src)
Download the binary from here and you'll be fine

Regards

Sorry for the delay!

You're right!


Thank you so much! And sorry for my bad mind.


All times are GMT -5. The time now is 08:08 PM.