Setting up Blazeds ( Tomcat ) on Amazon Ec2 à la Ubuntu

We’ll throw in some lamp and phpmyadmin in too for good mesure. These are the steps I recently used to setup an Ec2 box for some dev…

Step 1: Java

#See if we have it already
javac
sudo apt-get install sun-java6-jdk
#if no repo add it...
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
# and try again
sudo apt-get install sun-java6-jdk

Step 2: Tomcat

sudo apt-get install tomcat6 tomcat6-admin tomcat6-common tomcat6-user tomcat6-docs tomcat6-examples
sudo /etc/init.d/tomcat6 start
#modify user rights so you can use the webadmin gui
sudo pico /etc/tomcat6/tomcat-users.xml
sudo /etc/init.d/tomcat6 restart

#And if we want to autostart tomcat...

sudo pico /etc/init.d/tomcat

Insert the following
# Tomcat auto-start
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid

export JAVA_HOME=/usr/lib/jvm/java-6-sun

case $1 in
start)
sh /usr/local/tomcat/bin/startup.sh
;;
stop)
sh /usr/local/tomcat/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat/bin/shutdown.sh
sh /usr/local/tomcat/bin/startup.sh
;;
esac
exit 0

Now issue
sudo chmod 755 /etc/init.d/tomcat

sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat

Step 3: Blazeds

Copy up the blazeds WAR (assuming you’ve already downloaded blazeds on your localmachine)

scp -i ~/pathto/YOURPEM.pem blazeds.war ubuntu@someelasticip
sudo /etc/init.d/tomcat6 restart

Step 4: LAMP

tasksel --list-task
sudo tasksel install lamp-server

Step 5: phpmyadmin

sudo apt-get install phpmyadmin

Add the following line to /etc/apache2/apache2.conf:
Include /etc/phpmyadmin/apache.conf

sudo /etc/init.d/apache2 restart

Extra Credit: Xuggler for kicks

uname -m (verify which version of linux 32/64)

wget http://com.xuggle.s3.amazonaws.com/xuggler/xuggler-3.4.FINAL/xuggle-xuggler.3.4.1012-x86_64-unknown-linux-gnu.sh
mv xuggle-xuggler.3.4.1012-x86_64-unknown-linux-gnu.sh xuggle-xuggler.sh
chmod a+x ./xuggle-xuggler.sh
sudo ./xuggle-xuggler.sh

sudo pico /usr/share/tomcat6/bin/catalina.sh
add
export XUGGLE_HOME=/usr/local/xuggler
export LD_LIBRARY_PATH=$XUGGLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$XUGGLE_HOME/bin:$PATH

Streaming Thinkorswim's CNBC video feed on Mac

I was a bit disspointined to find that when I moved to Mac, I lost the video stream within thinkorswim. To stream the video on Mac a few simple steps are required

1) Install VLC
2) Click on the icon to run the video externally (lower right corner)

Pentaho Kettle Scheduled Task: Windows

To run a Spoon/Kettle job from the command line (convenient for creating a scheduled task) use the following syntax:

kitchen.bat /rep:”REPOSITORY NAME” /job:”JOB NAME” /dir:/LOCATION /user:USER_NAME /pass:PASSWORD /level:Basic

Replace /job: with /file: to run a job from a file if you’re not using a repository.

Warehouse Dashboard Architecture

If Flex has a sweet spot, dashboards would be it. The technology provides a richness that makes engaging UIs very easy to implement.

For those evaluating possible solutions, I’m showcasing a simple architecture for a data warehouse / dashboard project. This particular architecture encapsulates the extract / transform so those are the only steps (simple SQL=>CSV) that need to be recreated for each environment (client) that has different source systems.

Warehouse Dashboard Architecture

Flex OLAP Take Two

After running some OLAP benchmarks it was obvious that a more scalable OLAP solution was needed.

After some quick searching and downloading, I’ve wired up a scalable Flex OLAP UI.

I downloaded and setup Mondrian from Pentaho for my OLAP server. Mondrian supports XMLA making integration easy.

I found a few Flex projects interfacing to OLAP via XMLA. The most robust appears to be Grebulon by the guys over at Sherlock Informatics

Mondrian setup required a few tweaks, as I’m running Java 6:

Added the following JARs
axis.jar
commons-discovery-0.2.jar (removed commons-logging)
jaxrpc.jar
wsdl4j-1.5.1.jar
xalan.jar

Also set the following parameters in tomcat
-Djavax.xml.soap.MessageFactory=org.apache.axis.soap.MessageFactoryImpl
-Djavax.xml.soap.SOAPConnectionFactory=org.apache.axis.soap.SOAPConnectionFactoryImpl
-Djavax.xml.soap.SOAPFactory=org.apache.axis.soap.SOAPFactoryImpl
-Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl

Using the FoodMart as a reference, the setup was very straight forward.

I had to download the Grebulon source as the .swcs had hardcoded in a few references (PivotGrid) to the FoodMart datasource.

Commercially, I’d check out FlexMonster too 🙂

Flex OLAP Benchmarks

I ran some benchmarks for the OLAP components in Flex. The OLAP components allow you to perform you’re OLAP operations client side out of the box. You *can* utilize the SDK interfaces and move your processing to the backend, should you have too much data for the browser.

That said, the benchmarks below should help define the line for “too much data.”

Record Structure:

Course:String
School:String
GradeLevel:String
SubjectArea:String
Grade:Number (Our measure)

Records / Processing Time (s)

1,000 / 3 sec
5,000 / 12 sec
10,000 / 22 sec
15,000 / 33 sec
20,000 / 43 sec

The processing times listed above are for the *client* side processing time. The data was loaded from the server before starting the benchmark.

I ran the benchmarks at various rollup depths (multiple hierarchies) which the components actually handled very well, the processing time was not significantly affected.

Extending the dataset to 125K+ records caused errors with the script timeouts occurring.

For datasets above 5-10K records, I’d suggest moving the processing to the server and passing the results to the UI. (assuming you’re looking to leverage the OLAP components as provided)

jQuery, Objective C

I’ve been diving into both as I’m looking to land some more iPhone projects. I’m really excited with the breath of fresh air the platform provides.

The big question this year….

WWDC 2010 or MAX 2010

MAX has been great, I’ve met some really great members of the community. For those of us who are Flex veterans, the conference seems a bit light, at least that’s the impression I’ve had the past two years.

Looking over the 2009 sessions of WWDC, I’m impressed, looks like a lot of great sessions.

Cheers
Josh

Glassfish LCDS Flex Up Next

It’s been a busy year getting a J2EE and Data Warehousing education. I’m wrapping up the ETL portion of a large Data Warehousing project. The next phase of the project is building a Flex front-end for the warehouse. I’m looking forward to using the Spark Architecture in Flex 4 for the UI, we should be able to generate some amazing UIs.

Cheers
Josh

Debug Server/Client LCDS Java Helloworld in Flex Builder

Prerequisites

Install Flex Builder
Install LCDS Data Services
Install WTP in Flex Builder

Here’s a simple project that shows you how to create a simple Hello World for Flex + Java via LCDS. I’ll also show you how to debug the server [java] code as we move along.

File->New->Flex Project

  • For application server type select J2EE
  • User remote object access
  • LiveCycle Data Services
  • Create combined Java/Flex project using WTP
  • 01 Setup

    Select the target runtime. You will need to click ‘New’ to create one if none are available.

    02 Server

    Create a new target runtime if needed.

    03 Tomcat

    04 Tomcat

    05 Server

    Be sure to change your Output URL to match the LCDS [tomcat] config (defaults to 8400)
    06 Setup

    Run->Debug->Other

    Again, make sure the URLs are using the correct port

    07 Debug Server

    Project->Properties->Flex Server

    08 URL Context

    Okay, are setup is complete now we’re ready to code.

    Here’s the MXML

    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.rpc.events.ResultEvent;
    import mx.rpc.events.FaultEvent;

    private function sayHello():void
    {
    testService.getOperation('sayHelloTo').send(txtName.text);
    }

    private function onFault(event:FaultEvent):void
    {
    trace(event);
    }

    private function onSayHelloToResult(event:ResultEvent):void
    {
    Alert.show(event.result as String);
    }

    ]]>
    </mx:Script>

    <mx:RemoteObject id="testService" fault="onFault(event)" destination="helloDest">
    <mx:method name="sayHelloTo" result="onSayHelloToResult(event)"/>
    </mx:RemoteObject>

    <mx:TextInput id="txtName" x="10" y="10"/>
    <mx:Button click="sayHello()" x="178" y="10" label="Go"/>
    </mx:Application>

    Note the destination=”helloDest” line, we’ll have to configure a LCDS destination with this name in a few steps…

    Create a simple java class to test against:

    
    public class HelloWorld {
    
    	public String sayHelloTo(String name)
    	{
    		return "Hello " + name;
    	}
    }
    
    
    

    And finally, we need to setup the destination

    To do so, edit \WebContent\WEB-INF\flex\remoting-config.xml, adding the following

    <destination id="helloDest">
    <properties>
    <source>HelloWorld</source>
    </properties>
    </destination>

    That’s it, now we are ready to test.

    Set a breakpoint on the on ‘return “Hello ” + name;‘ line in you’re java code.

    Launch the server in debug mode

    09 Server

    Now, launch the flex app [in debug mode if you want to debug the front end as well].

    Type your name in the input box and click ‘Go.’

    You’ll see your breakpoint being caught, both server [java] side and client side 🙂

    Flex Project Archive