Koozali.org: home of the SME Server

Tomcat doesnt seem to be working

Offline william_syd

  • *****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
Re: Tomcat doesnt seem to be working
« Reply #15 on: July 16, 2008, 03:56:05 AM »
On the user/group, these lines from the wiki/howto:

give me back the following:

[root@cmenl ~]# groupadd tomcat
groupadd: group tomcat exists
[root@cmenl ~]# useradd -g tomcat -d /opt/tomcat tomcat
useradd: user tomcat exists


I really don't think creating users and groups at the command line using regular linux tools is a good idea with smeserver.

As for starting the service doesn't /etc/rc.d/init.d/tomcat do that?

I tried doing this:

 /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh

and got this...
/bin/su: user /bin/startup.sh does not exist


$TOMCAT_USER and $TOMCAT_HOME are variables that have to be set to some value before you use them.

In the init script, they get set to tomcat and /opt/tomcat respectively.

So, to expand out that line like the script would you need to type

/bin/su tomcat /opt/tomcat/bin/startup.sh

Regards,
William

IF I give advise.. It's only if it was me....

Offline EastEnder01

  • *
  • 20
  • +0/-0
Re: Tomcat doesnt seem to be working
« Reply #16 on: July 16, 2008, 03:59:53 AM »
Tried creating tomcat user in server-manager, but it wouldn't allow me.  It came back with an error message saying that a system user by the same name already exists.  I took that to mean that the tomcat user I created from the wiki was already there...

Offline EastEnder01

  • *
  • 20
  • +0/-0
Re: Tomcat doesnt seem to be working
« Reply #17 on: July 16, 2008, 04:50:16 PM »

/bin/su tomcat /opt/tomcat/bin/startup.sh



When I do that I get the following:

Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program



Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Tomcat doesnt seem to be working
« Reply #18 on: July 16, 2008, 07:35:51 PM »
When I do that I get the following:

Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
It should be defined in the script... you did create the script as stated in the wiki, did you? Or are you just trying to execute lines from that on the command line? If you did not create the script I think we have the reason that your tomcat server is not starting at boot time.

I am still wondering if you are following the HowTo to the letter as other user(s) have had no problems getting it to run with the instructions stated there.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline EastEnder01

  • *
  • 20
  • +0/-0
Re: Tomcat doesnt seem to be working
« Reply #19 on: July 16, 2008, 07:43:15 PM »
I followed it absolutely to the letter...

The script I created was cut and paste from the wiki - as below:
#! /bin/bash
#
# tomcat Start the tomcat server.
#

NAME="Jakarta Tomcat 6"
TOMCAT_HOME=/opt/tomcat
CATALINA_HOME=/opt/tomcat
JAVA_HOME=/usr/java/jdk
CATALINA_OPTS="-Dfile.encoding=iso8859-1"
TOMCAT_USER=tomcat
LC_ALL=en_US
export TOMCAT_HOME CATALINA_HOME JAVA_HOME CATALINA_OPTS TOMCAT_USER LC_ALL
cd $TOMCAT_HOME/logs
case "$1" in
  start)
    echo -ne "Starting $NAME.\n"
    /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
    ;;

  stop)
    echo -ne "Stopping $NAME.\n"
    /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
    ;;

  *)
    echo "Usage: /etc/init.d/tomcat {start|stop}"
    exit 1
    ;;
esac

exit 0

Is there an easy way to start-over???

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Tomcat doesnt seem to be working
« Reply #20 on: July 16, 2008, 07:55:37 PM »
I followed it absolutely to the letter...
Then I still do not understand why a reboot does not start it...
Comparing this post of you to the results shown in this post of william_syd I think it is starting fine as the output looks more or less the same.

That still leaves the issue why you can not access it. Does tomcat have errorlogs as well? Perhaps a clue might be in there.

After you have started it does it stay up? Try this a few times after starting the service:
Code: [Select]
ps aux | grep tomcatAbove should at least output all process run as the tomcat user under which the process should be started judging from the script.

If not it seems it does not stay up... otherwise it should be up and accessible. Did you try and access it from your server itself already?
Code: [Select]
elinks http://localhost:8080
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline EastEnder01

  • *
  • 20
  • +0/-0
Re: Tomcat doesnt seem to be working
« Reply #21 on: July 16, 2008, 08:06:19 PM »
Then I still do not understand why a reboot does not start it...
Comparing this post of you to the results shown in this post of william_syd I think it is starting fine as the output looks more or less the same.

That still leaves the issue why you can not access it. Does tomcat have errorlogs as well? Perhaps a clue might be in there.

This is from the only file in the tomcat log directory (catalina.out):
/opt/tomcat/bin/catalina.sh: line 273: /usr/java/jdk/bin/java: is a directory
/opt/tomcat/bin/catalina.sh: line 273: /usr/java/jdk/bin/java: is a directory
/opt/tomcat/bin/catalina.sh: line 273: /usr/java/jdk/bin/java: is a directory

Quote
After you have started it does it stay up? Try this a few times after starting the service:
Code: [Select]
ps aux | grep tomcatAbove should at least output all process run as the tomcat user under which the process should be started judging from the script.
That gives me this output:
root      5811  0.0  0.1  5712  572 pts/0    S+   15:30   0:00 grep tomcat

Quote
If not it seems it does not stay up... otherwise it should be up and accessible. Did you try and access it from your server itself already?
Code: [Select]
elinks http://localhost:8080


elinks http://localhost:8080 gives me a Connection Refused error screen... :sad: :-?



Offline william_syd

  • *****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
Re: Tomcat doesnt seem to be working
« Reply #22 on: July 26, 2008, 12:10:52 PM »

From the cli, remove the tomcat user and group.

Then...

Code: [Select]
Go into server manager and create a user named tomcat

chown -R tomcat:tomcat /opt/tomcat/

chmod 770 /opt/tomcat/

db accounts setprop tomcat Shell /bin/bash

signal-event user-modify tomcat

Regards,
William

IF I give advise.. It's only if it was me....

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Tomcat doesnt seem to be working
« Reply #23 on: July 26, 2008, 12:22:02 PM »
From the cli, remove the tomcat user and group.

Then...

Code: [Select]
Go into server manager and create a user named tomcat

chown -R tomcat:tomcat /opt/tomcat/

chmod 770 /opt/tomcat/

db accounts setprop tomcat Shell /bin/bash

signal-event user-modify tomcat


Wouldn't this do as well (although your method might be preffered as you have the user displayed in te server-manager as well)?
Code: [Select]
usermod -s /bin/bash tomcat
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)