Operating System - HP-UX
1752724 Members
5755 Online
108789 Solutions
New Discussion

Re: Am unable to start Tomcat using the startup.sh script

 
Dennis Handly
Acclaimed Contributor

Re: Am unable to start Tomcat using the startup.sh script

>meant to post this under "Systems Administration" forum. Is there any way that I can move this

thread/posting over to the  "System Administration"  group?

 

I thought it started there and they moved it here, probably since java was mentioned?

I'll ask that it be moved back.

6 REPLIES 6
Rob Sandifer58
Frequent Advisor

Re: Am Unable To Start Tomcat Using The Startup.sh Script

Dennis,

 

Thanks for looking into this;  although if this thread would be better served by leaving it in this

group,  then that is fine. 

 

Regards,

 

Rob Sandifer

Rob Sandifer
Dennis Handly
Acclaimed Contributor

Re: Am unable to start Tomcat using the startup.sh script

>if this thread would be better served by leaving it in this group

 

It didn't make that much sense to me.  RC scripts have more to do with sysadmin than scripting.

Rob Sandifer58
Frequent Advisor

Re: Am unable to start Tomcat using the startup.sh script


@Dennis Handly wrote:

>if this thread would be better served by leaving it in this group

 

It didn't make that much sense to me.  RC scripts have more to do with sysadmin than scripting.


I would agree.  The nature of my problem/questions is focused on why I am unable to get certain aspects of

tomcat to run/work correctly.  I actually have tomcat up and running now;  the immediate problem is to try to find out why it will serve up only plain HTML and and not serve up the servlets.  Anyone?

 

Regards,

 

Rob S.

Rob Sandifer
Matti_Kurkela
Honored Contributor

Re: Am unable to start Tomcat using the startup.sh script

Do you see a "catalina.out" file anywhere? That's the place where Tomcat should normally be writing at least its start-up messages and any configuration errors it might detect. Read it. If it's huge, look at the most recent messages only. (And add "setting up a log file rotation for Tomcat" to your list of future tasks.)

 

If the servlets ran fine when Tomcat was running on Java 1.5, it is obvious that the servlets were written for Java 1.4 or older. Therefore, there might be some issues running them on java7, a much much newer version. If that is the case, you'll probably find plenty of Java exceptions dumped in your catalina.out file.

 

If you have the "lsof" utility installed, you could identify the process that listens on port 8081 with:

lsof -i tcp:8081

 Once you know the PID of the process, a second lsof command would list all the files opened by it:

lsof -p <PID of the tomcat Java process>

 The output of the second command may be rather long, but it can be useful in locating the log files the process writes to. (Use grep to find all instances of the word "log" in the listing to make your work easier.)

 

If you don't have "lsof" installed, you can find it in the HP-UX Internet Express package (included with the HP-UX installation media kit, and free to download from software.hp.com). You'll only need to install the ixLsof depot/product, not the entire Internet Express package.

MK
Rob Sandifer58
Frequent Advisor

Re: Am unable to start Tomcat using the startup.sh script

Hello MK and thanks for your comments!

 

# /usr/contrib/bin/lsof -i tcp:8081 COMMAND  PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME java    3158 root   28u  IPv4 0xe0000001ecd18900      0t0  TCP *:8081 (LISTEN)

 

So it appears that java is listening on port 8081.

 

I did notice something which might be important in the overall scheme of things and I'm not understanding the connection between the following two facts:

 

(1)  # ps -ef | grep java     root  1829     1  0  Dec 20  ?        716:06 /opt/java1.4/jre/bin/IA64N/java -DRunnerValuePairFile=/var/opt/runner/data/valuePairs -cp /opt/runner/java/runner.jar: com.hp.m

 root  3158     1  0  Jul 16  ?         3:10 /opt/java1.4/bin/IA64N/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -XdoCloseWithReadPending -Djava.e

 

(2)   /etc/rc.config.d/hpws_tomcatconf indicates:

JAVA_HOME=/opt/java7

 

This is somewhat confusing;  (1) seems to suggest that the version of java which is running is actually java1.4

while (2) indicates that the JAVA_HOME variable is declared to "equal" (=)  /opt/java7

 

Does this possibly indicate that an older version of java (version 1.4) is currently running and that the java version which should be running should be Java7?   The end user has requested that the machine

be running a java version that is at least as current as 1.6

 

Three different versions of java are currently installed on this machine and maybe I need to figure out which java version should actually be running  so that I can correctly configure  /etc/rc.config.d/hpws_tomcatconf  so that I can move forward in the troubleshooting/discovery process....

 

# ls  /opt | grep java

java1.4

java1.5

java7  

 

Thanks!

 

Rob S.

Rob Sandifer
Matti_Kurkela
Honored Contributor

Re: Am unable to start Tomcat using the startup.sh script

From the lsof output, I see the PID of Tomcat is 3158.

 

(1) The process with PID 1829 is not your Tomcat. This is another instance of Java, running /opt/runner/java/runner.jar: it is most likely a part of the HP ISEE (Instant Support Enterprise Edition) tools.

 

With the lsof output, I can confirm that the process with PID 3158 is your Tomcat, and it currently seems to be running on Java 1.4.

 

(2) A change in /etc/rc.config.d/hpws_tomcatconf takes effect only if:

  1. you restart Tomcat using the appropriate startup script (/sbin/init.d/hpws_tomcat I think) after making the configuration change, and
  2. the JAVA_HOME setting is not overridden at any later point.

If you used startup.sh to restart Tomcat after modifying /etc/rc.config.d/hpws_tomcatconf, your configuration file change was most likely ignored.

 

The HP-UX startup scripts like /sbin/init.d/hpws_tomcat usually take their settings from /etc/rc.config.d by sourcing the script /etc/rc.config, which then sources all the scripts in /etc/rc.config.d in standard ASCII alphanumerical order. Some well-known backup file suffixes are avoided. (By the way, this is also the reason why you should never leave extra copies of any configuration files in the /etc/rc.config.d directory.)

 

So if one configuration file sets a particular variable to one value, and a later configuration file sets it to another value, the latter value remains in effect. This is why all the variables used in /etc/rc.config.d/* files should be prefixed with the name of the service they belong to, or otherwise made unique. The plain "JAVA_HOME" is very generic, so setting it in /etc/rc.config.d is asking for trouble.

 

If the startup script (say, /sbin/init.d/hpws_tomcat) contains a line like:

export JAVA_HOME=$HPWS_JAVA_HOME

 then you're supposed to use the variable name HPWS_JAVA_HOME in /etc/rc.config.d/hpws_tomcatconf instead of plain JAVA_HOME. (I don't have a system with hpws_tomcat installed available to me at the moment, so I cannot check.)

 

I would check if /sbin/init.d/hpws_tomcat uses the startup.sh to ultimately start Tomcat, or if it simply does approximately the same actions as the startup.sh. If hpws_tomcat uses startup.sh, then you should check if the startup.sh contains environment variable settings that override the JAVA_HOME setting inherited from the startup script. Someone familiar with Tomcat on other platforms might have been used to editing startup.sh to modify the Java environment variables and Java options for Tomcat, and might not have known about the HP-specific startup script.

MK