ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button
  ColdFusion MX on Mac OS X, Part 3
Subject:   HELP! X.2.3, Tomcat, Apache and CFMX J2EE
Date:   2004-02-01 00:49:19
From:   thestudio_bob
Response to: HELP! X.2.3, Tomcat, Apache and CFMX J2EE

I just installed this myself, and I understand your frustration. I'm not a unix pro, unix novice, unix anything. And I have been seeing the confusiong post all over, so I am going to post my complete instructions, in the hopes that this helps everyone.

Basically here's the steps and things I learned on the way.

1. I downloaded and installed the "coldfusion-61-other.jar" file Macromedia. I installed it using the Terminal app. First I moved araoudn until I was in the same directory as the file. Then I typed this command "java -jar coldfusion-61-other.jar -i console". But I noticed that it kept giving me a "not logged in as root user" error. So I logged out of Mac OS X and logged back in using "root" and my password.

(I'm not sure if you have to activate the "logging in as root" feature or not, but I think you can activate it using NetInfo Manager in the utilities folder. It's under the menu "Seurity", "Enabled Root User". And again, I'm not real familiar with what I'm doing, so I could be wrong on this one)

Anyway, after I logged in as root, I tried installing it again and I didn't see that error message anymore. I'm sure I could have just double-clicked on the installer at this point, but I was enjoying the console so much, I figured what the heck.

2. The next thing I did was to decompress the Tomcat file I downloaded from Jakarta Tomcat website. I actaully downloaded version 4.1.29 (The most recent as of this writing). The name of the file I grabbed was "jakarta-tomcat-4.1.29.tar.gz". It was a binary file, not the source.

This expanded into a big folder, which I renamed "Tomcat".

At this point I found about 10 different documents saying you can make all kinds of directory's all over your hard drive, but the truth of the matter is you can put this file where ever you want. I made a folder on the top level of my hard drive and called it "WebStuff". This is where I put the "Tomcat" folder and I also moved the coldfusion folder (If you followed most directions, I'm assumming you named this folder "CFMXJ2ee") Whatever you named it, you can just drag it into your "WebStuff" folder.

3. The 2 files in the coldfusion (CFMXJ2ee) directory called "cfusion.war" and "rds.war" get moved/copied into the "WebStuff/Tomcat/webapps" directory. Rename the "rds.war" file to "CFIDE.war" as it says in the CF instructions.

4. Now to get tomcat working, I made the the "start_tomcat.sh" and "stop_tomcat.sh" files to easily start and stop tomcat. Here's the code I used for the start_tomcat.sh:

export CATALINA_HOME=/WebStuff/Tomcat
export JAVA_HOME=/Library/Java/Home

And here's the code for the stop_tomcat.sh:

export CATALINA_HOME=/WebStuff/Tomcat
export JAVA_HOME=/Library/Java/Home

Notice the "WebStuff" folder and "Tomcat" folder. If you have been following my directions, that's the names you us there. If you named your folders different or put Tomcat somwhere else, just put in your pathname there.

The JAVA_HOME thing should be ok, but double check by going into your hard drive and check in the Library folder and see if a Java folder is in there. If it is, then check to see if it has a "Home" alias in it. (If not, do a search for JAVA and find the one with a HOME folder in it)

Ok, move these files into the "WebStuff" folder

The other thing you have to do at this point is make the two files you just created executable. That means more console fun. Open up the terminal app again. Here's were putting the everything into the "WebStuff" folder comes in handy. Type "cd /WebStuff". Bang, your their. Now type "chmod u+rwx,g+rx,o+r start_tomcat.sh stop_tomcat.sh". You can check the permissions by typeing "ls -l". it should look like this.

-rwxr-xr-- 1 user staff 117 29 Jan 13:37 start_tomcat.sh
-rwxr-xr-- 1 user staff 118 29 Jan 13:37 stop_tomcat.sh

And, again I'm not 100% sure what or why I'm doing this, put it works and I'm not complaining.

5. Start tomcat. In terminal just type "sh start_tomcat.sh". Then you should see about 4 or five lines and then wait a minute or two. Tomcat needs to start up. Now open up your browser and point to "http:localhost:8080". You should see the standard Jakarta Tomcat welcome page.

If everything works, then look in the "WebStuff/Tomcat/webapps" directory or open the folder and see if the 2 .war files are there with 2 new folders with the same names. ("CFIDE" and "cfusion"). They should be. If not, then you need more help than I can give you. They should have automatically "deployed" when Tomcat started up.

In terminal, go ahead and stop tomcat by typing "sh stop_tomcat.sh". Again, you should see about 4 or 5 lines here. If you see more, then there's a problem. Most likely your paths are wrong in the start and stop sh files.

6. Now you need to create that "setenv.sh" file for CF. Here what I used:

# Establish variables. May differ on your installation.
# JAVA_HOME specifies the Java JDK root directory.
# Macintosh OS X maintains a number of aliases for this directory.
# CF_HOME specifies the directory to which ColdFusion MX is deployed.

# Establish JVM options
#CF_SECURITY_JVM_OPTIONS="-Djava.security.manager -Djava.security.policy=$CF_WEB_INF/cfusion/lib/coldfusion.policy -Djava.security.auth.policy=$CF_WEB_INF/cfusion/lib/neo_jaas.policy"
# Set JVM options for CORBA. Use if vbjorb.jar is not in your JRE's
# lib/ext directory. If used, append $CF_CORBA_JVM_OPTIONS to CF_JVM_OPTIONS
# CF_CORBA_JVM_OPTIONS=-Xbootclasspath/a:"$CF_WEB_INF/lib/vbjorb.jar"

#JAVA_OPTS="$CF_JVM_OPTIONS -Xms128m -Xmx256m"

I commented out everything on the bottom, which is the RDS security stuff. I kept getting errors here, and since this is just a development server, I really didn't need them.

You need to put this file in "WebStuff/Tomcat/bin" and I wasn't told to do so, but I did that neat permission trick thing on this file too! (Open terminal, go to the webstuff/tomcat/bin directory and type "chmod u+rwx,g+rx,o+r setenv.sh")

Ok, start up Tomcat again in terminal (you'll need to go up one level if your still in the "bin" directory) type "sh start_tomcat.sh") Again, wait a bit, because the server needs to start up.

Believe it or not, I'm almost done.

7. Here was the really, really, really fun part. I opened up my browser and was able to go to ColdFusion by typing "http:localhost:8080/cfusion". Coldfusion then starts up. Just walk through all the screen steps. It's pretty straight-forward.

If you want to add your own .cfm files you need to add them to the "WebStuff/Tomcat/cfusion/" folder.

Now, I knew tomcat had this manager and admin tool, because I can see links for them on the "http://localhost:8080/" page. Did anybody else try to click on these? I did, about 100 times. I finally was able to get into the manager, by editing the "tomcat-users.xml" file located in "WebStuff/Tomcat/conf/". Here's what I did to my file:

<?xml version='1.0' encoding='utf-8'?>
<role rolename="standard"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="YOUR-USERNAME" password="YOUR-PASSWORD" roles="admin,manager,standard"/>

I then, quit tomcat and restarted it again. And low-and-behold I was able to log into the manager. Cool, I was on a role, so I then tried to login to the adminstrator tool.

I never did get it to work, until I cam across a little blurb on some Forum, somewhere, saying something, about Safari and Camino not that robust when it comes to some javascript. So on a whim I opened up Netscape and tried logging onto the Adminstrator Manager. And wouldn't you know it, it worked.

Life is good.

Now if I could only figure out this whole mod_jk or add AJP in the administrator manager thing I would really be happy, but I'm saving that stress for another day.

Anyway, I hope this saves someone the week I wasted on it. If you see any errors, please let me know.