Monday, October 02, 2006

Running Glassfish and Apache httpd on fedora Core 4 server

I have installed GlassFish V1 Milestone 7 - build 48 on a fedora Core 4 server.
I have also installed: JDK5.0 and Ant 1.6.2
I also have to add JAVA_HOME to point to JDK5.0

I would like to integrate Apache httpd (2.0.54) with Glassfish, I found this excellent blog about this.

But I get this error in "mod_jk.log":
[Sun Oct 01 13:29:21 2006] [5737:22208] [error] init_jk::mod_jk.c (2450): Initializing shm:/etc/httpd/logs/jk-runtime-status errno=13

But the Glassfish server works ok, it is the integration that don’t works completely ok.

Do you now what is wrong?

I have done this:
1) I downloaded this file “mod_jk-apache-2.0.49-linux-i686.so”, I copy the file to: /etc/httpd/modules

2) I created this file: /etc/httpd/conf.d/glassfish.conf, that look like this:
LoadModule jk_module modules/mod_jk-apache-2.0.49-linux-i686.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 all jsp requests to GlassFish
JkMount /*.jsp worker1
# Send all glassfish-test requests to GlassFish
JkMount /glassfish-test/* worker1

3) Then I created this file:
/etc/httpd/conf/worker.properties, that look like this:
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

4) I have also copy to /usr/glassfish/lib:
- tomcat-ajp.jar
- modeler-1.1.jar
- commons-logging-1.0.4.jar

5) Then I enable mod_jk by adding one line in this file: /usr/glassfish/domains/domains1/config/domain.xml for the tag "jvm-options":
-Dcom.sun.enterprise.web.connector.enableJK=8009

6) I then restarted the Apache httpd (Apache/2.0.54)

7) After that I start the GlassFish server, with this:
asadmin start-domain domain1

8) I downloaded hello.war, from here and copy the file to:
/usr/glassfish/domains/domain1/autodeploy

9) The deployment didn’t work so I did this:
cd /usr/glassfish/domains/domain1/autodeploy
asadmin
asadmin>deploy hello.war
Now the deployment works ok!

10) Test the server
Locally on the server:
http://localhost:8080/hello = works ok!
From Internet:
http://www.ojn.se/hello = works not!
http://www.ojn.se:8080/hello = works ok!

3 comments:

Anonymous said...

Hi Ove,
I had the same problems the only solution i found is and i don't quite know why, I compiled the mod_jk myself from source and all worked ok after that. I was using Fedora core 5 and apache 2.2.3, I had tried everthing before that to no avail.

EscapeArtist said...

Is there any news on this topic ?

Ove Nordström said...

I don't know, but send a eMail to glassfish's Email group.