Apache Server configuration support - Connecting Apache 2.0.52 and Tomcat 5.5.4

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > November 2004 > Connecting Apache 2.0.52 and Tomcat 5.5.4





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Connecting Apache 2.0.52 and Tomcat 5.5.4
Jim

2004-11-17, 2:48 am

I have a website up and running at www.234.com and can browse but when
I click a login button that runs a servlet I get an error.

When I browse to the site as follows, www.234.com:8080/mydir, I can
see the site and click the button so the servlet returns what is
expected.

What steps must one follow to get the JK2 connector working so I will
be able to browse to www.234.com and execute that servlet?

Thanks,
Jim
Davide Bianchi

2004-11-17, 2:48 am

On 2004-11-17, Jim <jdz99@hotmail.com> wrote:
> What steps must one follow to get the JK2 connector working so I will
> be able to browse to www.234.com and execute that servlet?


1. get the jk2 connector
2. configure it in the httpd.conf and jk2.properties (IIRC)
3. configure tomcat with the correct 'context'

Davide

--
The best Windows accelerator is that which works at 9.81 m/s2
-- From a Slashdot.org post
Peter

2004-11-18, 5:54 pm

Thanks for you're help but I still can't get it working yet. I
downloaded and compiled j2k and I think at this point it is a
properties configuration issue, but I'm not sure.

This is the line I added to http.conf
LoadModule jk2_module modules/mod_jk2.so

From the apache error log,

[Thu Nov 18 13:03:13 2004] [notice] Apache/2.0.52 (Unix) mod_jk2/2.0.4
configured -- resuming normal operations

So it looks like it loaded but with wrong configuration.

This is my j2.properties file,
--------------------------------------------------
# Set the desired handler list
handler.list=apr,request,channelJni
#
# Override the default port for the socketChannel
# channelSocket.port=8019
# Default:
# channelUnix.file=${jkHome}/work/jk2.socket
# Just to check if the the config is working
# shm.file=${jkHome}/work/jk2.shm

# In order to enable jni use any channelJni directive
# channelJni.disabled = 0
# And one of the following directives:

apr.jniModeSo=/usr/local/apache2/modules/mod_jk.so

# If set to inprocess the mod_jk2 will Register natives itself
# This will enable the starting of the Tomcat from mod_jk2
apr.jniModeSo=inprocess
------------------------------------------


This is my workers.properties file, (located in the same directory as
http.conf)
-------------------------------------
[logger]
level=DEBUG

[config:]
file=${serverRoot}/conf/workers2.properties
debug=0
debugEnv=0

[uriMap:]
info=Maps the requests. Options: debug
debug=0

# Alternate file logger
#[logger.file:0]
#level=DEBUG
#file=${serverRoot}/logs/jk2.log

[shm:]
info=Scoreboard. Required for reconfiguration and status with
multiprocess servers
file=${serverRoot}/logs/jk2.shm
size=1000000
debug=0
disabled=0

[workerEnv:]
info=Global server options
timing=1
debug=0
# Default Native Logger (apache2 or win32 )
# can be overriden to a file logger, useful
# when tracing win32 related issues
#logger=logger.file:0

[lb:lb]
info=Default load balancer.
debug=0

[lb:lb_1]
info=A second load balancer.
debug=0

[channel.socket:localhost:8009]
port=8009
host=localhost
info=Ajp13 forwarding over socket
debug=0
tomcatId=localhost:8009

[ajp13:localhost:8009]
channel=channel.socket:localhost:8009

[channel.socket:localhost:8019]
info=A second tomcat instance.
debug=0
tomcatId=localhost:8019
lb_factor=1
#group=lb
group:lb:lb
#group=lb_1
group:lb:lb_1
disabled=0

[channel.un:/opt/33/work/jk2.socket]
info=A second channel connecting to localhost:8019 via unix socket
tomcatId=localhost:8019
lb_factor=1
debug=0

[channel.jni:jni]
info=The jni channel, used if tomcat is started inprocess

[status:]
info=Status worker, displays runtime informations

[vm:]
info=Parameters used to load a JVM in the server process
#JVM=C:\jdk\jre\bin\hotspot\jvm.dll
classpath=${TOMCAT_HOME}/bin/tomcat-jni.jar
classpath=${TOMCAT_HOME}/server/lib/commons-logging.jar
OPT=-Dtomcat.home=${TOMCAT_HOME}
OPT=-Dcatalina.home=${TOMCAT_HOME}
OPT=-Xmx128M
#OPT=-Djava.compiler=NONE
disabled=1

[worker.jni:onStartup]
info=Command to be executed by the VM on startup. This one will start
tomcat.
class=org/apache/jk/apr/TomcatStarter
ARG=start
# For Tomcat 5 use the 'stard' for startup argument
# ARG=stard
disabled=1
stdout=${serverRoot}/logs/stdout.log
stderr=${serverRoot}/logs/stderr.log

[worker.jni:onShutdown]
info=Command to be executed by the VM on shutdown. This one will stop
tomcat.
class=org/apache/jk/apr/TomcatStarter
ARG=stop
disabled=1

[uri:/jkstatus/*]
info=Display status information and checks the config file for
changes.
group=status:


[uri:/examples]
info=Example webapp in the default context.
context=/examples
debug=0

# POR added
[uri:/iat/*]
worker=ajp13:localhost:8009

[uri:/examples/*]
worker=ajp13:localhost:8009

[uri:/examples1/*]
info=A second webapp, this time going to the second tomcat only.
group=lb_1
debug=0

[uri:/examples/servlet/*]
info=Prefix mapping

[uri:/examples/*.jsp]
info=Extension mapping

[uri:/examples/*]
info=Map the whole webapp

[uri:/examples/servlet/HelloW]
info=Example with debug enabled.
debug=10
---------------------------------------

Where do you configure tomcat with the correct 'context'?
Do you know how to auto generate the properties file with
/tomcat/bin/startup.sh -jkconf?


Thank you,
Jim


Davide Bianchi <davideyeahsure@onlyforfun.net> wrote in message news:<slrncplubf.13k.davideyeahsure@fogg.onlyforfun.net>...
> On 2004-11-17, Jim <jdz99@hotmail.com> wrote:
>
> 1. get the jk2 connector
> 2. configure it in the httpd.conf and jk2.properties (IIRC)
> 3. configure tomcat with the correct 'context'
>
> Davide

Davide Bianchi

2004-11-18, 5:54 pm

On 2004-11-18, Peter <zpetero@netscape.net> wrote:
> [Thu Nov 18 13:03:13 2004] [notice] Apache/2.0.52 (Unix) mod_jk2/2.0.4
> configured -- resuming normal operations


Ok, so mod_jk2 is loaded.

> This is my j2.properties file,


IIRC the properties file have to be called workers.properties because the
file name is hardwired in the code.

> Where do you configure tomcat with the correct 'context'?


In the server.xml file.

> Do you know how to auto generate the properties file with


Never used in my life.

So, from your config file it seems you configured a couple of standard
context, what happen if you call your server http://...../examples/ ?
Do you get an error or Tomcat is called?

Davide

--
We are very nervous about the release of Windows 2000. This OS takes up
gigabytes of hard drive space. When users 'upgrade' to Win2K, they won't have
any space on their hard drive for our products! We really hate Chairman Bill.
Jim

2004-11-19, 2:48 am

Davide,

How do you add a context? I copied a context from my 4.1.29
server.xml file and it did not work.

This works...http://www.124.com/mydir/

How can I change it so calling the server requires http://www.123.com
?

Thanks,
Jim



Davide Bianchi <davideyeahsure@onlyforfun.net> wrote in message news:<slrncppsl6.16c.davideyeahsure@fogg.onlyforfun.net>...
> On 2004-11-18, Peter <zpetero@netscape.net> wrote:
>
> Ok, so mod_jk2 is loaded.
>
>
> IIRC the properties file have to be called workers.properties because the
> file name is hardwired in the code.
>
>
> In the server.xml file.
>
>
> Never used in my life.
>
> So, from your config file it seems you configured a couple of standard
> context, what happen if you call your server http://...../examples/ ?
> Do you get an error or Tomcat is called?
>
> Davide

Davide Bianchi

2004-11-19, 2:48 am

On 2004-11-19, Jim <jdz99@hotmail.com> wrote:
> How do you add a context? I copied a context from my 4.1.29


The simplest is to add something like
<Context path="/yourcontextdir" docBase="/where/your/jsp/are" debug="0" />
In your server.xml

> This works...http://www.124.com/mydir/
> How can I change it so calling the server requires http://www.123.com?


I wouldn't suggest it. But you could get off using a Proxy entry and
a VHost:

<VirtualHost *>
ServerName www.123.com
ServerAlias 123.com
...more entries if you need them (logging?)...
ProxyVia off
ProxyPass / http://127.0.0.1:8080/mydir/
ProxyPassReverse / http://127.0.0.1:8080/mydir/
</VirtualHost>

This bypass altogether the need for the connector and assume that your
Tomcat listen on port 8080.

Davide

--
Microsoft is not the answer. Microsoft is the question. Linux is the answer.
Jim

2004-11-19, 7:48 am

I tried configuring a context in server.xml, just like the one I had
working in my Tomcat 4.1.29 server.xml file. I cant't get it to work.

This is the entry,
<Host name="www.123.com" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

<Context path="/mydir" docBase="mydir" debug="0"
reloadable="true" crossContext="true">



I have http://www.123.com/mydir/ working. At this point how can I get
it to www.123.com?


Thanks,
Jim




Davide Bianchi <davideyeahsure@onlyforfun.net> wrote in message news:<slrncppsl6.16c.davideyeahsure@fogg.onlyforfun.net>...
> On 2004-11-18, Peter <zpetero@netscape.net> wrote:
>
> Ok, so mod_jk2 is loaded.
>
>
> IIRC the properties file have to be called workers.properties because the
> file name is hardwired in the code.
>
>
> In the server.xml file.
>
>
> Never used in my life.
>
> So, from your config file it seems you configured a couple of standard
> context, what happen if you call your server http://...../examples/ ?
> Do you get an error or Tomcat is called?
>
> Davide

Jim

2004-11-19, 5:52 pm

I don't want to bypass the connector so that's not an option,

I tried adding this to server.xml,
<Context path="/mydir" docBase="/where/your/jsp/are" debug="0" />
....and changed docbase to "/", "/mydir", "mydir",
"/mydir/WEB-INF/classes" and it still doesn't work.

(It's a servlet, not a jsp that needs to get executed...)

This tag from the web page, all my web pages worked under tomcat
4.1.29

<FORM NAME="login" METHOD="GET"
ACTION="/servlet/HelloWorldExample"
ONSUBMIT="return runLogin(this)">


I got this to work under tomcat 5.5.4, but I will have to go into all
my webpages and change the ACTION , which I prefer not to do.

<FORM NAME="login" METHOD="GET"
ACTION="/iat/servlet/HelloWorldExample"
ONSUBMIT="return runLogin(this)">

What is that final setting...?

Thanks,
Jim

Davide Bianchi <davideyeahsure@onlyforfun.net> wrote in message news:<slrncpr6rn.14m.davideyeahsure@fogg.onlyforfun.net>...
> On 2004-11-19, Jim <jdz99@hotmail.com> wrote:
>
> The simplest is to add something like
> <Context path="/yourcontextdir" docBase="/where/your/jsp/are" debug="0" />
> In your server.xml
>
>
> I wouldn't suggest it. But you could get off using a Proxy entry and
> a VHost:
>
> <VirtualHost *>
> ServerName www.123.com
> ServerAlias 123.com
> ...more entries if you need them (logging?)...
> ProxyVia off
> ProxyPass / http://127.0.0.1:8080/mydir/
> ProxyPassReverse / http://127.0.0.1:8080/mydir/
> </VirtualHost>
>
> This bypass altogether the need for the connector and assume that your
> Tomcat listen on port 8080.
>
> Davide

Davide Bianchi

2004-11-19, 5:52 pm

On 2004-11-19, Jim <jdz99@hotmail.com> wrote:
> (It's a servlet, not a jsp that needs to get executed...)


If is a servlet, IIRC from the time I was developing those things, you
need to define the servlet in the web.xml configuration file for the
web application.

Davide

--
Move along, move along, nothing to see here, definitely no evil mind
control software here, move along, move along...
--Thorf
gustave

2004-11-19, 5:52 pm

Davide Bianchi <davideyeahsure@onlyforfun.net> wrote in message news:<slrncpr6rn.14m.davideyeahsure@fogg.onlyforfun.net>...
> On 2004-11-19, Jim <jdz99@hotmail.com> wrote:
>
> The simplest is to add something like
> <Context path="/yourcontextdir" docBase="/where/your/jsp/are" debug="0" />
> In your server.xml
>
>
> I wouldn't suggest it. But you could get off using a Proxy entry and
> a VHost:
>
> <VirtualHost *>
> ServerName www.123.com
> ServerAlias 123.com
> ...more entries if you need them (logging?)...
> ProxyVia off
> ProxyPass / http://127.0.0.1:8080/mydir/
> ProxyPassReverse / http://127.0.0.1:8080/mydir/
> </VirtualHost>
>
> This bypass altogether the need for the connector and assume that your
> Tomcat listen on port 8080.
>
> Davide



Bonjour,

J'ai essayé votre configuration sur mon serveur:

<VirtualHost *>
> ServerName www.123.com
> ServerAlias 123.com
> ProxyVia off
> ProxyPass / http://127.0.0.1:8080/mon_appli/
> ProxyPassReverse / http://127.0.0.1:8080/mon_appli/
> </VirtualHost>


Mais voila, lorsque que je tape l'url: http://www.123.com , j'ai une erreur:
Page non trouvée: http://127.0.0.1:8080/mon_appli/mon_appli/login.jsp
et je n'arrive pas a voir le pb

Merci de votre aide

En fait , il met 2 fois /mon_appli/mon_appli/ et évidement, il n'aime pas.
Davide Bianchi

2004-11-20, 2:54 am

On 2004-11-19, gustave <cguyard@free.fr> wrote:
> Mais voila, lorsque que je tape l'url: http://www.123.com , j'ai une erreur:
> Page non trouvée: http://127.0.0.1:8080/mon_appli/mon_appli/login.jsp


I don't speak french, so I'll go with english, evidently somewhere
Apache or Tomcat map /mon_appli/ to /mon_appli/mon_appli, figure out
where and correct it. Look at the error message, is Tomcat or Apache
that returns it?

Davide

--
Good programmers treat Microsoft products as damage and route
around them.
-- From a Slashdot.org post
gustave

2004-11-20, 8:13 am

Sorry for my previous post in french...The same in english

i've tried your configuration for my tomcat application:

<VirtualHost *>
> ServerName www.123.com
> ServerAlias 123.com
> ProxyVia off
> ProxyPass / http://127.0.0.1:8080/my_appli/
> ProxyPassReverse / http://127.0.0.1:8080/my_appli/
> </VirtualHost>


but, when i try : http://www.123.com , i got an error

Page not find: http://127.0.0.1:8080/my_appli/my_appli/login.jsp ( my_appli twice)

and i don't see how to correct that

thank's for your help

En fait , il met 2 fois /mon_appli/mon_appli/ et évidement, il n'aime pas.
Jim

2004-11-20, 5:49 pm

Davide,

This worked..

I changed this

[uri:/mydir/servlet/*]
worker=ajp13:localhost:8009

[uri:/mydir/servlet/*]
worker=ajp13:localhost:8009

Thanks,
Jim


Davide Bianchi <davideyeahsure@onlyforfun.net> wrote in message news:<slrncpsj0e.18c.davideyeahsure@fogg.onlyforfun.net>...
> On 2004-11-19, Jim <jdz99@hotmail.com> wrote:
>
> If is a servlet, IIRC from the time I was developing those things, you
> need to define the servlet in the web.xml configuration file for the
> web application.
>
> Davide

Jim

2004-11-21, 2:48 am

The answer to my problem was to add this line to the
workers2.properties file which his in the same directory as the
http.conf file.

[uri:/mydir/servlet/*]
worker=ajp13:localhost:8009

Jim

cguyard@free.fr (gustave) wrote in message news:<37540399.0411200230.57043e6f@posting.google.com>...
> Sorry for my previous post in french...The same in english
>
> i've tried your configuration for my tomcat application:
>
> <VirtualHost *>
>
> but, when i try : http://www.123.com , i got an error
>
> Page not find: http://127.0.0.1:8080/my_appli/my_appli/login.jsp ( my_appli twice)
>
> and i don't see how to correct that
>
> thank's for your help
>
> En fait , il met 2 fois /mon_appli/mon_appli/ et évidement, il n'aime pas.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com