Skip to main content

Apache Httpd + AS9 / Glassfish

6 replies [Last post]
dutow
Offline
Joined: 2006-02-12

I'm trying to use AS9 (or glassfish) with apache httpd frontend. I found a solution with mod_rewrite and mod_proxy

RewriteEngine on
RewriteBase /rwtest/
RewriteRule ^(.*)$ http://localhost:8080/$1 [P]

But this isn't perfect, because
- the REQUEST_URI in the AS9 is just "test.jsp", not "rwtest/test.jsp" (it isn't problem if I'm using a virtualhost, not a subdirectory)
- the getRemoteAddr returns the server's IP address (127.0.0.1), not the client's.

And I saw this topic: http://forums.java.net/jive/thread.jspa?threadID=13033&tstart=90

But I'm blind, or it doesn't contain anything useful... can I use mod_jk or another connector with GF / AS9 (and is somewhere a _good_ howto about it?)?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
carlavmott
Offline
Joined: 2005-02-10
dutow
Offline
Joined: 2006-02-12

... please read my post again. My english isn't perfect, but not that bad...

Yes, I checked it, but it doesn't working. I put into processLauncher.xml (as9-server section). I restarted the server, and I thought it's working ([#|2006-03-14T13:12:27.766+0100|INFO|sun-appserver-pe9.0|javax.enterprise.system.container.web|_ThreadID=10;_ThreadName=main;|Apache mod_jk/jk2 attached to virtual-server server listening on port: 8009|#])

But telnet localhost 8009 returns connection failed, and apache also can't connect... "503 Service Temporarily Unavailable"

(my workers.properties file:
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13)

dutow
Offline
Joined: 2006-02-12

Anybody?

I'd like to use sun AS, but I need to use apache (php, mod_rewrite, etc) too, in the same server :(

I downloaded the source, but didn't found anything interesting, I can't see why it is'nt working. I'm not a glassfish / AS9 expert... the log says everything is ok, and the source (appserv-core\src\java\sun\enterprise\web\PEWebContainer.java) seems good to me, but it doesn't listens on localhost:8009.

jfarcand
Offline
Joined: 2003-06-10

Hi,

build 41 has broken the feature because we have renamed all org.apache.commons to com.sun.apache.*. So you must add to GLASSFISH_HOME/lib:

[b]+ tomcat-ajp.jar
+ commons-logging.jar
+ commons-modeler.jar[/b]

Then first start Apache with:

worker.properties:

# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost.localdomain
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300

and httpd.conf:

LoadModule jk_module /usr/lib/httpd/modules/mod_jk.so

JkWorkersFile /etc/httpd/conf/worker.properties
# Where to put jk logs
JkLogFile /var/log/httpd/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel debug
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Send servlet for context /examples to worker named worker1
JkMount /*.jsp worker1
# Send JSPs for context /examples to worker named worker1
JkMount /tomcat-test/* worker1

then start GlassFish. I've just tested with b41 and it works.

Hope that help.

-- Jeanfrancois

jfarcand
Offline
Joined: 2003-06-10

FYI, I've added a more detailed way of doing it here:

http://weblogs.java.net/blog/jfarcand/archive/2006/03/running_glassfi_1....

dutow
Offline
Joined: 2006-02-12

Thanks, it's working.