After a week of sleepless nights....

Since I'm on the bleeding edge, I've received more than a cut or two in my time. Most recently, I've learned the pains of using the following cutting-edge (if you call it that) tools together:

Tomcat 5.5.12
MySQL 5.0.15
WebObjects 5.3
Xcode 2.1

(Single Servlet Directory Distro)

So...how do you configure everything to work together? Well, after about a week of reading more web pages than I can remember...these are the steps:

1) Make sure all the newest dev tools are installed (Xcode 2.1 and WebObjects 5.3 from connect.apple.com)
2) Install and Configure MySQL (4 or 5 should work)
3) Create the MySQL database (MySQL offers an admin app which makes this soooo easy...)
4) Create MySQL user accounts that can access said database (once again, use the admin app for easiness!)
5) Download and install Tomcat 5.5 (http://www.sisuworks.com/page3/page3.html)
6) Download and install MySQL's JDBC (mysql.com) adaptor and put in /Library/Java/Extensions
7) Open Terminal (Applications->Utilities), and run the following command:

sudo chmod -R a+rwx /Library/Tomcat/
(This may be needed for Xcode to build applications in the Tomcat directory)

8) Create a database model using EOModelor (make CERTAIN the connection settings are correct!) A demo is here; I fill out the bottom fields as well; sometimes it helps. The bottom fields for MySQL would be:

Driver: com.mysql.jdbc.Driver
Plugin: MySQL

9) Click on the "SQL" button to force EOModelor to create the tables, etc in the database. Errors here mean that something isn't typed correctly.
10) Create your WebObjects application, add the EOModelor file you created (you'll be prompted if you have one), and make sure to follow the prompts, choosing  "Deploy In Servlet Container", choose "Deploy as Single Servlet..." and choose the checkbox "Copy all jars...". When asked for the license key, you should be able to find it in the following file:

/System/Library/Frameworks/JavaWebObjects.framework/Resources/License.key

After following the rest of the project setup, you may experience some errors when the project is finally created. In fact, several. These are usually bogus.


When you finally have the app up and open in Xcode, follow these steps to configure your WO app (From David at Codebase...slightly modified):

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

You can deploy to platforms other than OSX in WebObjects 5.3, the process wasn’t exactly straight forward to me since I am new to WebObjects, this is what I figured out how to create a standalong web application that works under tomcat.

1. When you create your project, make sure you tick the Deploy in a servlet container option, select “Deploy as a Servlet Single Directory Deployment option”, also tick the “Copy all JAR files…” option. YOU MAY GET ERRORS; ignore them

2. At the XCode project window, change the active build configuration to deployment (Menu:Project->Set Active Build Configuration->Deployment), for all three targets, your app, application server and web server; access them by clicking the "Targets" drop-down arrow (looks like a red bulls-eye), double-clicking on each, selecting "settings", and then change the following build settings to

DEPLOYMENT_LOCATION = NO
DEPLOYMENT_POSTPROCESSING = NO

(if you don’t do this, the deployment build process will fail due to the script trying to cd into a symbolic link pointing back to itself.)

3. In deployment build configuration for your app, change INSTALL_PATH_FOR_STYLE to,

INSTALL_PATH_FOR_STYLE = $(TARGET_BUILD_DIR)

4. Finally, add the following build settings to the deployment build configuration of your app.

SERVLET_COPY_JARS = YES
SERVLET_DEPLOY_LICENSE = [Your deployment licence]
SERVLET_SINGLE_DIR_DEPLOY = YES
SERVLET_SINGLE_DIR_DEPLOY_LICENSE = [Your deployment licence]
SERVLET_TRUE_WAR = YES
SERVLET_WEBAPPS_DIR = /Library/Tomcat/apache-tomcat-5.5.12/webapps/

After completing these steps, build using the deployment configuration, you will find that the build process will create your webapp directory in /Library/Tomcat/apache-tomcat-5.5.12/webapps/

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

11) Build the project
12) Navigate to the /Library/Tomcat/apache-tomcat-5.5.12/webapps/yourappname/WEB-INF/lib/ folder, and copy the MySQL JDBC adaptor there as well
13) Open the /Library/Tomcat/apache-tomcat-5.5.12/webapps/yourappname/WEB-INF/ folder, and open the web.xml file using a text editor, or command-line editor.

Comment-out these line:

<resource-ref>
    <description>The data source to be used by EOF. If there are multiple data sources,
                 then the definition below must be used to configure which JDBC URL (Model) should
                 use which data source. If EOF should use a JDBC driver directly, this section must be commented out</description>
    <res-ref-name>jdbc/DefaultDataSource</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>

By adding this:

 <!--
  <resource-ref>
    <description>The data source to be used by EOF. If there are multiple data sources,
                 then the definition below must be used to configure which JDBC URL (Model) should
                 use which data source. If EOF should use a JDBC driver directly, this section must be commented out</description>
    <res-ref-name>jdbc/DefaultDataSource</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>
  -->

14) Restart your computer


That's it....you should be set!

One note, if you need to build your project multiple times (as is the development life), make sure to repeat steps 13 and 14, as each build *should* replace the directory you previously configured.

I hope this will heal the wounds of some WO/Tomcat developers who can't stand dreaded "Connection Dictionary" errors.

Thanks,
jeremy

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-deploy mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-deploy/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to