Application Server Setup
ServerAdmin marko.simic@gmail.com
- Download ColdFusion 8/9 Developer Edition from http://tinyurl.com/l6ythn
- Prepare ColdFusion 8/9 for J2EE deployment: Run setup file -> J2EE Configuration -> EAR File -> ContextRoot: cfusion -> enable RDS. More details on http://tinyurl.com/yasl232. Just prepare and don't expand the EAR file.
- Be sure you have installed JDK. For latest version go to http://java.sun.com/javaee/downloads/index.jsp. If you develop under Eclipse and while you are there, download "GlassFish Tools Bundle for Eclipse" too. It is not necessary for CF development, but gives you full control over application server from your IDE, which is cool.
- Install Sun GlassFish Enterprise Server v3. Go to http://tinyurl.com/yg3dlqj and download it. Installation procedure is very simple. Change port numbers if you want, but remember it, because you'll need it.
- Deploy ColdFusion 8/9 on GlassFish: Open GlassFish Administrator Console -> Applications -> Deploy... -> Packaged file to be uploaded...->
/cfusion.ear -> OK. You've prepared EAR file in step 1. - Open CF Admin for the first time. Notice that path is case sensitive. http://localhost:8080/cfusion/CFIDE/administrator/
ColdFusion Builder Setup
- Setup GlassFish connector in Eclipse. As I said before, I think this is not necessary, but, from my experience, since I haven't installed this, CF Builder did not recognize CF Server mappings properly.
- Setting up CF debugger. Open GF Admin Console http://localhost:4848/. Go to Configuration -> JVM Settings. You should see in "Debug Options" field -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009. Leave it as is. If you like you can change port address (9009). In CF, usually, by default it is 5005. Check "Debug" box. Press "Save" and restart GlassFish. Now, go CF Admin. Open Debuggin & Logging -> Debugger Settings, check "Allow Line Debugging" and set Debugger Port number to one you've set in previous step, in GF Admin Console. Press "Submit Changes".
General
- Deploy test web application on CF9@Glassfish
-> create folder "test" under ${com.sun.aas.instanceRootURI}/applications/cfusion/cfusion_war
-> create index.cfm with "Hello World" text in it
-> call http://localhost:8080/cfusion/test/. You should see "Hello World!" text in your browser. - Instead to type http://localhost:8080/cfusion/test/ all the time you can create a proxy to your project's address on apache httpd:
-> Open httpd.conf. Enable modules:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
-> Include addition virtual host definitions. Uncomment line:
Include conf/extra/httpd-vhosts.conf - Open
/conf/extra/httpd-vhosts.conf. Add:
ServerAdmin marko.simic@gmail.com
ServerName testproj
ProxyRequests Off
<proxy *="">
Order deny,allow
Allow from all
</proxy>
ProxyPass / http://localhost:8080/cfusion/test/
ProxyRequests Off
<proxy *="">
Order deny,allow
Allow from all
</proxy>
ProxyPass / http://localhost:8080/cfusion/test/
ProxyPassReverse / http://localhost:8080/cfusion/test/
</Virtualhost>
Update:
Several links that might help you with GF/Apache configuration
User Guide – GlassFish v3 User Guide
and look for "Apache as a front end to GlassFish using mod_jk" section
Virtual Hosting using Apache and GlassFish
+ check comment 5
- Add "testproj" in your hosts file. Open in any text editor
/syste32/drivers/etc/hosts. At the bottom add line:
127.0.0.1 testproj - Now, your test app should be accessable by http://testproj
Glassfish specifics
Nice tutorial how to publish static content and virtual directories here and here.
But, what worked for me is: Glassfish 3 Console -> virtual servers -> click on "server" -> Scroll down to "Additional Properties" -> Add... -> name: alternatedocroot_1, value: from=/mydir/* dir=C:/privatedir/
But, what worked for me is: Glassfish 3 Console -> virtual servers -> click on "server" -> Scroll down to "Additional Properties" -> Add... -> name: alternatedocroot_1, value: from=/mydir/* dir=C:/privatedir/
Just when I finished this manual I found blog with almost the same content.
If you find this insufficient you can go and check Kukiel's blogs:
Strange this blog did not show up when I look for "ColdFusion on glassfish" at Google, but did when I look for "Railo on Glassfish". Byah, Even Google lie from time to time ;)
Enjoy!
Enjoy!
Update:
Several links that might help you with GF/Apache configuration
User Guide – GlassFish v3 User Guide
and look for "Apache as a front end to GlassFish using mod_jk" section
Virtual Hosting using Apache and GlassFish
+ check comment 5
5 comments:
Have you tried getting multiple virtual servers working without the need for Apache on the front-end.
Sorry, no. Have you tried it? If you did, how is your experience? Have you had any problem? From what I read and see should be simple, but since you ask I smell it is not as it sounds :)
Yeah, I haven't been able to get it to work at all. So far I've read numerous blogs, whitepapers and documentation, and it looks i've hit a serious roadblock.
Apache will be only act as proxy and not serve static files in this case. CF will handle more load. Also, not sure how .htaccess files will be processed. Had you such issues ? Thanks !
Hi Rodion,
I run GF only on my dev machine, therefore I have had no need to bother with .htacces nor apache connectors. But, luckily, I bookmarked blog where you can find how to run GF on Apache.That way, you should be able to utilize .htaccess and redistribute load (static to apache + jsp, cfml to GF).
GF3 + Apache
http://weblogs.java.net/blog/2009/06/24/running-glassfish-v3-apache-httpd
GF2 + Apache
http://weblogs.java.net/blog/2006/03/17/running-glassfish-apache-httpd
In tutorial for GF3 traffic distribution is based on file location (/example dir), opposite to GF2 example where it is done by extension (JkMount /*.jsp worker1)
Don't miss to check comments. Obviously installation is not going smoothly as it is explained...as usual :) If you decide to go this way, I would appreciate if you would share your experience.
Post a Comment