LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-14-2012, 04:22 AM   #1
troubledhoster
LQ Newbie
 
Registered: Jan 2012
Posts: 5

Rep: Reputation: Disabled
Connectivity issues between Tomcat 6.0.35 and Apache 2.2 Web Server


Hi,

I am new to linux and been trying to setup and configure Different servers on my own obviously with many difficulties

I have been trying to configure Tomcat Server with Apache through mod_jk. Have configured the servers but seems that the connectivity is broken somewhere.

I am guessing this for two reasons
1: When i am opening the link to my site which is hosted on a vps server.
I could see the html pages but the JSP pages opens as an html or it displays the whole code. There is no error message displayed.

2:The mod_jk.log file does not have anything, its empty. Also when i checked the error_logs I cud see only a suucceful meesage for apche nothing about mod_jk

Mentioned bellow is the configuration in the httpd.conf

Workers.properties
server.xml

httpd.conf
LoadModule jk_module modules/mod_jk.so
JkWorkersFile /etc/httpd/conf/workers.properties
JkLogFile conf/mod_jk.log
JkLogLevel error
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13

Workers.properties
workers.tomcat_home=/opt/tomcat/apache-tomcat-6.0.35
workers.java_home=/opt/java/jdk1.6.0_26
ps=/
worker.list=tomcat,loadbalancer

worker.tomcat.port=8009
worker.tomcat.host=111.118.214.126
#worker.tomcat.host=localhost
worker.tomcat.type=ajp13
worker.tomcat.lbfactor=1

worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=tomcat
worker.loadbalancer.sticky_session=1
 
Old 01-14-2012, 08:21 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,910

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
Hi,

AFAIK in recent apache/mod_jk versions, the mod_jk related derectives should be inside a vhost container. E.g.
Code:
<VritualHost *:80>
ServerName localhost
JkWorkersFile /etc/httpd/conf/workers.properties
JkLogFile conf/mod_jk.log
JkLogLevel error
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
...
</VirtualHost>
Also note that you have defined 2 workers (tomcat,loadbalancer) in workers.properties,
Quote:
worker.list=tomcat,loadbalancer
but you're using a different one in apache config:
Quote:
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
So change the above to:
Code:
JkMount /*.jsp tomcat
JkMount /servlet/* tomcat
restart apache and see if it works

Regards
 
Old 01-14-2012, 11:02 PM   #3
troubledhoster
LQ Newbie
 
Registered: Jan 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thanks for the Promt response , bathory. I did change the definition for the workers in the properties file as as you suggested but am still facing the same issue.

However, when I looked at the catalina.output i saw this which seems to be a problem,

NFO: Deploying web application directory _notes
Jan 15, 2012 1:18:18 AM org.apache.coyote.http11.Http11Protocol start
SEVERE: Error starting endpoint
java.net.BindException: Address already in use <null>:80
at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:549)
at org.apache.tomcat.util.net.JIoEndpoint.start(JIoEndpoint.java:565)
at org.apache.coyote.http11.Http11Protocol.start(Http11Protocol.java:203)
at org.apache.catalina.connector.Connector.start(Connector.java:1122)
at org.apache.catalina.core.StandardService.start(StandardService.java:540)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.net.BindException: Address already in use

I kept changing the port in server.xml from 8080 to 8085 and finally 80 but its the same error message.

Mentioned below are the parameters from my server.xml
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

I read somewhere that Tomcat server cud only suffice to the requirement of hosting html + jsp pages but its usually slow. Is this true.. ? Are there any setbacks using Tomcat only as the web server.

In a panic mode I thot i must try this and I closed Apache server and with all the settings and changes in place started Tomcat and checked on the broswer

Where i was welcomed by a jakarta page , however when i changed the address to "www.mydomain.com/folder where i am keeping my files/index.html
it opened the html page. And alll the JSP pages were working.

Could anyone of you please suggest how can i tell Tomcat to point the domain to Index.html

In apache i have made a virtual server and then have directed it to use the the path where all my jsp + html pages are located.

Many Thanks for your help
 
Old 01-15-2012, 04:03 AM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,910

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
Quote:
SEVERE: Error starting endpoint

<-snip->

I kept changing the port in server.xml from 8080 to 8085 and finally 80 but its the same error message.

<-snip->
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
Leave it to the default 8080 and make sure tomcat is started before apache and it works standalone.

Quote:
I read somewhere that Tomcat server cud only suffice to the requirement of hosting html + jsp pages but its usually slow. Is this true.. ? Are there any setbacks using Tomcat only as the web server.
You can use tomcat as a webserver to serve plain html pages, but it's not optimized to do this. So in a production environment, it does not do well as a webserver. You can take a look at this for a comparison.


Quote:
Could anyone of you please suggest how can i tell Tomcat to point the domain to Index.html
If you are absolutely sure you want your tomcat to serve your static content, then you should place it under /<tomcat-install-dir>/webapps/ROOT

Regards

Last edited by bathory; 01-15-2012 at 04:08 AM.
 
Old 01-15-2012, 08:56 AM   #5
troubledhoster
LQ Newbie
 
Registered: Jan 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thanks a lot , bathory. That solved my problem .. For now I am using Tomcat as a server even in production wanted to perform some testing but wud look side by side at the issues with Apache and tomcat server integration at my end. Seems I must be missing something here or there at my end.

Would take that further again on the same thread maybe. Many Thanks for your help

Cheers!!
 
  


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
Apache Web Server + Tomcat 6 issues tpe Linux - Server 12 01-18-2010 03:11 AM
Please help with Apache Web Server / Apache Tomcat / PHP / Java / PHP-Java Bridge jpmad4it Linux - Server 2 01-05-2009 06:07 AM
Apache Tomcat 5.5 install issues. brave heart Red Hat 4 08-05-2007 09:46 PM
New Web Applications to Apache-Tomcat Web sarathmohan Linux - Software 0 10-02-2003 02:59 AM
Apache Tomcat web Server hardware config homyarb Linux - Software 2 04-16-2003 12:36 AM


All times are GMT -5. The time now is 07:24 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration