March 26th, 2008
Adobe offers a turnkey version of BlazeDS that includes an integrated Tomcat server and a number of sample applications that are installed and ready to run. In my case I already have Tomcat installed and would like to run the samples there. Here are a few notes that may help to speed you on your way if you’re trying to do the same thing. I’m on Windows but hopefully these notes will be fairly transferable to other platforms.
- Download the turnkey version from this page. While you don’t need the integrated Tomcat server, this version includes the sample applications.
- The BlazeDS Installation Guide has two sections with potentially useful information – “BlazeDS J2EE web applications” and “Additional server-specific configuration” – but the first of these sections seems to suggest that you can get the sample apps without downloading the turnkey version. As far as I can see, this is incorrect. If I’m wrong, please add a comment.
- Unzip the downloaded file.
- You’ll find 3 .war files at the root of your unzipped folder – blazeds.war, ds-console.war & samples.war. Put them into your Tomcat webapps folder and either install them using Tomcat Manager or install them by restarting Tomcat.
- At this point you should be able to open http://localhost:8080/samples/ with your browser. You’ll get a web page that will tell you how to start the sample database and run the sample applications. BTW, don’t close the command prompt window once the database is started – that will kill the database. You should be able to run the sample programs at this point.
- Next step: Setting up Flex Builder projects so that you can step through the code, then start to modify it. The http://localhost:8080/samples/ page links to another page entitled Opening the Samples Source Code in Flex Builder 3 (/samples/fb-project-setup.htm) which tells you how to do this.
- Note that you’ll be specifying several different locations as you set up your FlexBuilder project:
- You’ll copy source code, for example a ‘testdrive-101’ folder, into your Eclipse workspace, and tell Eclipse that this folder is your “project location”.
- You’ll specify several pieces of information under “server location”. These settings are discussed in Step 10 on the page just mentioned. You’ll need to modify the settings that are shown there to match your Tomcat installation’s location, and you’ll probably want to replace the port number (8400) with 8080. If you’d like to understand what these setting are you can refer to the “Creating a Flex project with J2EE” section of http://livedocs.adobe.com/flex/3/html/help.html?content=projects_3.html
- You’ll also specify a “compiled flex application location” which will typically be a folder inside the “root folder” you just specified. For example, if your “project location” is at [eclipse_workspace]/testdrive-101/, then Flex Builder will probably suggest that you use /webapps/Samples/testdrive-101-debug/ as your “compiled flex application location”. This is where the compiled SWF etc. will be deployed each time Flex Builder builds your project.
- One final note: If you get an error that says “RPC Fault faultString=”flex.samples.DAOException : java.sql.SQLException: socket creation error” it may be because the sample database isn’t running.