Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Integrate Tomcat With Apache Using mod_jk
View unanswered posts
View posts from last 24 hours

Goto page 1, 2, 3, 4  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
MrStaticVoid
Tux's lil' helper
Tux's lil' helper


Joined: 25 Jul 2003
Posts: 114
Location: Maryland

PostPosted: Thu Oct 09, 2003 9:59 pm    Post subject: Integrate Tomcat With Apache Using mod_jk Reply with quote

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:
# 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:
# emerge tomcat

There is a bug in the default permissions for a configuation file that does not allow Tomcat to start.
Code:
# chmod 755 /etc/conf.d/tomcat

Now set Tomcat to load at startup and start the server.
Code:
# 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:
$ 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:
# 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:
# cp /usr/lib/apache2/build/config_vars.mk /usr/build/

Now we'll compile.
Code:
$ 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:
# 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
Quote:
<Server port="8005" shutdown="SHUTDOWN" debug="0">
add
Quote:
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" />

and after the line
Quote:
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true">

add
Quote:
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" append="true" />

Save the file and restart Tomcat.
Code:
# /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:
Quote:
<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/.
Quote:
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
Quote:
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
Back to top
View user's profile Send private message
Lehren
n00b
n00b


Joined: 12 Oct 2003
Posts: 4

PostPosted: Sun Oct 12, 2003 3:07 am    Post subject: tried it all the way through.. Reply with quote

.. 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.
Back to top
View user's profile Send private message
aent
n00b
n00b


Joined: 24 May 2003
Posts: 49
Location: Here

PostPosted: Sun Oct 12, 2003 6:44 pm    Post subject: Reply with quote

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:
# 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:
<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:
  <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:

# 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:
[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!
Back to top
View user's profile Send private message
jwever
n00b
n00b


Joined: 12 Sep 2003
Posts: 72

PostPosted: Sun Oct 12, 2003 9:42 pm    Post subject: Reply with quote

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

to
Code:
# ./configure --with-apxs2=/usr/sbin/apxs2 --with-tomcat41=/opt/tomcat
Back to top
View user's profile Send private message
cederberg
Guru
Guru


Joined: 23 Jan 2003
Posts: 349
Location: Stockholm / Sweden

PostPosted: Thu Oct 16, 2003 6:09 pm    Post subject: ebuild for mod_jk2 Reply with quote

This bug might be of interest, as it contains an ebuild for mod_jk2.
Back to top
View user's profile Send private message
brondsem
n00b
n00b


Joined: 08 Jul 2003
Posts: 6
Location: Grand Rapids, MI

PostPosted: Wed Oct 22, 2003 3:24 am    Post subject: hostname Reply with quote

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
......
......
Back to top
View user's profile Send private message
AllTom
Tux's lil' helper
Tux's lil' helper


Joined: 26 Nov 2003
Posts: 147
Location: Wherever danger lies...

PostPosted: Wed Nov 26, 2003 6:21 pm    Post subject: Brilliant Reply with quote

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."
Back to top
View user's profile Send private message
fatpiper
n00b
n00b


Joined: 10 Sep 2003
Posts: 18
Location: UK

PostPosted: Wed Jan 14, 2004 9:43 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
frequency
n00b
n00b


Joined: 06 Jan 2004
Posts: 5

PostPosted: Thu Jan 29, 2004 10:28 pm    Post subject: JSP's not executing Reply with quote

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
Back to top
View user's profile Send private message
Ulukai
n00b
n00b


Joined: 25 Jun 2003
Posts: 7

PostPosted: Mon Feb 02, 2004 10:32 pm    Post subject: /opt/tomcat/conf/auto/mod_jk.conf not generated Reply with quote

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::.
Back to top
View user's profile Send private message
MrStaticVoid
Tux's lil' helper
Tux's lil' helper


Joined: 25 Jul 2003
Posts: 114
Location: Maryland

PostPosted: Fri Feb 13, 2004 8:51 pm    Post subject: Reply with quote

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:
# 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:
Quote:
<?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
Back to top
View user's profile Send private message
frequency
n00b
n00b


Joined: 06 Jan 2004
Posts: 5

PostPosted: Mon Feb 16, 2004 12:03 am    Post subject: Still having problems Reply with quote

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
Quote:
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?
Back to top
View user's profile Send private message
albanard
Tux's lil' helper
Tux's lil' helper


Joined: 22 Nov 2003
Posts: 92

PostPosted: Tue Feb 17, 2004 6:46 am    Post subject: libtool: cannot install .. to a directory not ending in .. Reply with quote

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
Back to top
View user's profile Send private message
christsong84
Veteran
Veteran


Joined: 06 Apr 2003
Posts: 1003
Location: GMT-8 (Spokane)

PostPosted: Tue Feb 17, 2004 7:18 am    Post subject: Reply with quote

i can't find the connecter file anywhere :(
_________________
while(true) {self.input(sugar);} :twisted:
Back to top
View user's profile Send private message
albanard
Tux's lil' helper
Tux's lil' helper


Joined: 22 Nov 2003
Posts: 92

PostPosted: Tue Feb 17, 2004 9:40 am    Post subject: Reply with quote

The connector source mentioned for jk2 is:

http://apache.mirrors.pair.com/jakarta/tomcat-connectors/jk2/jakarta-tomcat-connectors-jk2-src-current.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
Back to top
View user's profile Send private message
albanard
Tux's lil' helper
Tux's lil' helper


Joined: 22 Nov 2003
Posts: 92

PostPosted: Tue Feb 17, 2004 12:03 pm    Post subject: Reply with quote

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

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
Back to top
View user's profile Send private message
Tarantula
n00b
n00b


Joined: 20 Feb 2004
Posts: 1

PostPosted: Fri Feb 20, 2004 10:47 am    Post subject: Reply with quote

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 ?
Back to top
View user's profile Send private message
tomarsyd
n00b
n00b


Joined: 25 Feb 2004
Posts: 7

PostPosted: Wed Feb 25, 2004 3:21 am    Post subject: Reply with quote

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=bb&op=viewtopic&p=3822808#3822808


Any help is much appreciated.
_________________
Regards,
Tom Meeks
www.tomar.no-ip.com
Back to top
View user's profile Send private message
JCScoobyRS
n00b
n00b


Joined: 18 Dec 2003
Posts: 57
Location: Colorado, USA

PostPosted: Wed Feb 25, 2004 5:08 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
9uSt00
n00b
n00b


Joined: 23 Feb 2004
Posts: 24
Location: 59.9.9 ° N

PostPosted: Thu Mar 04, 2004 11:41 pm    Post subject: bug in Tomcat jsvc Reply with quote

Hello.. i just installed tomcat by
Code:
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:
        /* Format changed for 1.4 JVMs */
        sp = strchr(ret, ' ');
        if(sp != NULL)
            *sp = '\0'


to
Code:
        /* 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:
 * 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:
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!
Back to top
View user's profile Send private message
9uSt00
n00b
n00b


Joined: 23 Feb 2004
Posts: 24
Location: 59.9.9 ° N

PostPosted: Fri Mar 05, 2004 2:07 pm    Post subject: tomcat5 and apache2 problems Reply with quote

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:
   <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. https://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:
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!
Back to top
View user's profile Send private message
AnthonyZEO
n00b
n00b


Joined: 21 Oct 2003
Posts: 8
Location: United States / New England

PostPosted: Fri Mar 12, 2004 3:36 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
JCScoobyRS
n00b
n00b


Joined: 18 Dec 2003
Posts: 57
Location: Colorado, USA

PostPosted: Fri Mar 12, 2004 3:06 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
new2linux
n00b
n00b


Joined: 18 Mar 2004
Posts: 1

PostPosted: Thu Mar 18, 2004 3:36 pm    Post subject: What am I missing? Reply with quote

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
Back to top
View user's profile Send private message
pvincent
n00b
n00b


Joined: 02 Aug 2003
Posts: 29

PostPosted: Mon Mar 22, 2004 11:45 am    Post subject: apache2 tomcat5 jk2 Reply with quote

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...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum