Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Documentation, Tips & Tricks
  • Search

Integrate Tomcat With Apache Using mod_jk

Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Post Reply
Advanced search
80 posts
  • 1
  • 2
  • 3
  • 4
  • Next
Author
Message
MrStaticVoid
Tux's lil' helper
Tux's lil' helper
Posts: 114
Joined: Fri Jul 25, 2003 1:36 am
Location: Maryland

Integrate Tomcat With Apache Using mod_jk

  • Quote

Post by MrStaticVoid » Thu Oct 09, 2003 9:59 pm

Integrate Tomcat With Apache Using mod_jk

Before you begin
These instructions were written for Tomcat 4.1. Since the time of this writing a new version of Tomcat, Tomcat 5, has been released. In Tomcat 5, mod_jk2 is the perfered linking method. Continue reading this thread for more information about mod_jk2.

What will be done?
By default Tomcat is setup to use port 8080. In order to let users view your JSP or Servlet pages, they would have to navigate outside of your main Apache site. This also made using SSL in Java pages an impossibility. When linking your Tomcat server with your Apache server, Apache forwards its *.jsp and */servlet/* requests to Tomcat using an intermediate module, mod_jk. There is a more advanced module called mod_jk2 available, but due to its lack of any documentation, very few servers use it. mod_jk is preferred.

Setup Apache
If you already have Apache setup, great, skip this section. Otherwise just

Code: Select all

# emerge sync
# emerge apache

# rc-update add apache2 default
# /etc/init.d/apache2 start
Goto http://localhost to see if Apache works. You can also use Apache 1.3, however I have not tested it and I'll leave it up to you to figure out the best way to include the configuration information.

Setup Tomcat
In the following section you will setup the JSP and Servlet server, Tomcat 4.1.

Code: Select all

# emerge tomcat
There is a bug in the default permissions for a configuation file that does not allow Tomcat to start.

Code: Select all

# chmod 755 /etc/conf.d/tomcat
Now set Tomcat to load at startup and start the server.

Code: Select all

# rc-update add tomcat default
# /etc/init.d/tomcat start
Goto http://localhost:8080 to see if Tomcat works.

mod_jk will only work with Tomcat >= 4.0. If you are not using a JDK from Portage, you may have to specify your JDK's path in /etc/conf.d/tomcat.

Compile mod_jk
Download the latest source to mod_jk and unpack:

Code: Select all

$ wget http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk/release/v1.2.4/src/jakarta-tomcat-connectors-jk-1.2.4-src.tar.gz
$ tar -xvzf jakarta-tomcat-connectors-jk-1.2.4-src.tar.gz
Now you'll have to prepare your system for the build.

Code: Select all

# mkdir /usr/build
# updatedb
# locate config_vars.mk
The config_vars.mk file should be in something like /usr/lib/apache2/build/ but it may be in a different location if you use Apache 1.3. Copy that file to /usr/build/

Code: Select all

# cp /usr/lib/apache2/build/config_vars.mk /usr/build/
Now we'll compile.

Code: Select all

$ cd jakarta-tomcat-connectors-jk-1.2.4-src/jk/native/
$ ./buildconf.sh
$ ./configure --with-apxs=/usr/sbin/apxs2
$ make
If you are using Apache 1.3 you need to use the configure flag '--with-apxs=/usr/sbin/apxs'.

Now copy the module to a place safe place:

Code: Select all

# cp apache-2.0/mod_jk.so /usr/lib/apache2-extramodules/
Now the fun begins...link 'em up!
Open up /opt/tomcat/conf/server.xml in your favorite text editor. After the line
<Server port="8005" shutdown="SHUTDOWN" debug="0">
add
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" />
and after the line
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true">
add
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" append="true" />
Save the file and restart Tomcat.

Code: Select all

# /etc/init.d/tomcat restart
Wait about a minute (I'm serious...I don't care how fast your computer is) for Tomcat to parse the configuration. You should now have directories called 'auto' and 'jk' in /opt/tomcat/conf/. Copy /opt/tomcat/conf/auto/mod_jk.conf to /etc/apache2/conf/modules.d/. Delete every thing in your newly copied mod_jk.conf except for the JkMount lines. Edit that file to look something like:
<IfDefine JK>
<IfModule !mod_jk.c>
LoadModule jk_module extramodules/mod_jk.so
</IfModule>
</IfDefine>

<IfModule mod_jk.c>
JkWorkersFile /opt/tomcat/conf/jk/workers.properties
JkLogFile /opt/tomcat/logs/mod_jk.log
JkLogLevel emerg

JkMount /admin ajp13
JkMount /admin/* ajp13

JkMount /webdav ajp13
JkMount /webdav/* ajp13

JkMount /examples ajp13
JkMount /examples/* ajp13

JkMount /tomcat-docs ajp13
JkMount /tomcat-docs/* ajp13

JkMount /manager ajp13
JkMount /manager/* ajp13
</IfModule>
As you see in the new mod_jk.conf there a line defining where the workers.properties file is. The workers.properties is a file that specifies mod_jk's linking type, ports, and loadbalancers if you want them. I have created the most simple workers.properties as possible. You should create this file in /opt/tomcat/conf/jk/.
workers.tomcat_home=/opt/tomcat
workers.java_home=/opt/blackdown-jdk-1.4
ps=/

worker.list=ajp13

worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
Change the paths as necessary. To enable mod_jk in Apache, edit /etc/conf.d/apache2 to have
APACHE2_OPTS="-D JK"
Make sure APACHE2_OPTS is uncommented! Now restart Apache and navigate to http://localhost/tomcat-docs/. Since tomcat-docs has been "JkMount"ed, Apache will forward requests to Tomcat. If you see the Tomcat documentation, then everything has been set up correctly.

Well so much for my first post to the documentation forum. Please give me comments or ask me questions.
Last edited by MrStaticVoid on Sat Apr 24, 2004 9:21 pm, edited 2 times in total.
Top
Lehren
n00b
n00b
Posts: 4
Joined: Sun Oct 12, 2003 3:04 am

tried it all the way through..

  • Quote

Post by Lehren » Sun Oct 12, 2003 3:07 am

.. everything worked just fine. Thank you!

Two things:

1) Emerging apache and tomcat adds users to your system, make sure you address the default passwords.

2) The only mistake I made was missing the 'extralibs' path to in the new mod_jk.conf file. I'd highlight that as an existing line that needs to be changed.
Top
aent
n00b
n00b
Posts: 49
Joined: Sat May 24, 2003 6:39 pm
Location: Here
Contact:
Contact aent
Website

  • Quote

Post by aent » Sun Oct 12, 2003 6:44 pm

For those of you who want mod_jk2 you can basicly follow the instructions above, but it does require some modifications to it:
This is basicly what I did:

Code: Select all

# wget http://apache.mirrors.pair.com/jakarta/tomcat-connectors/jk2/jakarta-tomcat-connectors-jk2-src-current.tar.gz
# tar -xvzf jakarta-tomcat-connectors-jk2-src-current.tar.gz
# mkdir /usr/build
# ln -s /usr/bin/libtool /usr/build/libtool
# cp /usr/lib/apache2/build/config_vars.mk /usr/build/
# cd jakarta-tomcat-connectors-jk2-2.0.2-src/jk/native2/
# chmod 0777 buildconf.sh
# ./buildconf.sh
# ./configure --with-apxs2=/usr/sbin/apxs2
# make clean build
# libtool --finish /usr/lib/apache2
# cp ../build/jk2/apache2/mod_jk2.so /etc/apache2/extramodules/
# cp ../build/jk2/apache2/jkjni.so /etc/apache2/extramodules/
# cp /opt/tomcat/conf/auto/mod_jk.conf /etc/apache2/conf/modules.d/
Now you'll need to modify the mod_jk.conf file... Basicly delete everything but <IfModule !mod_jk2.c> .. </IfModule>, which jk_module needs to be changed to jk2_module and the path to mod_jk2.so needs to be corrected...

Add

Code: Select all

<VirtualHost *>
<Location /*.jsp">
JkUriSet worker ajp13:localhost:8009
</Location>
</VirtualHost>
Next we'll need to modify server.xml to include the Apache-Tomcat service.
Add this below <Server port="8005" shutdown="SHUTDOWN" debug="0">:

Code: Select all

  <Service name="Tomcat-Apache">
 
   <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
               port="8009" minProcessors="5" maxProcessors="75"
               enableLookups="true" redirectPort="8443"
               acceptCount="10" debug="0" connectionTimeout="20000"
               useURIValidationHack="false"
               protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>

	<Engine name="Apache" defaultHost="localhost" debug="0">

      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="apache_log." suffix=".txt"
              timestamp="true"/>
	  <!-- Access log processes all requests for this virtual host. -->
      <Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="localhost_access_log." suffix=".txt"
                 pattern="common" resolveHosts="false"/>

	<Host name="localhost" debug="0"
appBase="/home/httpd/htdocs" 
       unpackWARs="true" autoDeploy="true">
		<Alias>localhost</Alias>
		<Alias>www</Alias>
		<Alias>10.0.0.10</Alias>


		<Context path="" docBase="" debug="1"/>

		<Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="home_access_log." suffix=".txt"
                 pattern="common" resolveHosts="false"/>
	</Host>
</Engine>
</Service>
Add this to jk2.properties:

Code: Select all

# list of needed handlers.
handler.list=channelSocket,request
# Override the default port for the channelSocket
channelSocket.port=8009
In /etc/apache2/conf/ make a file called workers2.properties and stick this inside:

Code: Select all

[logger.apache2]
level=DEBUG

[shm]
file=/etc/apache2/logs/shm.file
size=1048576

[channel.socket:localhost:8009]
port=8009
host=127.0.0.1

[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
Restart tomcat and apache2 and everything should be good to go!
Top
jwever
n00b
n00b
User avatar
Posts: 72
Joined: Fri Sep 12, 2003 3:28 am

  • Quote

Post by jwever » Sun Oct 12, 2003 9:42 pm

The method for mod_jk2 worked for me except I had to change the following ...
# ./configure --with-apxs2=/usr/sbin/apxs2
to

Code: Select all

# ./configure --with-apxs2=/usr/sbin/apxs2 --with-tomcat41=/opt/tomcat
Top
cederberg
Guru
Guru
User avatar
Posts: 349
Joined: Thu Jan 23, 2003 12:41 am
Location: Stockholm / Sweden
Contact:
Contact cederberg
Website

ebuild for mod_jk2

  • Quote

Post by cederberg » Thu Oct 16, 2003 6:09 pm

This bug might be of interest, as it contains an ebuild for mod_jk2.
Top
brondsem
n00b
n00b
Posts: 6
Joined: Tue Jul 08, 2003 11:45 pm
Location: Grand Rapids, MI
Contact:
Contact brondsem
Website

hostname

  • Quote

Post by brondsem » Wed Oct 22, 2003 3:24 am

If you are running your computer with a hostname other than localhost (e.g., csx.calvin.edu) then you need to change /opt/tomcat/conf/auto/mod_jk.conf to reflect this.

<VirtualHost csx.calvin.edu>
ServerName csx.calvin.edu
......
......
Top
AllTom
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 147
Joined: Wed Nov 26, 2003 6:18 pm
Location: Wherever danger lies...
Contact:
Contact AllTom
Website

Brilliant

  • Quote

Post by AllTom » Wed Nov 26, 2003 6:21 pm

Brilliant. Amazing. I can't believe this post made it so easy! Thank you very, very much!! :D
rtylershaw: "My computer doesn't even work and I love this distro. Weird."
Top
fatpiper
n00b
n00b
Posts: 18
Joined: Wed Sep 10, 2003 6:59 pm
Location: UK

  • Quote

Post by fatpiper » Wed Jan 14, 2004 9:43 pm

I saw the post on using VirtualHost in order to make this useful for hosts other than localhost ... Could somebody please post some more details on where this VirtualHost directive goes?

Thanks!
--
"The power of accurate observation is commonly called cynicism by those who do not have it." -- George Bernard Shaw
Top
frequency
n00b
n00b
Posts: 5
Joined: Tue Jan 06, 2004 9:43 pm

JSP's not executing

  • Quote

Post by frequency » Thu Jan 29, 2004 10:28 pm

I've tried both examples of how to configure Apache2 and Tomcat, in both instances the servers don't give me an errors but I am unable to get the tomcat engine to handle the request.

<HTML>
<BODY>
Testing JSP
<% System.out.println("HELLO WORLD"); %>
Ending Test
</BODY>
</HTML>

Outputs: Testing JSP Ending Test

This file is inside /var/www/localhost/htdocs/jsptest/
I'm not sure if permissions have anything to do with it, But I gave the file 755.


If anyone could help me out I would appreciate it, I'm still very new to the linux enviorment

-Thank You for your time
Top
Ulukai
n00b
n00b
Posts: 7
Joined: Wed Jun 25, 2003 5:38 pm

/opt/tomcat/conf/auto/mod_jk.conf not generated

  • Quote

Post by Ulukai » Mon Feb 02, 2004 10:32 pm

Hi,

Thanks for sharing your knowledge.

I had some problems during the build..
After the attempt to install mod_jk with the suggestions posted from "Mr. Static Void" (which failed), I tried to follow the suggestions posted by "aent".
All steps but one succeeded.
There was no file named /opt/tomcat/conf/auto/mod_jk.conf after all.
There was not even a directory called /opt/tomcat/conf/auto
I´m using Tomcat 4.1 and Apache2 and followed your suggestions step by step and also tried
./configure --with-apxs2=/usr/sbin/apxs2 --with-tomcat41=/opt/tomcat

but that didn´t work.
I would be very glad if someone could help me.
Thanks in advance,

Ulukai
.::the trick is to keep breathing::.
Top
MrStaticVoid
Tux's lil' helper
Tux's lil' helper
Posts: 114
Joined: Fri Jul 25, 2003 1:36 am
Location: Maryland

  • Quote

Post by MrStaticVoid » Fri Feb 13, 2004 8:51 pm

frequency,

To clear things up: there is no way to get Apache to send the JSP to Tomcat for parsing in the way the Apache sends PHP to the PHP interpreter. Your JSP must go into a webapp of Tomcat. Then you can setup mod_jk to forward requests from Apache to Tomcat for the JSP.

For example, for my website I created a webapp called the_static_void.

Code: Select all

# mkdir /opt/tomcat/webapps/the_static_void /opt/tomcat/webapps/the_static_void/WEB-INF
Then I put the following text into WEB-INF/web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
</web-app>
That tells Tomcat about your webapp and maps Servlet requests.

From there plop your JSP's into the root of your webapp. You should be able to see them by going to http://localhost:8080/<webappname>/<jspname>.jsp

Then to have Apache see it, follow the instructions of my original post, adding the JkMount lines for your webapp mod_jk.conf. After restarting Apache, you should be able to see your JSP by going to http://localhost/<webappname>/<jspname>.jsp

Easy, eh?

Ulukai,

The auto directory should appear after you modify your server.xml as per my original post, and restart Tomcat. Try again and report your success or failure.

I'm happy some people are finding my post useful! :D
Top
frequency
n00b
n00b
Posts: 5
Joined: Tue Jan 06, 2004 9:43 pm

Still having problems

  • Quote

Post by frequency » Mon Feb 16, 2004 12:03 am

I get a Internal Server Error when I try to view the tomcat page. My /opt/tomcat/conf/auto/mod_jk.conf always gets overwritten and in my catalina.log i have
INFO: Initializing Coyote HTTP/1.1 on port 8080
mod_jk location: libexec/mod_jk.so
Make sure it is installed corectly or set the config location
Using <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" modJk="PATH_TO_MOD_JK.SO_OR_DLL" />
Starting service Tomcat-Standalone
I dont see anythign in my /var/log/apache2/error_log file

any ideas?
Top
albanard
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 92
Joined: Sat Nov 22, 2003 2:33 am

libtool: cannot install .. to a directory not ending in ..

  • Quote

Post by albanard » Tue Feb 17, 2004 6:46 am

I've followed the instructions but make fails with this message:

libtool: install: error: cannot install `../../../build/jk2/apache2/libjkjni.la' to a directory not ending in /usr/lib/apache2

Does anyone know how to get around this?


Versions Tried:

jakarta-tomcat-connectors-jk2-2.0.2-src
(also tried jakarta-tomcat-connectors-4.1.29-src)

bash-2.05b# libtool --version
ltmain.sh (GNU libtool) 1.4.3 (1.922.2.111 2002/10/23 02:54:36)
(also tried: 1.4.1)
Last edited by albanard on Tue Feb 17, 2004 12:05 pm, edited 1 time in total.
Top
christsong84
Veteran
Veteran
User avatar
Posts: 1003
Joined: Sun Apr 06, 2003 10:04 pm
Location: GMT-8 (Spokane)

  • Quote

Post by christsong84 » Tue Feb 17, 2004 7:18 am

i can't find the connecter file anywhere :(
while(true) {self.input(sugar);} :twisted:
Top
albanard
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 92
Joined: Sat Nov 22, 2003 2:33 am

  • Quote

Post by albanard » Tue Feb 17, 2004 9:40 am

The connector source mentioned for jk2 is:

http://apache.mirrors.pair.com/jakarta/ ... ent.tar.gz

Your local mirror can be naviagted to from:
http://jakarta.apache.org/site/sourceindex.cgi


OLD:
Do you mean the connector source tar.gz file? I think the latest is 4.1.30 , but I've been having better luck with 4.1.29 apart from my libtool problem above. Anyway here is a link: http://www.apache.org/dist/jakarta/tomcat-4/v4.1.29/src
Top
albanard
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 92
Joined: Sat Nov 22, 2003 2:33 am

  • Quote

Post by albanard » Tue Feb 17, 2004 12:03 pm

EDIT: THIS PROBLEM IS NOW FIXED IN THE LATEST CVS SOURCES AVAILABLE AT: http://cvs.apache.org/snapshots/jakarta ... onnectors/

I tried downgrading libtool and it didn't help:

bash-2.05b# libtool --version
ltmain.sh (GNU libtool) 1.4.1 (1.922.2.34 2001/09/03 01:22:13)

This seems like such a stupid problem, does anyone know a workaround? I still get the dreaded:

libtool: install: error: cannot install `../../../build/jk2/apache2/jkjni.la' to a directory not ending in /usr/lib/apache2
make[1]: *** [../../../build/jk2/apache2/jkjni.so] Error 1
Last edited by albanard on Sat Apr 17, 2004 1:31 pm, edited 1 time in total.
Top
Tarantula
n00b
n00b
Posts: 1
Joined: Fri Feb 20, 2004 10:36 am

  • Quote

Post by Tarantula » Fri Feb 20, 2004 10:47 am

I emerged apache 2 and tomcat 5, but I can't find the /opt/tomcat/conf/auto/ directory ! :(

Could you tell me where the "mod_jk.conf" is in tomcat 5 ?
Could you mind tell me how to use tomcat5 with jakarta-tomcat-connectors-jk2-2.0.2 ?
Should I use other connector for tomcat5 with apache 2 ?
Top
tomarsyd
n00b
n00b
Posts: 7
Joined: Wed Feb 25, 2004 3:14 am

  • Quote

Post by tomarsyd » Wed Feb 25, 2004 3:21 am

I've installed jboss-3.2.3.tgz (includes Tomcat 4.1.29 JBossWeb HTTP server and JSP/Servlet engine, EJB, CMP2.0, JCA, IIOP, Clustering, JTA, JMX and more)
and have successfully built mod_jk2.so according to the very nicely explained directions above (Thank you Mr. Static Void)

On one of the last steps in his description (on the third post, his follow-up post) he says to cp /opt/tomcat/conf/auto/mod_jk.conf /etc/apache2/conf/modules.d/

First of all there was no mod_jk.conf file included in any of the packages I downloaded, and secondly, there is no /opt/tomcat/... directory because I haven't installed Tomcat explicitly, It came in the jboss package.

What do I do here?

You can also see my question on the Jboss forums at:
http://www.jboss.org/index.html?module= ... 08#3822808


Any help is much appreciated.
Regards,
Tom Meeks
www.tomar.no-ip.com
Top
JCScoobyRS
n00b
n00b
Posts: 57
Joined: Thu Dec 18, 2003 2:43 am
Location: Colorado, USA
Contact:
Contact JCScoobyRS
Website

  • Quote

Post by JCScoobyRS » Wed Feb 25, 2004 5:08 pm

To get mod_jk to work with Tomcat 5, just make the changes to the listener's className to look like:

org.apache.jk.config.ApacheConfig

instead of:

org.apache.ajp.tomcat4.config.ApacheConfig

Everything else in the tutorial is valid. Just follow the instructions and make those changes and all will be well. Laters, Jeremy
He who listens well, speaks well.
Top
9uSt00
n00b
n00b
User avatar
Posts: 24
Joined: Mon Feb 23, 2004 1:07 pm
Location: 59.9.9 ° N
Contact:
Contact 9uSt00
Website

bug in Tomcat jsvc

  • Quote

Post by 9uSt00 » Thu Mar 04, 2004 11:41 pm

Hello.. i just installed tomcat by

Code: Select all

emerge tomcat
that worked just fine.

Then, when i went into the /opt/tomcat/bin directory and untarred the jsvc.tar.gz file, changed to the src dir, and configured without any problems. The problem i found was when i ran 'make'. There's a bug in the native/home.c file on line 110 where a semi colon has been left out. so i changed

Code: Select all

        /* Format changed for 1.4 JVMs */
        sp = strchr(ret, ' ');
        if(sp != NULL)
            *sp = '\0'
to

Code: Select all

        /* Format changed for 1.4 JVMs */
        sp = strchr(ret, ' ');
        if(sp != NULL)
            *sp = '\0';    /* <---- here */
Restarting apache2 works perfectly, but I'm not able to start tomcat. The /etc/init.d/tomcat start command simply outputs:

Code: Select all

 * Starting Tomcat...
Using CATALINA_BASE:   /opt/tomcat
Using CATALINA_HOME:   /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JAVA_HOME:       /opt/sun-jdk-1.4.2.03
But the funny thing is that when i do a ps axf, i don't see the tomcat processes at all. In addition, my syslog shows this:

Code: Select all

Mar  5 03:23:25 [su(pam_unix)] session opened for user tomcat by root(uid=0)
Mar  5 03:23:25 [su(pam_unix)] session closed for user tomcat
Mar  5 03:23:25 [kernel] grsec: From xxx.xxx.xxx.xxx: signal 11 sent to (java:16471) UID(265) EUID(265), parent (init:1) UID(0) EUID(0)
I'm assuming that since i have the GrSecurity options in the kernel set to meduim, they're causing some problems, but i'm not sure what to do. Any suggestions?

cheers.
"wild nights! wild nights! were i with thee, wild nights should be our luxury!"
-- emily dickinson
adopt an unanswered post today!
Top
9uSt00
n00b
n00b
User avatar
Posts: 24
Joined: Mon Feb 23, 2004 1:07 pm
Location: 59.9.9 ° N
Contact:
Contact 9uSt00
Website

tomcat5 and apache2 problems

  • Quote

Post by 9uSt00 » Fri Mar 05, 2004 2:07 pm

Ok, so i removed the Grsecurity settings from my kernel, recompiled, installed and rebooted. Now, i don't get that error anymore, but tomcat still does not want to start.

Digging through the logs, i found that the problem seems to be the code defining the Coyote connector in the /opt/tomcat/conf/server.xml from aent's howto:

Code: Select all

   <Service name="Tomcat-Apache">
        <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
        <Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8009"
        ....
        </Service>
(pause)

Ok, so i found (ref. http://forums.gentoo.org/viewtopic.php?t=137977) that (naturally enough) the connector classname has to be changed from org.apache.coyote.tomcat4.CoyoteConnector to org.apache.coyote.tomcat5.CoyoteConnector.

The problem now, is that i get a 404 by tomcat when i try to access any documents in the tomcat server (eg. /tomcat-docs, /jsp-examples, /servlet-examples).

i found this in /var/log/tomcat/catalina.log:

Code: Select all

INFO: Starting Coyote HTTP/1.1 on port 8080
Mar 5, 2004 2:59:30 PM org.apache.jk.common.ChannelSocket init
INFO: Port busy 8009 java.net.BindException: Address already in use
Mar 5, 2004 2:59:30 PM org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8010
Mar 5, 2004 2:59:30 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=1 time=0/5  config=/opt/tomcat/conf/jk2.properties
Mar 5, 2004 2:59:30 PM org.apache.catalina.startup.Catalina start
seems that 8009 is already in use... i don't know tomcat 5, so i don't really know where to start looking... Either way it says that it starts on port 8010 instead, but i guess that the link is thus broken, since the tutorial configures the link between tomcat and apache to be on port 8009... right?

can anyone please help?
gustavo
"wild nights! wild nights! were i with thee, wild nights should be our luxury!"
-- emily dickinson
adopt an unanswered post today!
Top
AnthonyZEO
n00b
n00b
Posts: 8
Joined: Tue Oct 21, 2003 11:58 pm
Location: United States / New England
Contact:
Contact AnthonyZEO
Website

  • Quote

Post by AnthonyZEO » Fri Mar 12, 2004 3:36 am

Thanks Mr. Static Void for the instructionson mod_jk. I had previously run Apache/Tomcat 4 on Mandrake with mod_jk2, which brings me to...

Thanks JCScoobyRS for the tip on getting this to work with Tomcat 5.

Great thread, very helpful. Thanks to everyone that participates.
make bzImage
Top
JCScoobyRS
n00b
n00b
Posts: 57
Joined: Thu Dec 18, 2003 2:43 am
Location: Colorado, USA
Contact:
Contact JCScoobyRS
Website

  • Quote

Post by JCScoobyRS » Fri Mar 12, 2004 3:06 pm

Anthony,
Just glad I could help. I searched doc after doc from Apache looking for the change and finally found something from an old mail archive. Good luck, Jeremy
He who listens well, speaks well.
Top
new2linux
n00b
n00b
Posts: 1
Joined: Thu Mar 18, 2004 3:32 pm

What am I missing?

  • Quote

Post by new2linux » Thu Mar 18, 2004 3:36 pm

Hello. I've been following the code posted by "aent" but when I get to the step
"# cp /opt/tomcat/conf/auto/mod_jk.conf /etc/apache2/conf/modules.d/ "
it says that the file or directory does not exist. After further inspection I realized that I don't even have an "auto" directory. Did I miss something in my setup somewhere? Could this file be somewhere else?

Any help would be appreciated.

Thanks
Top
pvincent
n00b
n00b
User avatar
Posts: 29
Joined: Sat Aug 02, 2003 9:02 pm

apache2 tomcat5 jk2

  • Quote

Post by pvincent » Mon Mar 22, 2004 11:45 am

Still stuck with jk2 :cry:

I emerged apache ( v2.0.48 ) and tomcat ( v5.0.18 ) succesfully.
/etc/init.d/apache2 start -> OK on port 80
/etc/init.d/tomcat start -> OK on port 8080

I installed the testing phase ebuild mod_jk2 provided by Gentoo:bugzilla into my ${PORTDIR_OVERLAY}.
Then, I could emerge mod_jk2 (v2.0.2) -> SUCCESS

And now, what should do I do next ?
Documentation from tomcat is quite tricky.
Where to describe the relationship between apache and tomcat ?

I suppose I need to add some extra parameters into :
/etc/apache2/conf/workers2.properties
/etc/apache2/conf/modules.d/105_mod_jk2.conf
/etc/tomcat/jk2.properties
/etc/tomcat/server.xml

The documentation above are mainly focused either to previous version of jk or tomcat 4.x.
Need extra help...
Top
Post Reply

80 posts
  • 1
  • 2
  • 3
  • 4
  • Next

Return to “Documentation, Tips & Tricks”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic