How to get JBoss and Apache to work together

2009-12-10 下午5:05

How to get JBoss and Apache to work together

I have JBoss 5 loaded on a Win2k8 box along with Apache 2.2.14 and Coldfusion 9. I believe I'm having issues with Apache and JBoss not working together or set up correctly. What is the best way to set them up? I've read mod_jk is the way to go then others say mod_proxy. I've tried both but with no luck.

We use JRun on our production servers and are thinking of switching to JBoss. JRun is fairly easy to set up with Apache, just load the module and you're pretty much set. Is there an easy way to get these two working together?

I'm new to JBoss, thanks for any help :)

平均用户评价
(0 评价)
  • 22 发帖自 
    2009-11-29
    1.  2009-12-10 下午9:05 ( 回复 Josh Walker)
    Re: How to get JBoss and Apache to work together

    JBoss and Apache do play well together! Your on a Win box. So you probably have a setup similar to c:/jboss5 and c:/apache. Now you probably want to get jboss running (at least) forward listening on port 80. You are correct. Choose either mod_jk or mod_proxy. One way to do it.... there are many and your exact server limitations/ setup should be consulted to determine your best case scenario but for a point of getting started uncomment the mod_proxy modules... If they are not already there add them from apache...

    apache/conf/httpd.conf

    LoadModule proxy_connect_module modules/mod_proxy_connect.so
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    


    and then to config it in apache/conf/httpd.conf do the following... Obviously this setup is very open ended and may not be optimal for proxy pass and such but will get jboss and apache to play nice. 

    apache/conf/httpd.conf 
    ProxyRequests Off
    ProxyPreserveHost On
     
    <Proxy *>
     Order deny,allow
     Allow from all
    </Proxy>
     
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
    <Location />
     Order allow,deny
     Allow from all
    </Location>
    


    That should do it. Start apache and jboss and hit localhost at port 80. 

    Hope that helps.

    • 举报非法信息
  • 22 发帖自 
    2009-11-29
    2.  2009-12-10 下午9:11 ( 回复 Josh Walker)
    Re: How to get JBoss and Apache to work together

    A quick word on proxy vs ajp. I noticed some weird behavior myself when using mod_ajp as opposed to mod_proxy when it comes to jboss-native / APR and have found that mod_proxy seems to generally work more consistent. But if Comet / APR sort of setups is not the concern then ajp works flawlessly as well.

    • 举报非法信息
  • 22 发帖自 
    2009-11-29
    5.  2009-12-11 下午4:41 ( 回复 Josh Walker)
    Re: How to get JBoss and Apache to work together

    First check to make sure you are indeed listening on ports 80 and 8080. cmd>netstat -an. You should be listening on these ports.

    Also not sure about Coldfusion specifics but shouldn't your config for jboss-web exist in WEB-INF as opposed to web.inf...!

    Next I would check the root of Jboss on start. You should be able to bring up Welcome To JBoss from http://localhost. If that comes up then you know you are setup right and it's an application problem and not a jboss / apache problem. So remove your <context-root>/</context-root> and the app will live at the http://localhost/cfusion/.

    Also check nothing else is listening on those ports (other servers etc...).

    And lastly, make sure you indeed have those modules installed.

    You can add virtual-host to the jboss-web but generally you only need that if you have mutliple domains etc... so if you are accessing it from a different domain... ie devmktgweb.fullsail.com then add that virtual-host to your jboss-web.

    But first make sure jboss and apache work together... then drill down on your application specific setup.

    I see fullsail in your post above...! ROCK ON FULL SAIL!!!

    • 举报非法信息
  • 22 发帖自 
    2009-11-29
    7.  2009-12-11 下午7:34 ( 回复 Josh Walker)
    Re: How to get JBoss and Apache to work together

    In short.. yes... your files go in the cfusion.war

    Generally, you place your files in the directory (.war) you are creating. When you place a .war in jboss/server/default/ it will be registered as an application and accessible at the location unless you specify otherwise in the jboss-web.xml file. Every application has WEB-INF which is a standard java web application deployment descriptor folder where inside you'll have your web.xml. So your application context (in your case folder) would be http://localhost/cfusion. Now that gets us to the file. Your individual pages exist inside the .war which is your application on the server. So you would have a setup like:
    >cfusion.war
    >>WEB-INF
    >>CFIDE
    >>META-INF
    >>helloworld.cfm

    Any file you want to read should be in the application context. You generally don't need to and shouldn't point your apache docRoot at this folder. By forwarding to jboss, jboss-web is more then capable of handling the request. The DocRoot in the case of any app deployed in Jboss just won't be used - instead the application your working with will be targeted which is probably the desired behavior.


    So in your case here's how your setup should work.

    Apache with the proxy_mods installed. The directoryRoot of apache is irrelevant because you are not using it. Instead you are forwarding these requests onto your application. Your j2EE Web application is the cfusion.war. This gets targeted and picked up by requests to http://localhost because in your jboss-web.xml you told it to act on the root with : <context-root>/</context-root>.

    At this point your coldfusion server application is live at http://localhost. Now.. the actual Website Applications you intend to build will live inside this main cfusion.war directory... which is providing you coldfusion inside a standard J2EE application server. Place all your coldfusion files in the cfusion.war directory or subdirectory's.

    Hope that helps!

    • 举报非法信息
  • 22 发帖自 
    2009-11-29
    9.  2009-12-14 下午4:25 ( 回复 Josh Walker)
    Re: How to get JBoss and Apache to work together
    Yeah. You should add the server.xml hosts you indicated for each vhost. Generally.... you should use a seperate .war for each isolated site you are going to deploy. Context is important and if you're developing multiple isolated sites you should deploy each as a seperate war.
    • 举报非法信息
  • 22 发帖自 
    2009-11-29
    11.  2009-12-19 上午1:59 ( 回复 Josh Walker)
    Re: How to get JBoss and Apache to work together

    Might want to check this if you have not already. I see some things in there that may help.

    http://help.adobe.com/en_US/ColdFusion/9.0/Installing/WSc3ff6d0ea77859461172e0811cdec18c28-7fbd.html

    • 举报非法信息
  • 354 发帖自 
    2008-3-31
    14.  2009-12-24 上午8:28 ( 回复 Josh Walker)
    Re: How to get JBoss and Apache to work together

    You have a error here, in this line code

     

    ProxyPass / ajp://devmktgweb.mysite.com:8080/

     

    You are doing to work JBoss and Apache with ajp.

     

    The port of defaul ajp is 8009

     

    Try ProxyPass / ajp://devmktgweb.mysite.com:8009/

你可能感兴趣的:(How to get JBoss and Apache to work together)