Connecting a Flex 4 application to a Java / Spring back-end couldn’t be easier in Flash Builder 4’s new Data Wizards. I’ve recorded a screencast that shows how to set up the web application project, configure Spring & BlazeDS, and then build a Flex 4 application that connects to the Java / Spring back-end. Check it out and let me know what you think.
(Open full-size video in a new window)
Flash Builder 4 Data Wizards with Java / Spring
This entry was posted in BlazeDS, Flex, Java, Spring. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.


21 Comments
I’m not a big Eclipse fan, which is why I usually tried to do as less as possible in Flex Builder and as much as I could in IntelliJ. But I must say this is pretty impressive stuff. Plus, it doesn’t seem to generate to much black magic code, except for the proxy service and the RDS servlet, which is very important to keep the readability of the code. I’ve got a few questions though:
- don’t you need to compile your Flex client against services-config.xml like it used to be the case with Flex 3?
- does Flash Builder generate Ant scripts to do all the build in headless mode for continuous integration?
- did you use Spring BlazeDS integration library at all in this example?
- how did Flash Builder find on which host and port it could find the RDS servlet to do the introspection?
Oh one last question: could you please publish the projects from the video so that we can try this at home?
Very useful, thanks a lot! Can’t wait to see the second part!
Hi Sébastien,
Thanks for asking these great questions! :)
- don’t you need to compile your Flex client against services-config.xml like it used to be the case with Flex 3?
No because I configured the ChannelSet manually. However by specifying J2EE (uck…) as the server type it automatically adds this. However I could remove it and everything would still functional normally.
- does Flash Builder generate Ant scripts to do all the build in headless mode for continuous integration?
In Flash Builder 4 there is a way to launch a build from an Ant script. It essentially starts a headless instance of FB and does the build. If you give it a try let me know how it works for you.
- did you use Spring BlazeDS integration library at all in this example?
Yes. I had the jar in my libs that I copied over. It has to be a recent nightly build in order to work like I show in the screencast.
- how did Flash Builder find on which host and port it could find the RDS servlet to do the introspection?
In the project creation wizard I specified those parameters.
- could you please publish the projects from the video so that we can try this at home?
I’ll give that a try and post here when I get it posted.
-James
Hey James,
Sorry if this comes across harshly – I just see the evangelists as folks to whom it’s fair to ask this kind of question – but how is any of this an improvement over Flex 3?
What benefit does the wizard you used actually provide? It generated services.FooService, but it looks like nothing but a wrapper around a RemoteObject. If it created wrappers for the actual services methods, I could see some benefit, but why not just skip the wizard and use ?
As far as the MXML goes, is the Flex 4 S.O.P. really going to be to declare ChannelSets inline? I mean, we’d all just do it once in a Swiz/Mate/etc. configuration file anyhow, but I can’t see this being a good thing to show a RIA newbie or, worse yet, someone architecturally minded. I can’t look at an example that hard-codes a URL into the view tier without wincing. If we’re going to have a pile of tooling in Flash Builder 4, maybe something to easily externalize this stuff would be appropriate?
The only thing I see that I don’t already have with Flex 3 and Spring integration is the Data / Services tab, but I can get the same thing by just drilling open the class to look at its methods.
James,
I tried this out, getting exception trying to startup the server. Any clue as to what can cause this:
Jan 13, 2010 9:40:01 AM com.springsource.tcserver.security.PropertyDecoder
INFO: tcServer property decoder has been initialized.
Jan 13, 2010 9:40:02 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ’source’ to ‘org.eclipse.jst.jee.server:springFlex-server’ did not find a matching property.
Jan 13, 2010 9:40:02 AM com.springsource.tcserver.serviceability.rmi.JmxSocketListener init
INFO: Started up JMX registry on 127.0.0.1:6969
Jan 13, 2010 9:40:02 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jan 13, 2010 9:40:02 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 872 ms
Jan 13, 2010 9:40:02 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jan 13, 2010 9:40:02 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: SpringSource tc Server/6.0.20.C
Jan 13, 2010 9:40:04 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet ‘dispatcherServlet’
Jan 13, 2010 9:40:04 AM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet ‘dispatcherServlet’: initialization started
Jan 13, 2010 9:40:04 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace ‘dispatcherServlet-servlet’: startup date [Wed Jan 13 09:40:04 EST 2010]; root of context hierarchy
Jan 13, 2010 9:40:04 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/dispatcherServlet-servlet.xml]
Jan 13, 2010 9:40:06 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1396ef7: defining beans [_messageBrokerHandlerAdapter,_messageBrokerDefaultHandlerMapping,_jsonConfigMapEditorConfigurer,_messageBrokerMessagingProcessor,_flexRemotingAnnotationPostProcessor,_messageBrokerRemotingProcessor,org.springframework.flex.core.ExceptionTranslationAdvice#0,org.springframework.flex.core.EndpointServiceMessagePointcutAdvisor#0,org.springframework.flex.core.MessageInterceptionAdvice#0,org.springframework.flex.core.EndpointServiceMessagePointcutAdvisor#1,_messageBrokerEndpointProcessor,_messageBroker,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,fooService,org.springframework.flex.remoting.RemotingDestinationExporter#0]; root of factory hierarchy
Jan 13, 2010 9:40:07 AM org.springframework.flex.config.FlexConfigurationManager$ResourceResolverAdapter getConfigurationFile
INFO: Loading Flex services configuration from: ServletContext resource [/WEB-INF/flex/services-config.xml]
Jan 13, 2010 9:40:07 AM org.springframework.flex.config.FlexConfigurationManager$ResourceResolverAdapter getIncludedFile
INFO: Including Flex services configuration from: ServletContext resource [/WEB-INF/flex/remoting-config.xml]
[BlazeDS]The class loader could not locate the string resource property file ‘flex/messaging/errors_en_US.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/data/errors_en_US.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/messaging/errors_en.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/data/errors_en.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/data/errors.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/messaging/errors_en_US.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/data/errors_en_US.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/messaging/errors_en.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/data/errors_en.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/data/errors.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/messaging/errors_en_US.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/data/errors_en_US.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/messaging/errors_en.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/data/errors_en.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/data/errors.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/messaging/errors_en_US.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/data/errors_en_US.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/messaging/errors_en.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/data/errors_en.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
[BlazeDS]The class loader could not locate the string resource property file ‘flex/data/errors.properties’. This may not be an issue if a property file is available for a less specific locale or the default locale.
Jan 13, 2010 9:40:07 AM org.springframework.flex.core.MessageBrokerFactoryBean afterPropertiesSet
INFO: BlazeDS – Community Edition: 4.0.0.13441
[BlazeDS]No login command was found for ‘SpringSource tc Server/6.0.20.C’. Please ensure that the login-command tag has the correct server attribute value, or use ‘all’ to use the login command regardless of the server.
Jan 13, 2010 9:40:07 AM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1396ef7: defining beans [_messageBrokerHandlerAdapter,_messageBrokerDefaultHandlerMapping,_jsonConfigMapEditorConfigurer,_messageBrokerMessagingProcessor,_flexRemotingAnnotationPostProcessor,_messageBrokerRemotingProcessor,org.springframework.flex.core.ExceptionTranslationAdvice#0,org.springframework.flex.core.EndpointServiceMessagePointcutAdvisor#0,org.springframework.flex.core.MessageInterceptionAdvice#0,org.springframework.flex.core.EndpointServiceMessagePointcutAdvisor#1,_messageBrokerEndpointProcessor,_messageBroker,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,fooService,org.springframework.flex.remoting.RemotingDestinationExporter#0]; root of factory hierarchy
Jan 13, 2010 9:40:07 AM org.springframework.web.servlet.FrameworkServlet initServletBean
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘_messageBrokerDefaultHandlerMapping’: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘_messageBroker’: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanInitializationException: MessageBroker initialization failed; nested exception is flex.messaging.MessageException: Cannot create class of type ”. Type ” not found.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:561)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:443)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:459)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:340)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:307)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:741)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:587)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:290)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘_messageBroker’: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanInitializationException: MessageBroker initialization failed; nested exception is flex.messaging.MessageException: Cannot create class of type ”. Type ” not found.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1401)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.AbstractBeanFactory.isSingleton(AbstractBeanFactory.java:392)
at org.springframework.context.support.AbstractApplicationContext.isSingleton(AbstractApplicationContext.java:1024)
at org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler(AbstractUrlHandlerMapping.java:370)
at org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.registerHandlers(SimpleUrlHandlerMapping.java:129)
at org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.initApplicationContext(SimpleUrlHandlerMapping.java:104)
at org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:119)
at org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:71)
at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:73)
at org.springframework.context.support.ApplicationContextAwareProcessor.doProcess(ApplicationContextAwareProcessor.java:116)
at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:99)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1394)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
… 31 more
Caused by: org.springframework.beans.factory.BeanInitializationException: MessageBroker initialization failed; nested exception is flex.messaging.MessageException: Cannot create class of type ”. Type ” not found.
at org.springframework.flex.core.MessageBrokerFactoryBean.afterPropertiesSet(MessageBrokerFactoryBean.java:185)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398)
… 50 more
Caused by: flex.messaging.MessageException: Cannot create class of type ”. Type ” not found.
at flex.messaging.util.ClassUtil.createClass(ClassUtil.java:70)
at flex.messaging.MessageBroker.createEndpoint(MessageBroker.java:574)
at flex.messaging.config.MessagingConfiguration.createEndpoints(MessagingConfiguration.java:298)
at flex.messaging.config.MessagingConfiguration.configureBroker(MessagingConfiguration.java:113)
at org.springframework.flex.core.MessageBrokerFactoryBean.afterPropertiesSet(MessageBrokerFactoryBean.java:149)
… 52 more
Jan 13, 2010 9:40:07 AM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘_messageBrokerDefaultHandlerMapping’: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘_messageBroker’: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanInitializationException: MessageBroker initialization failed; nested exception is flex.messaging.MessageException: Cannot create class of type ”. Type ” not found.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:561)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:443)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:459)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:340)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:307)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:741)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:587)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:290)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘_messageBroker’: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanInitializationException: MessageBroker initialization failed; nested exception is flex.messaging.MessageException: Cannot create class of type ”. Type ” not found.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1401)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.AbstractBeanFactory.isSingleton(AbstractBeanFactory.java:392)
at org.springframework.context.support.AbstractApplicationContext.isSingleton(AbstractApplicationContext.java:1024)
at org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler(AbstractUrlHandlerMapping.java:370)
at org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.registerHandlers(SimpleUrlHandlerMapping.java:129)
at org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.initApplicationContext(SimpleUrlHandlerMapping.java:104)
at org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:119)
at org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:71)
at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:73)
at org.springframework.context.support.ApplicationContextAwareProcessor.doProcess(ApplicationContextAwareProcessor.java:116)
at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:99)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1394)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
… 31 more
Caused by: org.springframework.beans.factory.BeanInitializationException: MessageBroker initialization failed; nested exception is flex.messaging.MessageException: Cannot create class of type ”. Type ” not found.
at org.springframework.flex.core.MessageBrokerFactoryBean.afterPropertiesSet(MessageBrokerFactoryBean.java:185)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398)
… 50 more
Caused by: flex.messaging.MessageException: Cannot create class of type ”. Type ” not found.
at flex.messaging.util.ClassUtil.createClass(ClassUtil.java:70)
at flex.messaging.MessageBroker.createEndpoint(MessageBroker.java:574)
at flex.messaging.config.MessagingConfiguration.createEndpoints(MessagingConfiguration.java:298)
at flex.messaging.config.MessagingConfiguration.configureBroker(MessagingConfiguration.java:113)
at org.springframework.flex.core.MessageBrokerFactoryBean.afterPropertiesSet(MessageBrokerFactoryBean.java:149)
… 52 more
Jan 13, 2010 9:40:07 AM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /springFlex-server threw load() exception
flex.messaging.MessageException: Cannot create class of type ”. Type ” not found.
at flex.messaging.util.ClassUtil.createClass(ClassUtil.java:70)
at flex.messaging.MessageBroker.createEndpoint(MessageBroker.java:574)
at flex.messaging.config.MessagingConfiguration.createEndpoints(MessagingConfiguration.java:298)
at flex.messaging.config.MessagingConfiguration.configureBroker(MessagingConfiguration.java:113)
at org.springframework.flex.core.MessageBrokerFactoryBean.afterPropertiesSet(MessageBrokerFactoryBean.java:149)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.AbstractBeanFactory.isSingleton(AbstractBeanFactory.java:392)
at org.springframework.context.support.AbstractApplicationContext.isSingleton(AbstractApplicationContext.java:1024)
at org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler(AbstractUrlHandlerMapping.java:370)
at org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.registerHandlers(SimpleUrlHandlerMapping.java:129)
at org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.initApplicationContext(SimpleUrlHandlerMapping.java:104)
at org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:119)
at org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:71)
at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:73)
at org.springframework.context.support.ApplicationContextAwareProcessor.doProcess(ApplicationContextAwareProcessor.java:116)
at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:99)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1394)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:561)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:443)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:459)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:340)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:307)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:741)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:587)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:290)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415)
Jan 13, 2010 9:40:07 AM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /springFlex-server threw load() exception
javax.servlet.ServletException: Unable to find MessageBroker, ensure that if messageBrokerId is set for the MessageBrokerServlet the RDS FrontEndServlet has a matching init-param value
at flex.rds.server.RdsServlet.init(RdsServlet.java:64)
at flex.rds.server.servlet.FrontEndServlet.loadServlet(FrontEndServlet.java:262)
at flex.rds.server.servlet.FrontEndServlet.init(FrontEndServlet.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:741)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:587)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:290)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415)
Jan 13, 2010 9:40:07 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive insight.war
Jan 13, 2010 9:40:07 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jan 13, 2010 9:40:07 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 5498 ms
Hey James,
Nice to see the tooling support working well with Spring! I do have just a few additional tips to help simplify the example even further:
1. There is no need for remoting-config.xml when using Spring BlazeDS. The things being configured there in the case of this example are already set up by the “remoting-service” element in your Spring config.
2. You don’t need to explicitly specify the channels in the @RemotingDestination annotation unless you are using something other than the default channels defined in the “remoting-service” element.
3. You don’t need to explicitly specify the bean id in your @Service annotation. By default, the bean id (and in turn the default name of the remoting destination) will be configured with the class name as the id. Of course, if you make that change, then you need to change the client code to talk to the “foo” destination instead of “fooService”.
- Jeremy
Thanks Jeremy! I will certainly make those changes for part 2!
Hi Toni. I’m not sure what that error means. If you want to email me your project I can take a look at it. jaward at adobe dot com
Hi Joe. Thanks for your honesty. It’s great to get this kind of feedback.
The generated code is just a wrapper around RemoteObject but it did create the client-side stubs for the service methods. And you will see in part 2 that it also generates the value objects.
Declaring the ChannelSet inline has become my regular way of coding demos because when I left it out and let Flex add the channel set automatically based on the services-config.xml file it always seemed to confuse people. They don’t understand how the client knows how to connect to the server. But I always try to mention that both of those ways are *BAD* for production and that options like Swiz are the best way to go.
Allegedly the Data Wizards in FB4 are extensible so Swiz could have a plugin that would generate Swiz knowledgeable service classes. But I’m not sure that the documentation about that has bene published yet.
BTW: It looks like you are a mountain biker. Let me know when you come to Colorado so we can ride together. :)
If possible James can you publish your project so we can go through this type of setup ourselves?
Hi Andrew,
I’ve posted the web app project here:
http://www.jamesward.com/downloads/springFlex-server.zip
-James
james,
I had the same issue that Jeremy described and was resolved by removing remoting-config.xml.
thanks,
- t
hi guys,
I’ve met the same exception above as “Couln’t find _mssageBrokerId”. I just do some experiments.
So I fond that the Eclipse environment must Be JDK 1.6 and tomcat should be version 6.xx. At last make sure that your spring config file is totally right,because most exception comes from spring config will cause
the Unable to find MessageBroker.
I hope this will be useful for men above.
Yet another question: I’m trying to replicate your setup in a Grails environment, where web resources are scattered all around the place. When I try to connect to the Data service, it sees my service but when it tries to generate the service stub, it says the service class is “not available in the specified location”. What is the convention? Where does Flash builder look for the service classes based on which it generates service stubs?
is this RDS servlet some heritage from ColdFusion as the URL seems to show? is it possible to customize it to something more speaking? it seems like the BlazeDS equivalent of WSDL/WADL, is there a public spec for its output?
I found a way to run my Grails application so that Flash Builder finds its way and it’s working great now. Now the only thing that I miss is some basic login/password security in there and I’ll have what I’ve been looking for for months.
Very Very Nice post for beginners,
Can u put link to the video for download so that
we can view it multiple times but save bandwidth.
regards.
@magomarcelo I’m not sure what the history of the RDS Servlet is but I don’t think the URL can currently be changed.
@Raja Try this: http://content.screencast.com/users/jlward4th/folders/Default/media/98f61331-617a-4ac3-87d2-9aeccf317813/springFlex1.mp4?downloadOnly=true
james ,which is the configuration for flex 3 with spring??
Eric,
Check out the Spring Flex Test Drive for the best way to do the configuration.
-James
2 Trackbacks
[...] Flash Builder 4 Data Wizards with Java / Spring [...]
[...] there you go. Special thanks to James Ward, whose screencasts really helped me get it right. Now the only thing that this plugin misses, beyond the 2 known [...]