Blogs

SpringSource Blog

Introducing the Flex Addon for Spring Roo

Jeremy Grelle

Recently we released the first milestone of the Flex Addon for Spring Roo as a part of the Spring BlazeDS Integration 1.5.0.M1 distribution. This addon aims to bring the productivity and usability benefits of Spring Roo to the development of Spring-based RIAs with Flex. The below 15 minute screencast (split into two parts) serves as a quick introduction to the addon and its capabilities. Watch as we go from installation of the addon to a fully functional Flex application backed by Spring in just a handful of commands.


Part 1 walks through the initial download and installation of the addon, as well as initial setup of a Spring Flex project using the Spring Roo integration in SpringSource Tool Suite.


Part 2 demonstrates use of the "flex remoting" commands to generate and update Flex UI scaffolding backed by Spring and Hibernate.

Similar Posts

Share this Post
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • DZone
  • LinkedIn
  • Slashdot
  • Technorati
  • Twitter
 

38 responses


  1. Interesting screencasts. I consider Spring Roo a very productive tool to build Java web-based App. I hope field reference will be supported for GWT on the next release.


  2. Very good introduction to work with Java and FB4. I encountered a few problems, but they seemed to be covered on Jira. One thing still was left unexplained; adding the Flex nature and generating the HTML-templates were missing after invoking "flex setup". That's funny because they seem to be generated on the video.


  3. tero,

    We do generate the HTML templates as part of the "flex setup" command, but the Flex nature gets added by running "mvn eclipse:eclipse". STS executes the needed maven command automatically anytime the pom changes (so in this case, it gets run right after "flex setup"), but if you're working from the command line outside of STS, you would need to execute it yourself.

    Thanks,

    Jeremy


  4. Hi Jeremy,

    actually, I am using STS with Roo Shell window. After "flex setup", I must manually enter to terminal and excute "mvn eclipse:eclipse", when it starts to download the Flex jar-files from Sonatype's repository. After this visit to terminal and refreshing the project on Eclipse, I get the Flex nature, but I still need to recreate the HTML-templates (using the Problems' window Quick fix).


  5. Hi Jeremy

    I am not able to load both the flash content, it not only happening at my PC but also evident at other PC too. Can you please help?


  6. Tero are you using the Roo 1.1.0.M2 or M1? I also come across this problem but only when using Spring Flex add-on 1.5.0.M1 with Roo 1.1.0.M2 and STS 2.3.3.M2. The html-template is generated correctly when using M1 versions of Roo and STS. But at least there's a manual work around for M2.


  7. I am using the M2 version and executing "mvn eclipse:eclipse" on terminal every time Eclipse indicates errors or problems in the project. That's the manual work around for M2.


  8. Hello Jeremy Grelle,

    Thanks! for the nice video tutorials.

    When I deploy the war on Tomcat it works fine, but When I deploy it on JBoss 4.2.3GA having some problems

    00:30:32,578 INFO [STDOUT] 2010-08-01 00:30:32,578 [main] ERROR org.springframework.web.context.ContextLoader – Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in file [C:\roo jboss\jboss-4.2.3.GA\server\default\tmp\deploy\tmp6143784798931102292TestingRoo-exp.war\WEB-INF\classes\META-INF\spring\applicationContext.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in file [C:\roo jboss\jboss-4.2.3.GA\server\default\tmp\deploy\tmp6143784798931102292TestingRoo-exp.war\WEB-INF\classes\META-INF\spring\applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)

    I am using these jars

    hibernate-annotations-3.5.1-Final.jar
    hibernate-commons-annotations-3.2.0.Final.jar
    hibernate-core-3.5.1-Final.jar
    hibernate-entitymanager-3.5.1-Final.jar
    hibernate-jpa-2.0-api-1.0.0.Final.jar
    hibernate-validator-4.0.2.GA.jar

    Can you please help me out, I want to make it work on JBoss 4.2.3GA

    Note: For people who are having problems refer to http://sureshpaleti.blogspot.com/2010/07/urlrewrite-error-in-sts.html


  9. Hello,

    Where do I get that flashbuilder plugin? is it free?


  10. I am currently trying to follow your video exactly but with no success. I am using STS 2.3.3.M2 and have tried it with both roo 1.1.0.M2 and roo 1.1.0.M1. I am using Flex 4 plugin. Can I have a copy of your simple example and see if I import it and run it? Does your example run using the "Run As Server" within STS. I know after running this I have to "run As Web Application" using Flash perspective. The GUI comes up successfully but I can't create an Artist or anything. I don't have tomcat installed on my new laptop yet so haven't tried running it as you did using tomcat 6.0. The error I get is "cannot invoke method list" and "cannot invoke method create".


  11. Hi. Same problem here…
    After tons of different configurations of urlrewrite.xml, flex-config.xml, web.xml and services-config.xml I'm still stuck and cannot get my spring-flex integration working.
    I keep on getting alternatively (accordingly to configuration changes) these two errors within the "Remote Operation Failed" popup:
    - Cannot invoke method 'list'.
    OR
    - Send failed.

    I realized that mapping the messagebroker channel into web.xml as "/messagebroker/amf" instead of "/messagebroker/*" the application can use (at least) the channel, but no methods from the backend can be invoked.

    Is there somebody who can help us out?
    Any hint will be GREATLY appreciated.


  12. Hi. same problem here using sts 2.5.0 M3
    has anybody solved this.
    Any help will be appreciated.


  13. Hi,

    currently i using sts 2.5.0 M3,
    i have same problem until i tried to edit generated services-config.xml
    and remove string "app/" of endpoint url, for example:

    become

    and it is work for me, i hope this can help


  14. Where can I get a copy of STS 2.2.3.M1 (Eclipse 3.5.x based probably) Mac carbon? I called no joy with STS 2.5.0M3 (Eclipse 3.6 base)


  15. Anyone who wants to do this without STS 2.2.3.M1 – you can kick off the project creation from the Roo shell itself with project –topLevelPackage then follow along. I think at the end you can do a perform package to get some wars to deploy to Tomcat.


  16. Hi you all.
    I have some news regarding this issue – I finally got it working. Here it is how (I think….there is something strange I cannot completely understand):
    - I followed the suggestions read here, and somewhere else, on how to properly configure the services-config.xml, so I removed the "/app" part from endpoints and configuring the amf channels with no polling.
    - I launched the project from command line with the "mvn tomcat:run" command. This somehow compiled the flex frontend against my services-config.xml (I believe), as after this I can successfully launch my project from inside STS tc server as well. Really looks like the STS.2.5.0.M3 is missing something when facing flex integration.

    Maybe someone could analyze this deeper and find the real reason behind this.
    But for the moment, doing some strange voodoo, the flex-spring integration seems to work eventually.


  17. Yuli. You don't need to modify the code to strip out the app/…
    I have to confess I was thrown by this initially too. I noticed a servlet named the same ways as the top level package that had a url-pattern of /app/*.
    I couldn't see it in the exploded war when I deployed it to tomcat. It was then I noticed the urlrewrite.xml. I posted about it in this thread.
    http://forum.springsource.org/showthread.php?t=96671
    Don't use the BlazeDS turnkey distro, instead use the mvn tomcat:run option.
    I found this pointed to port 8080 by default. So I had to comment out $CATALINA_HOME in my .profile , so port 8080 wasn't used by STS tc-server-developer-2.0.3.RELEASE (Tomcat server embedded in sts-2.5.0.M3-e3.6-carbon) and reboot my Mac.
    Then the whole thing ran without a hitch 'as is'.


  18. hello, what is flex addon and roo version for sts 2.5.1 ?


  19. For anyone trying to get things working with newer versions of Roo and STS, see here for info:
    http://forum.springsource.org/showthread.php?t=98528


  20. Still can't get this run… it's now 7 days when i keep trying do anything with spring roo… I don't know what to think about this tool… it's buggy? crappy? or what?! I'm using STS 2.5.1, Spring Roo 1.1.0 Relase, Flex Addon from above link.
    First of all Roo Shell in STS doesn't work (want execute any comand, hangs whole sts)…
    I'm using Mac Shell to use Roo…. but every time i'm founding new project from scrache, i'm getting different errors..
    From 2 days I have problem with dependencies, after resolving it, i have 404 in browser after running this scaffolded project.. from one hour I can't recognize flex-config.xml… it's something terrible… I'm using java 6 mac edition – maybe this is why this wan't work?


  21. 1) What's the scoop on STS STS 2.5.1 on a Mac these days? Carbon or Cocoa? What's the most reliable in your eyes?
    I remember being told on earlier releases to avoid Cocoa (2.3.3) http://download.springsource.com/release/STS/doc/STS-installation_instructions-2.3.2.RELEASE.pdf

    2) Also in your latest forum post dated 19th Nov 2010 (which you linked to here on the 20th Nov 2010), you make no mention of what build of Spring BlazeDS Integration is required! Am I to assume it is still Spring BlazeDS Integration 1.5.0.M1?
    Here's my attempt to cross reference information for other developers.

    Spring BlazeDS Integration (Before 1.5.0.M1) (Now ????) (Link http://www.springsource.org/node/2707 )
    Roo (Before1.1.0.M1) (Now 1.1.0.RELEASE) (Link http://www.springsource.com/download/community?project=Spring Roo )
    Flex Addon for Roo (Before 1.0.0.M1 ) (Now – Is the link still the latest)- (Link http://s3browse.springsource.com/browse/maven.springframework.org/snapshot/org/springframework/flex/roo/addon/org.springframework.flex.roo.addon/1.0.0.BUILD-SNAPSHOT/ )
    STS (Before the non existent STS 2.3.3.M1!) (Now STS 2.5.1 (Cocoa or Carbon for Mac?) (Link http://www.springsource.com/landing/best-development-tool-enterprise-java )

    A tabulation of all this good stuff would be a welcome addition to your blog.

    3) When can we expect to see Flex working with Spring Roo 1.1.0M3 with Flex : You mentioned elsewhere UrlRewriterFilter is being phased out. Would like to see this out of there too. Adds too much complexity as you said…


  22. It does not work with togehter

    sts-2.5.1.RELEASE
    and with flex addon
    spring-flex-1.5.0.M1\dist\org.springframework.flex.roo.addon-1.0.0.M1.jar

    nor with
    org.springframework.flex.roo.addon-1.0.0.BUILD-20110102.020008-185.jar

    Tested on Win7 JDK 6.
    It completely freezes when I click on create new roo project after copied flex addon to boundle folder.


  23. I was able to successfully get the Roo addin to work with Roo 1.1.0 RELEASE by building it from SVN trunk (r469). That version does NOT work in Roo 1.1.1 RELEASE (which hangs). Hope that helps someone!

    As always with Spring projects, please do post to the forums with issues, you're much more likely to get a prompt response!

    Peter


  24. I can't find the flex link in the flash builder 4 plugin directory. I am trying to replicate the instruction step by step but I can't seem to find com.adobe.flexbuilder.feature.core.ns1.link


  25. Hi,

    What do you mean by running "mvn eclipse:eclipse" to add the flex nature? I am new to maven and using Windows. STS is not performing this task, mvn is not on the system path, and I have no idea what to do.

    CD [projectfolder]
    path_to_maven\mvn eclipse:eclipse ??

    Can it be done inside eclipse?

    thanks,

    Jon

    STS 2.6.0.M1
    roo 1.1.0.RELEASE


  26. @Jon,

    If STS is not automatically updating the classpath, it could be because you didn't select "Dependency management only" in the "Maven Support" section of the "New Roo Project" dialog.

    'mvn' is the main executable for Maven. To use Maven from the command line, you do need to have this executable included in your Windows PATH. Maven usually gets installed by STS in the "springsource" directory, and the executable will be in the Maven install's "bin" directory.

    You would execute 'mvn eclipse:eclipse' from the root project folder to get the project's classpath updated, and then refresh the project inside Eclipse to get the changes picked up. But I'd suggest going through the project creation again first and making sure you've selected "Dependency management only".


  27. thanks Jeremy,
    now it adds the Flex nature by itself. But I found that I have to add the commons-logging, spring-asm and spring-core to Classpath of the tomcat server to avoid runtime errors. Is the a way of handling dependancies automatically in the WEB-INF etc? I also notice that you use a different tomcat in your video to the integrated one as well.


  28. I couldn't find the old download for sts-2.3.3.M1 so I just used the most recent version. The problem is that newer versions of sts don't support spring-roo-1.1.0M1. I have to use spring-roo-1.1.0M1 because that's the only version that works with the Flex add on from spring-flex-1.5.0.M1. So I'm using the command line for roo. Then I go over to sts and just refresh the project to see the changes. It's not the optimal way to do it but essentially it's the same thing.

    To get the Flex plugin for STS just download the Flash Builder 4 plugin installer from the Adobe website and run through the install wizard. It will ask you which Eclipse (sts) installation you'd like to apply it to. It's not necessary to copy the com.adobe.flexbuilder.feature.core.nl1.link file since the installer will do that for you.


  29. @dtillz,

    The current nightly snapshots are compatible with Roo 1.1.0 GA, so I'd suggest grabbing that instead if you want to use it from STS.

    As for the plugin install process, at the time of creating this screencast, the installer would not actually copy the .link file into the proper location, even though it asked for one. Are you finding that it actually does this correctly now? That'd be good to hear.


  30. @Jeremy Grelle

    The reason I'm using spring-roo-1.1.0M1 is because of the Flex add on. The only combination that seemed to work for me was spring-roo-1.1.0M1 and spring-flex-1.5.0.M1.

    Yes, the FB4 plugin now auto installs the .link file in the STS dropins folder.

    I'm now having an issue creating the numberOfMembers field for the Artist entity. I use the below command as stated in your tutorial:

    field number –type java.lang.Integer –fieldName numberOfMembers –notNull –min 1

    When I execute the command I get:

    Command 'field number –type java.lang.Integer –fieldName numberOfMembers –notNull –min 1' was found but is not currently available

    I think I've fallen out of the step-by-step project creation process. When I execute 'hint' I get the standard Welcome to Roo info. How can I step back into the project creation process without having to create a new project?

    Thanks.


  31. @dtillz

    I'm happy to continue helping you, but would prefer to carry out this discussion in the Forums: http://forum.springsource.org/forumdisplay.php?f=61

    You will also find info there on how to get up and running with the nightly snapshots of the Flex Addon with Roo 1.1.0.GA


  32. @Jeremy Grelle

    Thanks for the link to the forums. I've resolved all my issues.


  33. Cool


  34. Nice post. I was checking constantly this blog and I am impressed! Very helpful info specifically the last part :) I care for such info much. I was looking for this certain information for a very long time. Thank you and good luck.


  35. Nice post. I was checking continuously this blog and I'm impressed! Extremely useful info specially the last part :) I care for such info a lot. I was looking for this certain info for a long time. Thank you and best of luck.


  36. It always surprises me how many maven based project fails for users that try to do 'exactly' the same as on a screencast.

    I have come across many maven based projects, but properly I lack the understanding, or maven acts up on me and everybody that responds to a blogpost, except for the blogposter :)
    Really, I am not impressed by this tool (and maven) I can do exactly the same with a couple of remote objects calls from flex and some Pojo's and Blaze-DS.

    i think though maven is nice once you read through millions of internet pages, but for the average Java Jo maven is just a pain in the rear and forces you to much to do things the maven way.


  37. Great screencast – great concept – but TOTAL FAIL when it comes to use in real world :-( can you PLEASE make it work with release versions ? spent all day hunting down "right" versions of roo and addon – and still worked only 1/2 way.


  38. Recently I have downloaded and installed Spring STS 2.9.0 M2. But when i am trying to run command

    persistence setup –provider DATANUCLEUS –database GOOGLE_APP_ENGINE

    then showing following error at pom.xml

    Plugin execution not covered by lifecycle configuration: net.kindleit:maven-gae-plugin:0.9.2:unpack

    and also when i run the project it runs without any problem but when i tried to save data then throw exception. I need an example for developing a simple site and deploy it into google app engine. If any one have any tutorial please provide the link ….

3 trackbacks

Leave a Reply