aspose file tools*
The moose likes Other Java Products and Servers and the fly likes Resin with Apache Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "Resin with Apache" Watch "Resin with Apache" New topic
Author

Resin with Apache

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Does Resin have to reside on the same machine as Apache? The only docs I can find are setup to install with both on the same machine.
Is running them on 2 seperate machines a bad idea?


GenRocket - Experts at Building Test Data
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Ok, I have a question regarding getting Apache to forward requests to Resin.
I have everything set up. Both Apache and Resin are running. I configured the mod_caucho.co and the httpd.conf in apache is loading it.
I have a test.jsp file that is simply:
2 + 2 = <%= 2 + 2 %>
This file resides in /usr/local/apache/htdocs
Now, if I do the following:
http://localhost:8080/test.jsp
Everything works.
However, if I do:
http://localhost/test.jsp
The browser asks me what I want to do with the file, like I want to download it or something.
I changed the resin.conf so that the doc dir points to apache's htdocs folder.
Anything else??
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
This sounds like an Apache configuration issue to me. Asking for a page from 8080 presumably goes direct to Resin. Have you told Apache to pass all requests for JSP files to Resin?
As an aside, what is Apache giving you that Resin's built-in web server doesn't? Although I have set up systems with Apache and Resin in the past, I've found that for Java and static files, the Resin web server is just as good. Do you need CGI, PHP or something as well?


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

You make a good point. I just assumed that Apache had a better http server than Resin to service static HTML pages.
However, any J2EE app that has the need for that many static HTML pages to be served probably has its own set of problems.
I probably won't worry about until I need to do it for whatever reason.
Thanks Frank.
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
According to the documentation, you cannot run each virtual host in a seperate JVM without Apache. Is there an advantage to having each virtual host run in its own JVM?


Matthew Phillips
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Frank Carver:
Have you told Apache to pass all requests for JSP files to Resin?

I thought that Loading the caucho module took care of that. However, I compiled apache to allow module support, and when I try and do the AddModule after the LoadModule, I get an error in the httpd.conf file that implies that I don't have module support.
So who knows.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Is there an advantage to having each virtual host run in its own JVM?
Yes, if each virtual host is "owned" by a different customer. I used to do this so that I could allow users to restart a VM if something went wrong, without breaking everyone else's applications!
Daniel Bjuhr
Greenhorn

Joined: Dec 03, 2003
Posts: 1
Yes, if each virtual host is "owned" by a different customer. I used to do this so that I could allow users to restart a VM if something went wrong, without breaking everyone else's applications!
This is exactly my problem. I used Resin as standalone server without Apache, resulting in that each time a new customer arrived I had to edit "resin.conf". That resulted in that all current applications went down and where logged out.
I have now tryed to run Resin with multiple JVM:s together with Apache that takes care of the virtual hosts. I can now start and stop each application in Resin separatley and also start new applications in Resin without interrupting the other applications.
After adding a new webbapplication in Resin I adds a virtual host in Apache and restarts it.
This seems to work, but gets very unstable. I wonder if it has to do with the communication between Apache and Resin?
Sometimes I get the proper response from a webapplication and other times I gets the jsp code as response. The jsp code probably comes directly from Apache that maybe doesn't gets contact with Resin all times?
Does anyone know how to set up this correctly???
I have used Resin 3.0.4 and Apache 2.0.48.
This is my conf files:
I start a webapplication with following command:
/home/resin/bin/httpd.sh -conf /home/resin/conf/www.mydomain.com.conf -pid /home/resin/conf/www.mydomain.com.pid start

This is how the conf file for the webapp in Resin looks like:
<resin xmlns="http://caucho.com/ns/resin">
<resin:include href="common.conf"/>
<cluster>
<srun id="" host="127.0.0.1" port="6802" index="1"/>
</cluster>
<host id='www.mydomain.com'>
<web-app id='' document-directory='/home/myapps/mydomain'/>
</host>
</server>
</resin>

This is how the mapping in Apache looks like:
LoadModule caucho_module /usr/local/apache2/modules/mod_caucho.so
<IfModule mod_caucho.c>
ResinConfigServer localhost 6802
<Location /caucho-status>
SetHandler caucho-status
</Location>
</IfModule>
NameVirtualHost 192.168.0.1
<VirtualHost 192.168.0.1>
ServerName www.mydomain.com
ResinConfigServer 192.168.0.1 6802
DirectoryIndex index.jsp
DocumentRoot /home/myapps/mydomain
<Location /caucho-status>
SetHandler caucho-status
</Location>
</VirtualHost>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Resin with Apache