tomcat status cannot be detected

uh2

Member
Jan 22, 2004
10
0
151
after using the easyapache via cpanel to update to php 4.3.8

my tomcat restart link in the cpanel said contact sysadmin and "Tomcat is not installed"

I looked into /scripts/restartsrv_tomcat and it is made to look for /usr/sbin/tomcat. If it could not find it, "$service is not installed" msg is given .... btw $service="tomcat"

So I mkdir /usr/sbin/tomcat

NOW my tomcat restart link in the cpanel (port 2087)

the brown outline box in cpanel just says
Tomcat status

said contact sysadmin and "Tomcat is not running"

So in SSH I ran /scripts/restartsrv_tomcat to test it
and got
Using CATALINA_BASE: /usr/local/jakarta
Using CATALINA_HOME: /usr/local/jakarta
Using CATALINA_TMPDIR: /usr/local/jakarta/temp
Using JAVA_HOME: /usr/local/jdk
Using Security Manager

I know tomcat was being restarted since I get a 500 error when I refresh a jsp webpage immediately after I issued the command and the page came back on about 10 seconds later when I refreshed it again. The same thing happens when I use the cpanel restart tomcat link but the status says not running.

Recap: Cpanel WHM restarts tomcat now but Tomcat status cannot be detected and says Tomcat is not running.

What must I modify/fix to get status working?

While in my webhosting user cpanel server status page (port 2083)
Tomcat_JSP is UP (green).... detects status fine.
 
Last edited:

Planet_Master

Well-Known Member
Apr 18, 2002
232
0
316
New Yorker
I have the same problem and opened a ticket but cPanel says they dont support Tomcat. I told them Tomcat was installed properly and this is a cPanel problem, cannot detect that Tomcat is installed. They brushed me off.

I told them this was going to be an issue with cpanel in the future but they really dont care I guess. Its a shame because I brought this problem to them last week and offered to help to resolve it by giving access to my install and server.

They still could nip this in the bud so to speak if they would just accept that its not Tomcat but cPanel screwing up.
 

Planet_Master

Well-Known Member
Apr 18, 2002
232
0
316
New Yorker
Just as a followup. On even the servers where Tomcat can be started from WHM and is working fine, the following is broken on all my cPanel boxes;
[email protected] [~]# /scripts/restartsrv_tomcat
tomcat is not installed

So this is definately a cPanel issue and not Tomcat and hopefully they will not ignore this until there are hundreds of servers without JSP because of cPanels lack of interest in real time problems.
 

dgbaker

Well-Known Member
PartnerNOC
Sep 20, 2002
2,531
9
343
Toronto, Ontario Canada
cPanel Access Level
DataCenter Provider
Quick fix for this.

ln -s /usr/sbin/starttomcat /usr/sbin/tomcat

cPanel's restartsrv_tomcat script is looking for /usr/sbin/tomcat and since tomcat install (anyones including their own old one) does not create that file it thinks tomcat is not installed. The script is also flawed in the fact it is set for the process owner to be noboby, when in fact it has also been root or tomcat as of late.

This script was also changes/updated on or arount Jul 30th hence why it has "all of a sudden" stopped working.

Definitly a cPanel issue.
 

Planet_Master

Well-Known Member
Apr 18, 2002
232
0
316
New Yorker
tomcat has failed, please contact the sysadmin (result was "tomcat is not running").

Still getting this from WHM and running the script:
[email protected] [~]# /scripts/restartsrv tomcat
Waiting for tomcat to restart..............finished.


tomcat has failed, please contact the sysadmin (result was "tomcat is not running").

As opposed to:
[email protected] [~]# /scripts/restartsrv_tomcat
Using CATALINA_BASE: /usr/local/jakarta/jakarta-tomcat-4.0.3-src/build
Using CATALINA_HOME: /usr/local/jakarta/jakarta-tomcat-4.0.3-src/build
Using CATALINA_TMPDIR: /usr/local/jakarta/jakarta-tomcat-4.0.3-src/build/temp
Using JAVA_HOME: /usr/local/jdk

After running the shortcut command you posted it says not running as opposed to not installed.

I know for a fact Tomcat is installed and running properly but cannot restart from WHM or command line. I truly appreciate your effort dgbaker but I think this is more then the script although I am going to modify using root and tomcat users.

As for the change July 30th, so cPanel has modified something having to do with Tomcat....Hmmm why cant they just admit the F**ked it up?

Oh well back to the drawing board.
 

Planet_Master

Well-Known Member
Apr 18, 2002
232
0
316
New Yorker
Ahh thx to dgbaker for giving me the idea to change the process owner to root I now get Tomcat restarted Ok and it shows its installed but it is not using the correct starttomcat stoptomcat scripts.

This is what I get when I start from WHM:

Attempting to restart tomcat
Waiting for tomcat to restart.... . . . . . . . . . . finished.

Code:
tomcat status root     28962  1.5  4.0 229052 20908 ?      S    17:16   0:05 [COLOR=Red]/usr/local/jdk/bin/java -Djava.endorsed.dirs=/usr/local/jakarta/jakarta-tomcat-4.0.3-src/build/bin:/usr/local/jakarta/jakarta-tomcat-4.0.3-src/build/common/lib -classpath /usr/local/jdk/lib/tools.jar:/usr/local/jakarta/jakarta-tomcat-4.0.3-src/build/bin/bootstrap.jar -Dcatalina.base=/usr/local/jakarta/jakarta-tomcat-4.0.3-src/build -Dcatalina.home=/usr/local/jakarta/jakarta-tomcat-4.0.3-src/build -Djava.io.tmpdir=/usr/local/jakarta/jakarta-tomcat-4.0.3-src/build/temp org.apache.catalina.startup.Bootstrap start[/COLOR]
root     29247  1.0  2.1 12404 10984 ?       S    17:22   0:00 [COLOR=DarkOrange]/usr/local/cpanel/whostmgr/bin/whostmgr ./restomcat[/COLOR]

tomcat started ok


But it should look like this:
Attempting to restart tomcat
Waiting for tomcat to restart.... . . . . . . . . . . finished.

Code:
tomcat status root     28615  0.7  1.0 12416 10444 ?       S    18:25   0:00 [COLOR=DarkOrange]/usr/local/cpanel/whostmgr/bin/whostmgr ./restomcat[/COLOR]
root     28617  0.2  0.1  3516 1740 ?        R    18:25   0:00 [COLOR=RoyalBlue]/usr/bin/perl /scripts/restartsrv tomcat[/COLOR]
root     28659 70.8  2.6 236736 27292 ?      R    18:25   0:03[COLOR=Red] /usr/local/jdk/bin/java -Djava.endorsed.dirs=/usr/local/jakarta/jakarta-tomcat-4.0.3-src/build/bin:/usr/local/jakarta/jakarta-tomcat-4.0.3-src/build/common/lib -classpath /usr/local/jdk/lib/tools.jar:/usr/local/jakarta/jakarta-tomcat-4.0.3-src/build/bin/bootstrap.jar -Dcatalina.base=/usr/local/jakarta/jakarta-tomcat-4.0.3-src/build -Dcatalina.home=/usr/local/jakarta/jakarta-tomcat-4.0.3-src/build -Djava.io.tmpdir=/usr/local/jakarta/jakarta-tomcat-4.0.3-src/build/temp org.apache.catalina.startup.Bootstrap start[/COLOR]

So its still not correctly finding the necessary scripts and/or files to do what I expect.

Any ideas? All I did was modify the /scripts/restartsrv tomcat to show process owner as root. tomcat owner didnt work either. The line in blue is not being called, hope this helps oh java god.
 
Last edited:

dgbaker

Well-Known Member
PartnerNOC
Sep 20, 2002
2,531
9
343
Toronto, Ontario Canada
cPanel Access Level
DataCenter Provider
Well....

From looking at one of mine, even though in whm is says the following;

Code:
Waiting for tomcat to restart.... . . . . . . . . . . finished. 

tomcat status 
root       606  1.1  2.1 12492 11012 ?       S    19:23   0:00 /usr/local/cpanel/whostmgr/bin/whostmgr ./restomcat
root       633  0.0  0.1  1592  544 ?        S    19:23   0:00 jsvc.exec -user tomcat -cp ./bin/bootstrap.jar -Djava.endorsed.dirs=./common/endorsed org.apache.catalina.startup.Bootstrap -debug -outfile ./logs/catalina.out -errfile ./logs/catalina.err

tomcat started ok
The actual server result is;

Code:
root       633     1  0 19:23 ?        00:00:00 jsvc.exec -user tomcat -cp ./bin/bootstrap.jar -Djava.endorsed.dirs=./common/endorse
tomcat     634   633 47 19:23 ?        00:00:11 jsvc.exec -user tomcat -cp ./bin/bootstrap.jar -Djava.endorsed.dirs=./common/endorse
 

uh2

Member
Jan 22, 2004
10
0
151
Attempting to restart tomcat
Waiting for tomcat to restart.... . . . . . . . . . . finished.

tomcat status


tomcat has failed, please contact the sysadmin (result was "tomcat is not running").


Still giving the same error after the ls -s thingy :(
 

dgbaker

Well-Known Member
PartnerNOC
Sep 20, 2002
2,531
9
343
Toronto, Ontario Canada
cPanel Access Level
DataCenter Provider
Edit /scripts/restartsrv_tomcat

change
Code:
my $processowner = 'nobody';
to

Code:
my $processowner = 'root';
change

Code:
 if (!-x '/usr/sbin/tomcat') {
to

Code:
if (!-x '/usr/sbin/starttomcat') {
 

dgbaker

Well-Known Member
PartnerNOC
Sep 20, 2002
2,531
9
343
Toronto, Ontario Canada
cPanel Access Level
DataCenter Provider
uh2 said:
was there a cpanel update on the 30th July 2004?
YEP!!!

cPanel updated/created/changed the following restart scripts (tomcat included)

-rwxr-xr-x 1 1000 users 8161 Jul 30 17:44 restartsrv2*
-rwxr-xr-x 1 1000 users 57 Jul 30 12:41 restartsrv_apache*
-rwxr-xr-x 1 1000 users 57 Jul 30 12:41 restartsrv_bind*
-rwxr-xr-x 1 1000 users 649 Jul 30 17:29 restartsrv_cppop*
-rwxr-xr-x 1 1000 users 671 Jul 30 17:29 restartsrv_entropychat*
-rwx--x--x 1 1000 users 907 Jul 30 17:30 restartsrv_httpd*
-rwxr-xr-x 1 1000 users 57 Jul 30 12:41 restartsrv_imap*
-rwxr-xr-x 1 1000 users 669 Jul 30 17:31 restartsrv_interchange*
-rwxr-xr-x 1 1000 users 660 Jul 30 17:31 restartsrv_melange*
-rwxr-xr-x 1 1000 users 954 Jul 30 17:32 restartsrv_mysql*
-rwxr-xr-x 1 1000 users 62 Jul 30 12:41 restartsrv_postgres*
-rwxr-xr-x 1 1000 users 61 Jul 30 12:41 restartsrv_proftpd*
-rwxr-xr-x 1 1000 users 61 Jul 30 12:41 restartsrv_pureftpd*
-rwxr-xr-x 1 1000 users 920 Jul 30 17:37 restartsrv_tomcat*



They also as you can see screwed up the ownerships. Very sloppy. I'm trying to locate a server that has not been updated before that so to see what exactly changed to know what to fix.
 

casey

Well-Known Member
Jan 17, 2003
2,288
0
191
dgbaker said:
I'm trying to locate a server that has not been updated before that so to see what exactly changed to know what to fix.
Surely, surely, they can at least tell you what they changed. Have you asked? If they are told they broke something, they may not give information, but a simple question like "what part of restartsrv_tomcat changed?" can be given a straight answer, right?
 

Planet_Master

Well-Known Member
Apr 18, 2002
232
0
316
New Yorker
dgbaker said:
I know Planet_Master had inquired and I don't think the even acknowledged a change but cannot say for sure. P_M you around to comment?

Guys I opened a ticket a month ago because I believe I was the first to experience this issue, doing Tomcat installs on ded servers weekly. I knew off the bat it was cPanel and not Tomcat, I mean I know how to install Tomcat already.

My first reply was that cPanel doesnt support Tomcat, which was understandable. So I replied and went through the entire situation and how cPanel was reacting and stressed that I knew it was cPanel and not Tomcat. They kinda blew me off and actually said to get back to them if I found the fix!

In other words I think they know they f*cked it up but dont have the guts to admit it and were waiting for me to fix it and report to them. At least that was the impression I got.

Suffice to say I havent found anything yet after weeks of screwing with every darn file that has connections to the Tomcat restart. I asked them, Casey, if they could reveal to me the structure on how Tomcat is restarted and how it detects Tomcat but received no answer. They want a fix but cannot give me a candle to see in the dark, insane.

So I have one ded customer whos entire site is JSP and using the JDBC and they havent had a Tomcat server in 4 weeks and they have been very patient but it is starting to wear thin.

The scary thing is hosts around the world cannot offer Tomcat on cPanel servers as of now so does this help cPanel and DARK ORB...I THINK NOT.

Right now, to me anyways, cPanel is worthless because JSP is a large part of our hosting business.

So any host looking to use cPanel and Tomcat...Forget it
 
Last edited:
C

cPanelBilly

Guest
I just sent this change to devel it will be merged in the next 15min or so
 

cPanelNick

Administrator
Staff member
Mar 9, 2015
3,481
35
208
cPanel Access Level
DataCenter Provider
cPanelBilly said:
I just sent this change to devel it will be merged in the next 15min or so
New scripts are up, you can get them with an updatenow. We may in the future add offical support for tomcat (linux only) though the new addon module system.
 

Planet_Master

Well-Known Member
Apr 18, 2002
232
0
316
New Yorker
Happy to see both posts above. I will be trying this ASAP and report. Thx guys.

Well I ran update now and even updated to cPanel 9.7.7-E10 and no luck
tomcat has failed, please contact the sysadmin (result was "tomcat is not running").

Maybe I need to reinstall Tomcat? I am just going to build Apache all over and reinstall Java and Tomcat, lets see what happens. If that doesnt work I will try the installer Dgbaker because this client wants the 4.0.3 as his first choice, likes the ANT compiled in.

I see another all nighter ahead.
 
Last edited:

dgbaker

Well-Known Member
PartnerNOC
Sep 20, 2002
2,531
9
343
Toronto, Ontario Canada
cPanel Access Level
DataCenter Provider
bdraco said:
New scripts are up, you can get them with an updatenow. We may in the future add offical support for tomcat (linux only) though the new addon module system.
Thanks Nick -

I've modifed restartsrv_tomcat a little further so that it has the following;

Code:
my $processowner = 'root';
my $subprocessowner = 'tomcat';
Code:
print check_service($service,$processowner);
print check_service($service,$subprocessowner);
The installer for tomcat 5 we have setup is running tomcat under tomcat user and not root, so the restart needs to see both tomcat user and root user.

Also added extra sleeps
Code:
system("sleep 2;/usr/sbin/starttomcat;sleep 5");