Making GlassFish v3/DVN available using Apache2 and mod_jk

106 views
Skip to first unread message

ofu...@gmail.com

unread,
Apr 18, 2014, 1:25:21 PM4/18/14
to dataverse...@googlegroups.com


I can’t run Glassfish/DVN behind Apache web server.  I have installed Dataverse and it was successful. I am running Apache-Tomcat (for Dspace) behind the Apache server on Debian 7.x   

I use port 8009 for Tomcat, locahost:8080/dspace for DSpace, Glassfish server on port locahost:4848 and DVN on locahost:8081/dvn.

I have managed to configure Tomcat/Dspace to run behind Apache Server, but not Glassfish/DVN. I need help. Is the DVN base context wrong?

This is what I have done.

I have already a workers.properties file for tomcat but added into it another worker for Glassfish3:

# Define 1 real worker using ajp13

worker.list=worker1,worker2

#For tomcat

# Set properties for worker1 (ajp13)

worker.worker1.type=ajp13

worker.worker1.host=localhost

worker.worker1.port=8009

…..

#For glassfish

# Set properties for worker1 (ajp13)

worker.worker2.type=ajp13

worker.worker2.host=localhost

worker.worker2.port=8010

…..

In a file called /etc/apache2/mods-available/jk.conf and put this in there:

JkWorkersFile /…./workers.properties

JkLogFile /var/log/apache2/mod_jk.log

JkLogLevel info

JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

..

JkMount /dspace/*.jsp worker1

JkMount /dspace/* worker1

JkMount /dspace worker1

..

JkMount /dvn/*.jsp worker2

JkMount /dvn/* worker2

JkMount /dvn worker2

 ..

I created a HTTP listener on port 8010 and enable jk on it using these two commands:

# asadmin create-http-listener --listenerport 8010 --listeneraddress 0.0.0.0 --defaultvs server jk-connector
# asadmin set configs.config.server-config.network-config.network-listeners.network-listener.jk-connector.jk-enabled=true
 
 
At ./apache/sites-available/default, I put the following:
 
<VirtualHost *:80>
       
JkMount /dspace/*.jsp worker1
JkMount /dspace/* worker1
JkMount /dspace worker1
 
JkMount /dvn/*.jsp worker2
JkMount /dvn/* worker2
JkMount /dvn worker2
 
..

Philip Durbin

unread,
Apr 22, 2014, 9:28:36 AM4/22/14
to dataverse...@googlegroups.com
Hello! I see you also opened a support ticket* but I thought I'd reply
on the Google Group since I'm not an expert on Glassfish or Apache.

In fronting Glassfish with Apache, I've mostly taken inspiration from
http://docs.oracle.com/cd/E26576_01/doc.312/e24928/webapps.htm#CIHJDAJD
and https://weblogs.java.net/blog/amyroh/archive/2012/02/15/running-glassfish-312-apache-http-server

Does your setup have a concept of ProxyPass? At
https://github.com/dvn/shibpoc/tree/master/java/shibsppoc#configure-apache-httpd
I'm using the following ProxyPath config with the default port of
8009:

[root@dvn-vm2 ~]# cat /etc/httpd/conf.d/shibsppoc.conf
ProxyPass /shibsppoc ajp://localhost:8009/shibsppoc

Since you're running DVN and not that little "shibsppoc" app (and
using a custom jk-connector listener port), I would expect your line
to look like this, I suppose:

ProxyPass /dvn ajp://localhost:8010/dvn

Does this help?

Phil

* At https://help.hmdc.harvard.edu/Ticket/Display.html?id=177668

On Fri, Apr 18, 2014 at 1:25 PM, <ofu...@gmail.com> wrote:
>
>
> I can't run Glassfish/DVN behind Apache web server. I have installed
> Dataverse and it was successful. I am running Apache-Tomcat (for Dspace)
> behind the Apache server on Debian 7.x
>
> I use port 8009 for Tomcat, locahost:8080/dspace for DSpace, Glassfish
> server on port locahost:4848 and DVN on locahost:8081/dvn.
>
> I have managed to configure Tomcat/Dspace to run behind Apache Server, but
> not Glassfish/DVN. I need help. Is the DVN base context wrong?
>
> This is what I have done.
>
> I have already a workers.properties file for tomcat but added into it
> another worker for Glassfish3:
>
> # Define 1 real worker using ajp13
>
> worker.list=worker1,worker2
>
> #For tomcat
>
> # Set properties for worker1 (ajp13)
>
> worker.worker1.type=ajp13
>
> worker.worker1.host=localhost
>
> worker.worker1.port=8009
>
> .....
>
> #For glassfish
>
> # Set properties for worker1 (ajp13)
>
> worker.worker2.type=ajp13
>
> worker.worker2.host=localhost
>
> worker.worker2.port=8010
>
> .....
>
> In a file called /etc/apache2/mods-available/jk.conf and put this in there:
>
> JkWorkersFile /..../workers.properties
> --
> You received this message because you are subscribed to the Google Groups
> "Dataverse Users Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dataverse-commu...@googlegroups.com.
> To post to this group, send email to dataverse...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dataverse-community/b64f759c-637c-4088-99cc-2fcdb6b9dfba%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Philip Durbin
Software Developer for http://thedata.org
http://www.iq.harvard.edu/people/philip-durbin

ofu...@gmail.com

unread,
Apr 24, 2014, 4:30:01 AM4/24/14
to dataverse...@googlegroups.com
Thanks very much Philip Durbin.  It works now.  This is what I did on our Debian 7.x., Glassfish3 and running Apache server

At Glassfish v3:
# asadmin create-http-listener --listenerport 8081 --listeneraddress 0.0.0.0 --defaultvs server jk-connector
# asadmin set configs.config.server-config.network-config.network-listeners.network-listener.jk-connector.jk-enabled=true
 
At Apache server:
We edited the file /etc/apache2/mods-available/proxy.conf as follows:
File excerpt:/etc/apache2/mods-available/proxy.conf
<IfModule mod_proxy.c>
        # [...]

        ProxyRequests Off
        <Proxy *>
                AddDefaultCharset off
                Order deny,allow
                Allow from all
        </Proxy>
   
      ProxyPass /dvn/ http://localhost:8081/dvn/
      ProxyPassReverse /dvn/ http://localhost:8081/dvn/

        # Enable/disable the handling of HTTP/1.1 "Via:" headers.
        # ("Full" adds the server version; "Block" removes all outgoing Via: headers)
        # Set to one of: Off | On | Full | Block
        ProxyVia On

</IfModule>

Restart apache.

Cheers
Ofuuzo
Reply all
Reply to author
Forward
0 new messages