Adobe
Products
Acrobat
Creative Cloud
Creative Suite
Digital Marketing Suite
Digital Publishing Suite
Elements
Photoshop
Touch Apps
Student and Teacher Editions
More products
Solutions
Creative tools for business
Digital marketing
Digital media
Education
Financial services
Government
Web Experience Management
More solutions
Learning Help Downloads Company
Buy
Home use for personal and home office
Education for students, educators, and staff
Business for small and medium businesses
Licensing programs for businesses, schools, and government
Special offers
Search
 
Info Sign in
Welcome,
My cart
My orders My Adobe
My Adobe
My orders
My information
My preferences
My products and services
Sign out
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out My orders My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Review and Checkout
Adobe Developer Connection / Flex Developer Center /

DigiPri Widgets sales dashboard – Part 2: Setting up the server application

by Dave Flatley

Dave Flatley
  • pxldesigns.com

Created

28 June 2010

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
Flex MySQL remoting RIA Tomcat

Requirements

Prerequisite knowledge

Some experience with application servers, databases, Java, and server administration will be helpful.

User level

Intermediate

Required products

  • BlazeDS (Download trial)

Sample files

  • AdobeCRM_files_pt_2-3.zip (8004 KB)

This article is Part 2 of a series of articles and tutorials centered on a sales dashboard application built using Flex and the Adobe Flash Platform. The individual articles in the series are designed to stand on their own, so you can read all of them or just the ones that interest you, in whatever order you like.

This part steps you through the process of setting up the server application for the DigiPri Widget sample application. For an overview of the application, see Part 1: Overview. For a closer look at the application and its architecture, see Part 3: Understanding the dashboard application. For a more in-depth look at the code, see Part 4: Exploring the code in Flash Builder.

The DigiPri Widgets sales dashboard uses BlazeDS, the server-based Java remoting and web messaging technology, to connect the Adobe Flex front end to the back-end server application. In developing the dashboard, the focus was on developing an application that illustrated Flex and BlazeDS independent of the server-side technology used. With this in mind, the main goals in building the server application were to keep it simple, straightforward, and easy to understand so that it could be adapted to another language, application server, or database. As a result, the server-side implementation does not include any additional frameworks—such as Spring and Hibernate—that one might employ when building a production-ready or mission-critical application.

In the spirit of simplicity, the server software is based on easy-to-set-up and free software packages so you can set up and deploy the application on your own development workstation. These software packages include MySQL 5.1 RDBMS, J2SE 5.0 (Java Platform Standard Edition 5.0), and the latest production release of BlazeDS (the turnkey download contains a ready-to-use version of Tomcat, currently version 6.0.14).

To get started, you'll need to download the following software packages:

  • MySQL 5.1: The MySQL Community Server is freely downloadable.
  • J2SE 5.0 (Java 2 Platform, Standard Edition 5.0): If you already have JRE 1.5.0 or greater installed, you can skip this.
  • MySQL Connector/J: This is the Java application archive (JAR) file used by the Java application to connect to the MySQL database server.
  • BlazeDS: Select the turnkey download with the ready-to-use version of Tomcat (version 6.0.14).

This article explains how to install and configure each software package in order to deploy and test the server application. You'll need to install the software packages in the order presented here to avoid configuration problems.

Database setup and configuration

After downloading the MySQL 5.1 binary distribution for your particular operating system, follow the instructions included with the download to install the software.

Next, download and install the MySQL Administrator and MySQL Query Browser tools, which you'll need to follow the steps below. If you are familiar with the MySQL command line and prefer to work with it, you should be able to make the necessary configurations based on the following instructions.

Start the restore operation and create your schema

First, you'll need to create the database schema for the CRM server application. Instead of creating a new database and each table manually, you can use the restore feature in the MySQL Administrator tool to create the schema and populate the database from the backup file, adobeCRM_backup.sql, which is included with this article's sample files.

Follow these steps to create the database:

  1. Run the MySQL Administrator tool and click Restore (see Figure 1).
Restore on Windows (top) and Mac OS X (bottom)
Restore on Windows (top) and Mac OS X (bottom)
Figure 1. Restore on Windows (top) and Mac OS X (bottom)
  1. To begin the restore operation click Open Backup File (Windows) or Choose File (Mac OS X) and then browse to the adobeCRM_backup.sql sample file.
  2. Click Open.

    On Mac OS X you'll see the adobeCRM database schema ready to be restored. On Windows, you have to perform an extra step to ensure the backup file is ready for the restore operation.

  3. If you're running the Windows MySQL Administrator tool, click the Restore Content tab (see Figure 2) and then click Analyze Backup File Content. You should now see the database schema ready to be restored.
The Restore Content tab (Windows)
Figure 2. The Restore Content tab (Windows)
The database is ready to be restored (Windows).
Figure 3. The database is ready to be restored (Windows).
  1. Click Start Restore (Windows) or Restore Backup (Mac OS X) to begin the restore process (see Figure 3).

Create a new user account

After restoring the database schema you need to create a user account for accessing the database used by the application.

  1. Run the MySQL Administrator tool and click User Administration (Windows) or Accounts (Mac OS X).
  2. To create a new MySQL user on Windows, click Add New User near the bottom of the screen; on Mac OS X click the Add New User icon in the lower left-hand corner of the screen as (see Figure 4).
The Add New User button (Mac OS X)
Figure 4. The Add New User button (Mac OS X)
  1. In the Login Information group on the right of the screen, type adobeCRM as the user name and type adobeCRM as the password (see Figure 5). Both the user name and password are case sensitive.

    Note: You can configure the user name and password used to access the data source later by editing the META-INF/context.xml file when the application is deployed. The default configuration uses adobeCRM for both by default.

Typing the MySQL user name and password on Windows (top) and Mac OS X (bottom)
Typing the MySQL user name and password on Windows (top) and Mac OS X (bottom)
Figure 5. Typing the MySQL user name and password on Windows (top) and Mac OS X (bottom)

After you have created the user, you need to grant schema privileges to the adobeCRM user account.

On Mac OS X, however, you first have to associate a host (that is, location) from which the adobeCRM user account can connect to the database. To do this, click the Add Host button located in the lower left-hand corner of the MySQL Administrator tool (see Figure 6) and select localhost in the dialog box that appears.

The Add Host button (Mac OS X)
Figure 6. The Add Host button (Mac OS X)
  1. With the adobeCRM account selected, click the Schema Privileges tab in the User Administration screen (Windows) or click Schema Privileges on the Accounts screen (Mac OS X).
  2. Select the adobeCRM database schema in the Schemata pane (Windows) or the Schemas pane (Mac OS X).

    Note: Depending on how you choose to configure your instance of the MySQL 5.1 database server, you may see the schema name as adobecrm (note the name is lowercased). This should not have any impact on the application accessing the database, but it is worth noting the discrepancy.

    You now need to select the appropriate privileges for the adobeCRM user. Since the application is a sample and not an application intended for production use, it can use a shotgun approach for granting user privileges (that is, you will be granting all privileges to the adobeCRM user.)

  3. Click the Schema Privileges pane in the User Administration screen (Windows) or the Schema Privileges pane in the Accounts screen (Mac OS X).
  4. On Windows, click the << button to assign all privileges (see Figure 7).
Schema Privileges screen
Figure 7. Schema Privileges screen
  1. On Mac OS X, you must first select localhost as the host associated with the adobeCRM user account (see Figure 8). Next, select all the available privileges and add them using the Add Privileges (<) button.
Selecting localhost (Mac OS X).
Figure 8. Selecting localhost (Mac OS X).

Note: If you were building a mission-critical or production-use application, you would most certainly want to grant only the privileges necessary for the adobeCRM user to get the data it needs. Granting all privileges to a user is not common practice and is strongly discouraged.

After you have assigned the schema privileges to the adobeCRM user, your database is ready to be used by the server application.

Server setup and configuration

The BlazeDS turnkey download includes a preconfigured, fully functioning version of Apache Tomcat, an open source servlet container.

After downloading the BlazeDS turnkey distribution, extract the files to C:/blazeds on Windows or Applications/blazeds on Mac OS X. In order to run the DigiPri Widgets dashboard application, you must have access to this directory so you can start and stop Tomcat.

Configuration

Once you have BlazeDS with Apache Tomcat installed, you need to download and install the MySQL Connector/J Java application archive (JAR file), which is used by the Java application to connect to the MySQL database server:

  1. Download and extract MySQL Connector/J.
  2. Copy the mysql-connector-java-5.1.12-bin.jar file to Tomcat's lib directory.

Note: The version number (5.1.12) may change; it's OK if the version you download has higher numbers.

It is important to note if you started from a standalone Tomcat installation (instead of the turnkey BlazeDS version) you would have more configuration steps to do. For example, you would have to build and deploy both a web.xml file and a context.xml file, which are responsible for defining various aspects of the Java server application. A detailed explanation of these two files is outside the scope of this article, but for the purposes of the DigiPri Widgets sample application you need not edit them; they are already preconfigured.

Deploying the web application

Now that you've configured Tomcat and the MySQL database connector is in its proper location, you need deploy the DigiPri Widgets dashboard web application itself:

  1. Copy the adobeCRM.war (Web Application Archive) sample file to the webapps directory in the Tomcat installation directory. (The WAR file is included in the sample ZIP file that accompanies this tutorial.)
  2. Start the Tomcat server by changing to the Tomcat/bin directory and executing startup.bat (Windows) or startup.sh (Mac OS X).
  3. After Tomcat starts, access the application in your browser at the following URL:

http://localhost:8400/adobeCRM

If everything is set up correctly, you should see the DigiPri Widgets sales dashboard application with data being returned from the server and showing up in the various report views. If you do not see data being populated in the charts, here is a list of items to troubleshoot.

  1. Make sure that you assigned the proper privileges to the adobeCRM account in MySQL Administrator.
  2. Double check that the user name and password in the META-INF/context.xml file correspond to your MySQL server user account.
  3. Ensure that MySQL server and Tomcat are currently running.

Where to go from here

Now that you have the application up and running, you can read the DigiPri Widgets overview in Part 1 (if you haven't already done so) or proceed to Part 3, Understanding the Dashboard Application, to learn more about Flex 4 integration with the server-side implementation. Alternatively, you can skip to Part 4 to explore the client-side code.

More Like This

  • Using automated tools across the lifecycle to develop higher quality Flex applications
  • Increasing Flex and ActionScript development productivity with Flash Builder 4.5 and SourceMate 3.0
  • Why choose Flex and PHP
  • DigiPri Widgets Sales Dashboard – Part 3: Understanding the dashboard application
  • DigiPri Widgets Sales Dashboard – Part 4: Exploring the code in Flash Builder
  • Data paging with Flex and PHP using Flash Builder 4
  • Tool-based approaches for data-centric RIA development
  • DigiPri Widgets Sales Dashboard – Part 1: Overview
  • Flexible Rails excerpt: Refactoring to RubyAMF
  • Flash Builder 4 and PHP – Part 2: Zend AMF and Flash Remoting

Tutorials & Samples

Tutorials

  • Flex mobile performance checklist
  • Flex and Maven with Flexmojos – Part 3: Journeyman
  • Migrating Flex 3 applications to Flex 4.5 – Part 4

Samples

  • Twitter Trends
  • Flex 4.5 reference applications
  • Mobile Trader Flex app on Android Market

Flex User Forum

More
07/25/2011 Flash Player Debug Issues - Safari 5.1 & Chrome 13
04/22/2012 Loader png - wrong color values in BitmapData
04/22/2012 HTTPService and crossdomain.xml doesn't work as expected
04/23/2012 Memory related crashes in Flex application

Flex Cookbook

More
04/06/2012 How to detect screen resize with a SkinnableComponent
02/29/2012 Embed Stage3D content inside Flex application components
02/15/2012 Custom WorkFlow Component
02/09/2012 Using Camera with a MediaContainer instead of VideoDisplay

Products

  • Acrobat
  • Creative Cloud
  • Creative Suite
  • Digital Marketing Suite
  • Digital Publishing Suite
  • Elements
  • Mobile Apps
  • Photoshop
  • Touch Apps
  • Student and Teacher Editions

Solutions

  • Digital marketing
  • Digital media
  • Web Experience Management

Industries

  • Education
  • Financial services
  • Government

Help

  • Product help centers
  • Orders and returns
  • Downloading and installing
  • My Adobe

Learning

  • Adobe Developer Connection
  • Adobe TV
  • Training and certification
  • Forums
  • Design Center

Ways to buy

  • For personal and home office
  • For students, educators, and staff
  • For small and medium businesses
  • For businesses, schools, and government
  • Special offers

Downloads

  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2012 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy Policy and Cookies (Updated)

Ad Choices

Reviewed by TRUSTe: site privacy statement