Spring/BlazeDS Integration Test Drive: M2 Update Available

UPDATE: This version of the Test Drive is now obsolete. I posted a new version of the Test Drive for the RC1 build of the Spring / BlazeDS integration project here.

I updated my Test Drive for the M2 build of the Spring / BlazeDS integration project.

The Test Drive now includes a sample demonstrating the integration with Spring Security (the key new feature in M2). The Spring configuration file has also been updated to use the new simplified XML-namespace-based configuration.

Installation Instructions:

  1. Download the Spring / Flex TestDrive here: http://coenraets.org/downloads/spring-flex-testdrive-M2.zip
  2. Unzip it in your root directory
  3. Navigate to /spring-flex-testdrive/tomcat/bin and start Tomcat (for instance: catalina run)
  4. Open a browser and access http://localhost:8080
  5. Follow the instructions

As always, I’d love to hear your feedback and your ideas to improve this Test Drive.

Christophe

  • Andy.Liu

    So cool!
    Thank you for your nice example.

  • shree

    I am new to Flex. I downloaded and ran your testdrive and it works great out of the box.
    How can I import Flex and Java projects together into same Flex Builder workspace (I installed Java plugins in Flex Builder already) and play with them to understand more clearly. I also want to use Tomcat 5.5 as the server in Flex Builder.

  • christophe

    Shree,
    There are several approaches to create a project for a Flex application that works with Java. A very simple approach is defined at http://localhost:8080/fb-project-setup.htm (start the test drive server first). Another setup is to combine the Flex and Java projects: Mihai has some instructions here: http://corlan.org/2008/06/05/creating-a-combined-flexjava-project-in-flex-builder-wo-lcdsblazeds/.
    Christophe

  • Venu

    Great! Thanks.

  • Prashanth

    Awesome. Thanks a lot Christophe. I will check it out.

  • Derek S

    Congrats on M2! This testdrive will help everyone learn by example. Thanks!

  • Prashanth

    I removed the TomcatLoginCommand configuration from services-config.xml and the security still works. I think this was from the old M1 integration.

    When you do a ro.channelSet.login(username, password) what is actaully happenning with this whole integration. Can you please explain the flow of logic from Flex Client -> BlazeDS -> Spring Security?

    thanks & Rgds
    Prashanth

  • stef

    excellent work! SB

  • Hi Christophe,

    I had a few problems when I created projects from the source code provided.

    1) flexlib.swc was missing from the Flex projects using SuperTabNavigator. This was easily resolved but you might want to just include it.

    2) When I overwrite the Java classes with my own, I get the following error:
    Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class flex.spring.samples.product.ProductDAO]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given

    Any ideas on that one?

    Thanks.

    -James

  • Hi James,
    1) Yes, I will include flexlib.swc in the next rev. In the meantime, if other people have that problem, it’s available here: http://code.google.com/p/flexlib/. Download flexlib-.2.4.zip and copy flexlib.swc (/bin) in the lib directory of your project.
    2) Does your class have a no-arg constructor? If not, add one and it should work. It looks like a CGLIB proxies requirement. Notice that it will only happen when using security.

    Christophe

  • Thanks Christophe. Adding a no-arg constructor to the ProductDAO fixed the problem.

    -James

  • Cameron Collins

    Brilliant! After getting over the Spring curve (the test drive was essential to get over the summit) every thing is running smooth. Now I’m geeking out on Spring.

    >Cameron

  • Thanks you…

  • Rossen

    If the ProductDAO were to implement an interface for the methods being intercepted for security resons – in this case “find*”, then Spring AOP would use JDK dynamic proxies instead of CGLIB. A simple way to do that is to rename the ProductDAO to JdbcProductDAO and use ProductDAO as the interface.

    Rossen

  • Mohammed

    Many thanks Christophe,
    the test drive is working well with me. Only I faced problems when starting developing my own application based on your code. Fighting for more than 8 hours I got it work but when using usecured services. Unfortunately, I got the following error when I press the “Get Data” button calling a secured service method:

    faultCode:Server.Processing faultString:’No destination with id ‘securedCubeService’ is registered with any service.’ faultDetail:’null’

    What did I do wrong? Another wondering is how you pointed to the service-config.xml? I see that you used own empty testdrive-servlet in the web.xml.
    Peace!
    Mohammed

  • Thanks you…

  • Rahul

    Hi Christophe,
    I am new to flex. I am trying out a simple HelloWorld sample for BlazeDs integration with Spring which is accessed from Flex client. I have declared the remoting as mentioned below in file web-application-config.xml, but somehow flex client is not able to access the service.

    The code for flex client looks like following.

    ?xml version=”1.0″ encoding=”utf-8″?>

    web.xml – In this file I have declared dispatcher servlet, context-param and ContextListener.
    helloworld-servlet.xml – only namespace declaration. No spring beans declared in this file.
    WEB-INF/conf/web-application-config.xml – Declares Service bean and tags for exposing the service through BlazeDS.

    Am I missing something? Please help.
    Thanks and Regards,
    Rahul

  • will follow it,and firmly study;you are great Christophe

  • anil

    There is some issues with the zip archive file.
    Please check it.

  • Alex

    This is fantanstic!

    Thanks a million.
    Alex

  • Pingback: Download the Flex and Spring Integration Refcard()

  • tang

    thanks….
    I am learning…

  • Sergey RUS

    ТО christophe:
    Download blazeds dev guide, there is full tutorial about integration with tomcat.

  • Sergey RUS

    Why there is no spring-flex dependencies in maven =(

  • Sergio

    ТО christophe: Which jdk version are you using? Cause i am using jdk 1.6u13 and when i compile the java source code the application stop working, then i have to copy the .class from yours project to mine and then it work´s again. Any idea?

  • Jay Mann

    This is excellent! Thanks Christophe.

    only problem is i loaded up your source code in eclipse and i get the error
    “Could not generate CGLIB subclass of class” for the securedProductService.

    It seems your source code in the zip for ProductDAO is missing the default no parameter constructor, but your class file has it.

    Also is there a way to make the bean stateful ie. scope=”session”

    Thanks,

    -J

  • I want to gain access to zip file content and display that content in a AIR application. From my research I have found that I’ll need to use a remote object to use for my needs a Java zipfile class, Ruby & .Net also have zipfile api but for now I’m using Java. My question can I use this Spring/BlazeDS integration in a desktop application.

    BlazeDS is for a web application, well any ideas.

    Thanks for any help

    James

  • Pingback: Flex with Java « Aditya’s Blog()

  • Pingback: Integrating Spring with BlazeDS on TOMCAT « Aditya’s Blog()

  • kwame

    Hello Christophe,
    Your tutorial is very nice,
    1) but how do you resolve the problem of hibernate lazy-loading feature with SBI?
    Can you give me a step by step example?

    2)Are there tools (integrated with SBI) to generate as3 model entities from the entity beans?

  • Pingback: RC1 of Spring BlazeDS Integration is Available | ITHighlight.Com()

  • Chris

    There is a project called Gilead which will clean the bytecode instrumentation data out of your beans that were loaded from hibernate before sending to your flex client and re-insert this data upon return from the flex-client.

  • francois

    Hi, sorry for my english, I’m french so…

    I’m developping an application with Flex/BlazeDS/JEE.
    I watch your samples, but there is something I can’t understand.
    If I use BlazeDS, I use simples Services Classes for connect the Flex interface and the backoffice. But how I can to recup the login of the current user without the Object HTTPRequest ?

    I understand how I can to securize my service, but if by example the service give the user messages, how I can know witch user is without HttpRequest ?

  • tim_lee

    Congrats… you are doing a great job. Could you please respond to the following query?

    Our flex client needs to invoke server side spring bean. For each module we have seperate spring service bean.

    Whether it is best to have separate flex end point (remote object) to each spring bean to invoke methods or to create a single facade spring bean as an endpoint and invoke other spring bean methods through this facade bean.

    Whether creating multiple flex end points increases the performance or its an expensive process?

    Thanks in advance.

  • Ого! Большое спасибо! Теперь на целый день есть работа! :)

  • Я никогда не сомневался в Вашем интеллектуальном уровне, но поймите, не все такие как Вы. :)

  • Hi Chris,

    I am new to flex so am confused the interaction of flex with spring.Can you please let me know how do we send request from flex to spring layer and how do we handle exception.

    Thanks
    Pawan

  • Jim

    Lovely, everything works like a charm. Helped my a lot when starting with Flex integration on an existing Spring application. Thank you!

    Regards,

    Jim.

  • Daniel

    Could I use this integration in test-drive-m2 without ROOT tomcat container ? My app not estabilish a conection with the service remote, I don’t know why, but tomcat start very well .. Somebody help me?

  • Barani Kumar V

    Hi Christophe Coenraets,
    I am Barani Kumar .
    I am using flex_test_drive ,all example programe is working fine
    I am created one more class (Department , DepartmentDAO,IDepartmentDAO) and I have added service in config/web_application…xml
    Its not accepting destination , when try run application its throws exception like destination id not found

    Tell me how to use tomcat and service

  • I’m impressed, I must say. Rarely do I find a blog that’s both educative and entertaining, and let me tell you, you have hit the nail on the head. Your thoughts are outstanding.

  • Great article, very well thought out and put together keep up the good work.

  • Salini

    Is there any way to remove put the Remoteobject endpoint attribute some where else other than hardcoding the same in flezx application

  • Hidayath

    Hi Christophe, wonderful sample!!!

    We have problem with tomcat 7 and BlazeDS 4

    Could you please make it for Tomcat 7? Thanks a lot

  • Pingback: What is generated in MyEclipse 8.6 Spring Flex Scaffolding? | Genuitec()

css.php