Sean,

On 8/8/2016 7:10 AM, Sean Son wrote:
> On Fri, Aug 5, 2016 at 5:34 PM, Mark Eggers <its_toas...@yahoo.com.invalid>
> wrote:
> 
>> On 8/5/2016 2:19 PM, Sean Son wrote:
>>> Hello!
>>>
>>> I am currently running Tomcat 8 on RHEL 7.2 with one web application
>>> called AppVet (A mobile Application  Vetting program).  The
>>> application works well but when I tried to use a script to allow
>>> tomcat to start up at boot, the webapp gives an authentication error.
>>> I saw the following error in the logs for appvet:
>>>
>>>
>>> [ERROR] Could not connect to database:
>>> com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
>>> Communications link failure
>>>
>>> The last packet sent successfully to the server was 0 milliseconds
>>> ago. The driver has not received any packets from the server. Make
>>> sure your MySQL password in your AppVetProperties.xml file is
>>> correct
>>>
>>>
>>> I know for a fact that the MySQL password is correct in that XML
>>> file. I double checked it already.  Any ideas on how I should fix
>>> this error?
>>>
>>> This is the script that I am using for startup/shutdown of Tomcat8 on
>>> boot:
>>>
>>> http://pastebin.com/mrvfDtTD
>>>
>>> Thanks!
>>>
>>> Sean
>>>
>>
>> It appears that your Tomcat process is running as root. Do not do this.
>>
>> Is your MySQL server up and running before Tomcat is started?
>>
>> . . . just my two cents
>> /mde/
>>
>>
> Hello thank you for your response
> 
> I created a user account for Tomcat, I will set the script to use that
> account instead of the root account.   Question though, does this account
> need a password?

Yes, especially since you'll be running a service.

Note that if you're running Tomcat on a privileged port (less than
1024), a non-root account will not be able to bind to this port.

You have three choices.

1. iptables

route port 80 to port 8080 (Tomcat default) internally. Take a look at
the iptables documentation.

2. jsvc

jsvc from the Apache Commons Daemon project allows you to run a service
such as Tomcat more easily. I don't remember if there is an RPM for RHEL
or not (possible in EPEL). It's configuration and startup script are
different, but the documentation is a good start (there are Tomcat
examples).

https://commons.apache.org/proper/commons-daemon/jsvc.html

3. Apache HTTPD front end with mod_proxy_ajp or mod_jk

I'd do this if you need Apache HTTPD for other web applications (a PHP
application, perhaps). There is good documentation available on the
Tomcat web site, as well as a ton of discussion on the mailing list to
get this running.

If you don't feel like building software, I'd recommend mod_proxy_ajp. I
find mod_jk more flexible and a little easier to use (opinions on easy
of use vary), but you'd have to build mod_jk from source. It's easy to
do, but some people find that a little more challenging.

> 
> Also, I cant tell if the MySQL server is up and running prior to Tomcat
> being started. I know that mysqld is enabled to start at boot, but I dont
> know if Tomcat starts prior to MySQL.  How would I figure that out?
> 

I thought REHL 7 uses systemd and not init scripts?

There have been many discussions on the mailing list concerning systemd
and Tomcat. I think someone has posted appropriate systemd scripts.

If not, then look at /etc/rc3.d. Start and stop scripts are executed in
numerical order. Start scripts start with S, stop scripts start with K.

Adjust the numbers in your Tomcat init script (/etc/initinit.d) so that
the start comes after MySQL (second number in the chkconfig line).

You'll have to chkconfig --del and chkconfig --add to have the new
numbers take effect in /etc/rcx.d.

> 
> Thanks!
> 

. . . just my two cents
/mde/


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to