Notes on running AIR apps on Blackberry playbook
After several attempts to run my non-finished app on the playbook I find it usefull to save some notes on how to proceed step by step. So many examples that can be found over the web I know, I’ll add my contribution too because it took some time to deploy it the first time so one more described experience may not be useless.
Register for signing keys on Blackberry web site here:
[A]
It’s important to save somewhere the PIN that you enter here!
- Once ordered you will receive two signing keys by email
- They are called client-RDK-XXXXXXXXX.csj and client.PBDT-XXXXXXXXX.csj.
- signing with blackberry you CSJ file.
- If you did several unsuccessfull attempts before you need to delete your previous attempts with:
blackberry-signer -cskdelete
- For others fresh new developers register your RDK file like this:
blackberry-signer -cskpass YOUR_PASSWORD_HERE
- Now remember the step [A] where you entered y pin ? enter it again after csjpin here:
blackberry-signer -register -csjpin YOUR_PIN_HERE -cskpass YOUR_PASSWORD_HERE client-RDK-XXXXXXXXX.csj
- I have then received an email saying that my CSJ registration was ok.
- Them comes the P12 file creation:
blackberry-keytool -genkeypair -keystore YOUR_FILE_NAME.P12 -storepass ENTER_STOREPASS_HERE -dname "YOUR_APP_NAME" -alias author
To create a debug token I have executed the following commands:
blackberry-debugtokenrequest -register -cskpass YOUR_PASSWORD_HERE -csjpin YOUR_PIN_HERE client-RDK-XXXXXXXXX.csj
It said :
already registered
So I did:
blackberry-debugtokenrequest -register -cskpass YOUR_PASSWORD_HERE -csjpin YOUR_PIN_HERE client-PBDT-XXXXXXXXX.csj
It said :
successfully registered with server
The debug token is created with the following command: (replace 0×444444 with your device id)
blackberry-debugtokenrequest -register -cskpass YOUR_PASSWORD_HERE -keystore YOUR_FILE_NAME.P12 -storepass ENTER_STOREPASS_HERE -deviceid 0x444444 NAME_OF_YOUR_DEBUG_TOKEN_FILE.bar
debug token created
To upload the debug token on your device, press upload debug token and then execute the following command: (replace 192.168.0.14 with your device ip address)
blackberry-deploy -installDebugToken NAME_OF_YOUR_DEBUG_TOKEN_FILE.bar -device 192.168.0.14 -password YOUR_DEVICE_PASSWORD
Now you can install unsigned apps on your device. theoretically … you need to ensure that your bar file (the one for your app) contains the same info as the debug token:
List the debug token info like this:
blackberry-airpackager -listManifest NAME_OF_YOUR_DEBUG_TOKEN_FILE.bar
Copy Author and AuthorId in the appropriate fields in the blackberry-tablet.xml file, package your app as a bar file with these info:
blackberry-airpackager -package YOUR_APP.bar YOUR_APP.xml blackberry-tablet.xml YOUR_APP.swf -devMode
and deploy it on the device:
blackberry-deploy -installApp -device 192.168.0.14 -package YOUR_APP.bar -password YOUR_DEVICE_PASSWORD
That’s it. As I said it took time for me, especially the order of the commands and also to install the debug token. These are the commands which worked for me in the same order I runned them. I hope it helps!
File upload using REST Spring MVC
A quick note on developing an HTTP POST based web service using Spring 3 MVC and its testing using curl command line program.
To me the most important resides in the configuration file:
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="300000"/><!-- Max size in bytes. -->
</bean>
The web service itself is configured like this:
@RequestMapping(value = "/fileUpload", method = RequestMethod.POST)
@ResponseBody
public myObject upload (
@RequestParam("file") MultipartFile multipartFile,
HttpServletRequest request) {...
and the curl command is:
curl -F "file=@file.jpg" http://localhost:8080/fileUpload
Edit 4/12/2011: just noticed there exists a nice working example at springsource dealing with this (and much more), here
Configuring a Java project with MS SQL Server 2000
I was recently asked to configure an existing Java project (JSP/Spring/iBatis) to run on Microsoft SQL Server 2000. I have encountered some issues on this: the other team members already had the project configured and it was running fine, so I did not expect to spend so much time on it.
First of all the project was running on JDK 1.4. If you try to download such a JDK version, the Oracle web site now tells you that this version is in an EOSL state which means (End Of service Life). It was a bit surprising to me, things are going faster than I thought
Then if you try to find a MS SQL 2000 driver on the Internet you won’t find. You will need to download the MS SQL 2005 JDBC driver. On the download page Microsoft says it works for both 2000 and 2005 version of their product. I can now tell this is true.
True, for sure, but I also had to change the spring datasource configuration a bit:
property name="jndiName" value="java:comp/env/jdbc/wwdfvpDS"
instead of this one (which works for the other team members)
property name="jndiName" value="java:jdbc/wwdfvpDS"
Basically that’s just a syntactical change and to my opinion it’s due to the JDBC driver. That’s why I think it’s safe to keep a folder on SVN with all these drivers (actually the setup.exe file for the MSSQL driver for JDBC). Best would be to upgrade the project along with the technologies upgrade. For instance if the iBatis framework evolves from version 1 to version 3.0 then the most recent has to be used. The unitary tests should ensure there’s no regression.
SFTP on Amazon EC2
Amazon Elastic Compute Cloud as well as Rackspacecloud (and many others) allows you to set up a remote server and deploy your web application (among other things).
I have setup my own account and run a small instance. For this I have used Amazon Web Toolkit plugin for Eclipse.
The documentation provided with this toolkit is fine. Unfortunately for me, as usual, it doesn’t work as expected: I have tried to run an instance located in the US but it seems that’s way too far ! I used to have this popup screen:

mmm… why did I do that ? Because I thought my fellows there would have a better time response and therefore a better user experience for the prototype that I did. I have changed the settings to point to a European instance.
This time it was starting up fine with AWS.

But running a simple dynamic web application as described in their tutorials (you don’t even need a tutorial though to create that) caused some trouble.
Another solution was to transfer the WAR file on the server and then put it into the webapps folder of tomcat. To do that why not use sftp, said Loïc to himself… ![]()
As the picture above shows you can right-click on the live server and select open shell. Your command is written at the top of the shell window. Here is what you should have:
Last login: Fri Jan 29 14:01:11 on ttys005
/usr/bin/ssh -o CheckHostIP=no -o TCPKeepAlive=yes -o StrictHostKeyChecking=no -o ServerAliveInterval=120 -o ServerAliveCountMax=100 -i /Users/loic/.ec2/eclipse-keypair.pem root@ec2-xxx-xxx-xxx-xxx.eu-west-1.compute.amazonaws.com
loic-talbots-macbook-pro:~ loic$ /usr/bin/ssh -o CheckHostIP=no -o TCPKeepAlive=yes -o StrictHostKeyChecking=no -o ServerAliveInterval=120 -o ServerAliveCountMax=100 -i /Users/loic/.ec2/eclipse-keypair.pem root@ec2-xxx-xxx-xxx-xxx.eu-west-1.compute.amazonaws.com
We have a pem file that manages the access keys to the server. In order to use them with sftp just type:
ssh-add ~/.ec2/eclipse-keypair.pem
and then you can use sftp to transfer your WAR file:
sftp root@ec2-xxx-xxx-xxx-xxx.eu-west-1.compute.amazonaws.com
Mule ESB set up with Maven under Eclipse (OSX)
I have followed the Mule ESB tutorial and found that it did not work with Java5 on OSX. I have switched to Java6 and everything was back to normal.
Everything is explained very well on Mule web site, here is what I did to get it running with Maven 2 under Eclipse on OSX.
Firstly I have of course downloaded Mule (community edition) on their download page and expanded everything in /opt folder with the following command:
tar -xvzf mule-standalone-2.2.1.tar.gz
I’ve also downloaded the mule ide plugin for eclipse and followed the instructions here
To get it running with Maven, I used the command line in my project folder :
mvn mule-project-archetype:create -DartifactId=MMuleProject -DmuleVersion=2.2.0
and then I have the following command:
mvn eclipse:eclipse
to make it available as a project in eclipse.
Then I have launched Eclipse and imported the project:
File->import->Existing project into workspace
and I have selected the MMuleProject folder as root folder. Once the project was imported i have right-clicked on the project name MMProject in the package explorer and added Mule libraries:
the project finally appears like the following inside the package explorer:
With Java 5 enabled I had this issue when trying to run the project : (right-click on mule-config.xml -> run as -> Mule Server)
INFO 2010-01-22 14:15:41,561 [main] org.mule.MuleServer: Mule Server initializing...
ERROR 2010-01-22 14:15:41,648 [main] org.mule.MuleServer: A Fatal error has occurred while the server was running: [[B
java.lang.ClassCastException: [[B
at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1215)
at java.net.InetAddress.getLocalHost(InetAddress.java:1350)
at org.mule.config.DefaultMuleConfiguration.(DefaultMuleConfiguration.java:116)
at org.mule.context.DefaultMuleContextBuilder.getMuleConfiguration(DefaultMuleContextBuilder.java:125)
at org.mule.context.DefaultMuleContextBuilder.buildMuleContext(DefaultMuleContextBuilder.java:84)
at org.mule.context.DefaultMuleContextFactory.buildMuleContext(DefaultMuleContextFactory.java:197)
at org.mule.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:186)
at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:168)
at org.mule.MuleServer.initialize(MuleServer.java:351)
at org.mule.MuleServer.run(MuleServer.java:257)
at org.mule.MuleServer.start(MuleServer.java:244)
at org.mule.MuleServer.main(MuleServer.java:121)
ERROR 2010-01-22 14:15:41,671 [main] org.mule.MuleServer:
Switching to JDK 6 solved it :
INFO 2010-01-22 14:18:18,142 [main] org.mule.DefaultMuleContext:
**********************************************************************
* Mule ESB and Integration Platform *
* Version: 2.2.0 Build: 14110 *
* MuleSource, Inc. *
* For more information go to http://mule.mulesource.org *
* *
* Server started: 1/22/10 2:18 PM *
* Server ID: 999d182b-0758-11df-82a2-811cd9e5dabf *
* JDK: 1.6.0_15 (mixed mode) *
* OS encoding: UTF-8, Mule encoding: UTF-8 *
* OS: Mac OS X (10.5.8, x86_64) *
* Host: loic-talbots-macbook-pro.local (192.168.0.10) *
* *
* Agents Running: None *
pheeewww… it should have taken a few minutes, it took a few hours to figure out I should not use JDK5. Now I’ll experience this lightweight SOA architecture to expose SOAP web services. Something for a next post.
Could not see my WSDL using Apache Axis 2 with Eclipse WTP
I have spent some time figuring out why I could not see any WSDL despite everything else seemed to be OK.
After having followed these kind of steps: Creating web services with Eclipse (Bottom up) it appears that I could not see any WSDL.
So I have typed http://localhost:8080/Axis2/axis2-web/index.jsp , then clicked on services and the following screen was displayed:
The service - Converter – seemed to be running ! but when trying to reach the WSDL by clicking on the Converter link I had this:
After some experiments I have found that the WSDL was actually correct (!) . it was just not displayed in Safari. Running the same URL on Firefox confirmed it.
It’s not the first time something is hidden by Safari unfortunately. It seems it waits a really clean html code. It’s still viewable by clicking on view-> view Source but you don’t expect immediately such a thing to happen.
Manual binding for Flex ArrayCollection
I have been pulling my hair out for a while on this!
I was manually binding an arrayCollection using mx.binding.utils.ChangeWatcher:
ChangeWatcher.watch(ModelLocator.getInstance(), "_comboChoices", prepareDataProvider);
and it did not work. After googling I have found the reason here:
http://old.nabble.com/ChangeWatcher–watch—ArrayCollection-td20594413.html
and I finally came with this single – yet working – line of code:
_modelLocator._comboChoices.addEventListener(CollectionEvent.COLLECTION_CHANGE, prepareDataProvider);
that’s it ! My prepareDataProvider function was called !
Eclipse 3.5 now runs with Java6 on Mac OSX
At last Eclipse can now be run withJava6 on mac OSX. For sure it may not be stable as the version of Eclipse is still not a release candidate but it’s a clear step forward.
Here are the steps I did to make it work:
- Make java6 be the default JDK.
- remove the link to java 5 JDK.
- set JAVA_HOME environment variable.
- download eclipse 3.5 64 bits cocoa for mac OSX.
- change the eclipse.ini file
- change the Info.plist file
I’ve now illustrated them in details:
- type java preferences in spotlight and set the parameters as illustrated below:

- removing the link of JDK 1.5
In the folder /System/Library/Frameworks/JavaVM.framework/Versions remove the current link to JDK1.5 and set it to JDK1.6
sudo rm CurrentJDK
sudo ln -s 1.6 CurrentJDK
Here is my files in this folder after the operation is completed
- setting JAVA_HOME environment variable
Check that the JAVA_HOME environment variable points to the correct path by typing env | grep JAVA_HOME
If it’s not JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home then in your home folder edit the .bash_profile file and add
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
- download the right version of eclipse
eclipse-SDK-3.5M6-macosx-cocoa-x86_64.tar.gz
and uncompress it in the folder of your choice.
- change the config.ini file
There ‘s a config.ini file in the configuration folder of the eclipse installation. Edit it to add:
-vm /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java
It tells eclipse platform the default version to use to run the program.
Then you’re done, launch ./eclipse in the root directory of the eclipse installation.

I have done this with Eclipse 3.5M5 version. The release candidate should be available very soon.






