LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-15-2017, 07:57 AM   #1
businesscat
Member
 
Registered: Jun 2017
Location: Spain
Distribution: RedHat 6.9 /Centos 8
Posts: 42

Rep: Reputation: Disabled
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
 
Old 12-16-2017, 03:37 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,294

Rep: Reputation: 1698Reputation: 1698Reputation: 1698Reputation: 1698Reputation: 1698Reputation: 1698Reputation: 1698Reputation: 1698Reputation: 1698Reputation: 1698Reputation: 1698
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

Last edited by bathory; 12-16-2017 at 04:38 AM.
 
Old 01-03-2018, 11:06 AM   #3
businesscat
Member
 
Registered: Jun 2017
Location: Spain
Distribution: RedHat 6.9 /Centos 8
Posts: 42

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Alice 2.4 on Fedora not starting with shortcut; $PATH var causes error Could not find or load main class edu.cmu.cs.stage3.alice.authoringto RobbieTheK Linux - Software 0 06-17-2017 06:48 PM
Apache Tomcat catalina.out renamed to catalina.yyyy-mm-dd.log adebayoo Linux - Server 5 10-16-2012 05:26 AM
java error: Could not find the main class: kaza Linux - Software 5 06-23-2011 01:48 PM
Tomcat startup error in catalina.out cornishfairing Red Hat 0 09-02-2007 01:06 PM
Error:Failed to load Main-Class manifest attribute from imgbpatch.jar xbc Ubuntu 0 02-18-2007 04:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration