Monday, June 15, 2009

Flash Builder 4, Hibernate and Eclipse: Working Together

So, we at OLCC decided to give Flash Builder 4 (beta) a try. So far, we have been working only with a small sample using the JEE for its server tier, but already have learned a few valuable lessons:

Creating a New Flex Project
  • Accept the folder names flex_src, bin-debug; the FB4 doesn't deal correctly with non-default values.
  • After creating a project, go to .flexProperties and set the serverContextRoot="/YourProjectName". After opening Properties->Flex Server window, reset this value of serverContextRoot.
  • Instead of using mx:Text, there is now s:SimpleText control.
Error 404, when trying to Debug the application

When we got this, we saw the URL that FlashBuilder is trying to use to start the HTML wrapper is http://localhost:8080/ProjectNamebin-debug/Main.html. The bin-debug definitely shouldn't be there. We also noticed, that this same URL shows in the project properties on Flex Build Path page as the Server Root URL. It can't be fixed there, but we fixed it in the Debug run configuration. Trying to use Run instead of Debug was even more messy. For some reason, it tried to connect the debugger to the FlashPlayer (yes, in Run mode).

PermGen Issue

Also, recently, we had problem with running out of the space in PermGen. The only solution we found, was to reduce its size (yes, reduce!) from the default 256M to 128M.

The funny thing is, we had eclipse running fine for a long time. Then, when we installed a 2nd instance of eclipse, using a separate workspace, we started experiencing this problem. When we used the 256M, and any serious action crashed the Eclipse, we ran the eclipsec.exe which showed an error message "not able to find enough memory to start jvm with these options" or smth like this. That's why we have reduced the memory. We haven't had the PermGen issue since then. I don't understand this issue really, it's more a trial-and-error solution, but it works.


Hibernate

For Hibernate, we use:
  • Database Development perspective provided by eclipse
  • Hibernate installed via GlassFish admin console (we pointed eclipse compiler at it)
  • Hibernate Tools from JBoss Tools (installed just the hibernate tools through the eclipse update site http://download.jboss.org/jbosstools/updates/stable/)
  • JavaDB bundled with GlassFish server
This configuration seems a good mix. That's it for now.

No comments: