Announcement Announcement Module
Collapse
No announcement yet.
Spring + DWR + Blaze DS, is that too complicated ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring + DWR + Blaze DS, is that too complicated ?

    I am new to Flex but having played with it for the last couple of months, I am very impressed. I like the fact that I need not worry about JS + JSP + CSS, cross browser issues etc.

    In my present set-up, I have a project with Spring + DWR + Hibernate. I am trying to add Flex-Blaze DS. This seems to be harder than I thought. Most of the sample programs talk about a model that has Flex being served by Spring. But what if someone like me wants to add Flex to a JS-Spring RIA application, a la Hybrid application.

    I checked out Christophe Coenraets blog and tried the Spring-Flex-*-M2. It works great. I tried to integrate this into my app.

    1. Copied all new Jars/updated to new version.
    2. Made changes to web.xml

    HTML Code:
    <servlet>
    	    <servlet-name>phoenix</servlet-name>
    	    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    	    <load-on-startup>1</load-on-startup>
    	</servlet>
    
    	<servlet>
    	  <servlet-name>dwr-invoker</servlet-name>
    	  <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
    	  <init-param>
    	     <param-name>debug</param-name>
    	     <param-value>true</param-value>
    	  </init-param>
    	</servlet>
    	
    	<servlet>
    		<servlet-name>spring-flex</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    
    	<servlet-mapping>
    	  <servlet-name>dwr-invoker</servlet-name>
    	  <url-pattern>/dwr/*</url-pattern>
    	</servlet-mapping>
    
    	<servlet-mapping>
    	    <servlet-name>phoenix</servlet-name>
    	    <url-pattern>/web/*</url-pattern>
    	</servlet-mapping>
    	
    	<servlet-mapping>
            <servlet-name>spring-flex</servlet-name>
            <url-pattern>/messagebroker/amf</url-pattern>
        </servlet-mapping>
    	
    	<!--listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener-->
    Note :
    • I have a MVC structure with JSP rendering RIA with the help of DWR. I like to continue that structure by replacing DWR+JS with Flex on a JSP page.
    • I had commented the listener to take care of double loading of the context.
    • I changed URL pattern from /messagebroker/* to /messagebroker/amf because I read that if multiple dispatchers are used, then the wildcard does not work.

    3. Made additions to pho*-servlet.xml for the message broker part.

    HTML Code:
    <!--flex:message-broker services-config-path="/WEB-INF/flex/services-config.xml">
    		<flex:mapping pattern="/messagebroker/amf" />
    	</flex:message-broker-->
    	<bean id="_messageBroker" class="org.springframework.flex.messaging.MessageBrokerFactoryBean" >
    		<property name="servicesConfigPath" value="/WEB-INF/flex/services-config.xml" />
    	</bean>  
    
    <!--flex:remote-service ref="searchServiceHelper" /-->
    <!--flex:remoting-destination ref="searchServiceHelper" /-->
    
    <bean id="searchServiceHelper" class="com.phoenix.web.helper.SearchServiceHelper" >
    		<flex:remote-service />
    	</bean>
    • the <flex:message-broker> tag breaks Tomcat startup. So I am using the equivalent vanilla spring <bean id="_messageBroker" .
    • had to try both flex:remote-service and flex:remoting-destination, one of them did not work because the xsd in the jar was not updated. I added the flex:remote-service tag to the spring bean <bean id="searchServiceHelper".

    4. I copied flex/services-config.xml and flex/remoting-config.xml as is.
    5. The flex code is as follows, I have explicitly added the channelSet.
    HTML Code:
    <mx:AMFChannel id="myAmf" uri="/phoenix/messagebroker/amf" />
    	<mx:ChannelSet id="channelSet" channels="{[myAmf]}" />
    	<mx:RemoteObject id="searchSrcId" 
    		destination="searchServiceHelper" 
    		channelSet="{channelSet}"
    		result="Alert.show(event.result.toString());" 
    		fault="Alert.show(event.fault.faultString);" />
    I seem to not be able to map the request to Blaze DS, It seems simple but at this point, I am missing it : I get the following error.
    no mapping found for HTTP request with URI [/phoenix/messagebroker/amf] in DispatcherServlet with name 'spring-flex'>
    considering my setup, what am I missing ?
    Last edited by srinda; Aug 7th, 2009, 02:54 PM. Reason: changed heading

  • #2
    You're on the right path, but I think you've got a few things confused. First off, I would recommend starting with the newest version of the testdrive that is included with the 1.0.0.RELEASE distribution as a foundation, as the organization of the Spring application context structure was refactored a bit in the final version to reflect what we recommend as best practice. Also, some of the tag names changed slightly since M2. (See this post for getting up and running with it: http://blog.springsource.com/2009/06...ntegration-10/)

    Originally posted by srinda View Post
    I had commented the listener to take care of double loading of the context.
    I would not recommend this for a hybrid application. What you want to do is have one parent context loaded by the ContextLoaderListener that contains the application-wide (i.e., not MVC or Flex specific) beans such as your domain services. Then the separate child context for each DispatcherServlet should contain only the things that are pertinent to that part of the app. Remember, the child DispatcherServlet contexts are aware of any beans loaded by the root context constructed by the ContextLoaderListener, but it is a unidirectional relationship. This is how the current testdrive sample is set up, except that there's only one DispatcherServlet.

    Originally posted by srinda View Post
    I changed URL pattern from /messagebroker/* to /messagebroker/amf because I read that if multiple dispatchers are used, then the wildcard does not work.
    This is should not be necessary.

    Originally posted by srinda View Post
    3. Made additions to pho*-servlet.xml for the message broker part.
    You should have two different files for the separate DispatcherServlet contexts. Your MVC-specific config should be in (if using the naming conventions) phoenix-servlet.xml, and your Flex-specific config should be in spring-flex-servlet.xml.

    If you follow such a setup, you should just be able to use mostly default settings and keep spring-flex-servlet.xml to something like:

    Code:
    <flex:message-broker/>
    
    <flex:remoting-destination ref="searchServiceHelper" />
    assuming "searchServiceHelper" is a bean available in the root context loaded by the ContextLoaderListener.

    Comment


    • #3
      Thank you for your very quick reply, Jeremy.

      I followed your instructions, but unfortunately I am still having problems, but this time when the context is being loaded.

      I am getting the following error.

      HTML Code:
      2009-08-08 14:38:13 StandardContext[/phoenix]Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
      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': Cannot resolve reference to bean '_messageBrokerLoginCommand' while setting bean property 'configProcessors' with key [2]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBrokerLoginCommand': Cannot resolve reference to bean '_authenticationManager' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '_authenticationManager' is defined
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
      	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
      	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
      	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
      	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
      	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
      	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
      	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)
      	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
      	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
      	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
      	at org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:903)
      	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.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216)
      	at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256)
      	at org.apache.commons.digester.Rule.end(Rule.java:276)
      	at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
      	at org.apache.catalina.util.CatalinaDigester.endElement(CatalinaDigester.java:76)
      	at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
      	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
      	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
      	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      	at org.apache.commons.digester.Digester.parse(Digester.java:1567)
      	at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:488)
      	at org.apache.catalina.core.StandardHost.install(StandardHost.java:863)
      	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:483)
      	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
      	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
      	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
      	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
      	at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
      	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
      	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
      	at org.apache.catalina.core.StandardService.start(StandardService.java:480)
      	at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
      	at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
      	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:287)
      	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)

      My setup is very similar to what I had earlier.

      1. web.xml
      HTML Code:
      <context-param>
      		<param-name>contextConfigLocation</param-name>
      		<param-value>
      			/WEB-INF/phoenix-servlet.xml
      			/WEB-INF/dwr.xml
      			/WEB-INF/spring-flex-servlet.xml
      		</param-value>
      	</context-param>
      
      	<context-param>
      		<param-name>log4jConfigLocation</param-name>
      		<param-value>/WEB-INF/log4j.properties</param-value>
      	</context-param>
      	
      	<listener>  
      		<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
      	</listener>
      	
      	<listener>
      		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
      	</listener>
      
      	<servlet>
      	    <servlet-name>phoenix</servlet-name>
      	    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
      	    <load-on-startup>1</load-on-startup>
      	</servlet>
      
      	<servlet>
      	  <servlet-name>dwr-invoker</servlet-name>
      	  <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
      	  <init-param>
      	     <param-name>debug</param-name>
      	     <param-value>true</param-value>
      	  </init-param>
      	</servlet>
      	
      	<servlet>
      		<servlet-name>spring-flex</servlet-name>
      		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
      		<load-on-startup>1</load-on-startup>
      	</servlet>
      
      	<servlet-mapping>
      	  <servlet-name>dwr-invoker</servlet-name>
      	  <url-pattern>/dwr/*</url-pattern>
      	</servlet-mapping>
      
      	<servlet-mapping>
      	    <servlet-name>phoenix</servlet-name>
      	    <url-pattern>/web/*</url-pattern>
      	</servlet-mapping>
      	
      	<servlet-mapping>
              <servlet-name>spring-flex</servlet-name>
              <url-pattern>/messagebroker/*</url-pattern>
          </servlet-mapping>
      2. spring-flex-servlet.xml
      HTML Code:
      <flex:message-broker>
      		<flex:message-service
      			default-channels="my-amf" />
      		<flex:secured />
      	</flex:message-broker>
      	<!-- Expose the searchServiceHelper bean for BlazeDS remoting -->
      	<flex:remoting-destination ref="searchServiceHelper" />
      if I remove the configuration in the spring-flex-servlet.xml, the app seems to be working gr8.


      I am not very confident of the jars I have included, I think I might have mucked up in the jars...

      HTML Code:
      acegi-security-1.0.7.jar
      asm-all-3.1.jar
      aspectjrt.jar
      backport-util-concurrent.jar
      cfgatewayadapter.jar
      com.springsource.org.codehaus.jackson-1.0.0.jar
      commons-codec-1.3.jar
      commons-fileupload-1.2.1.jar
      commons-httpclient-3.0.1.jar
      commons-io-1.4.jar
      commons-logging.jar
      concurrent.jar
      dwr.jar
      ehcache-1.2.4.jar
      flex-messaging-common.jar
      flex-messaging-core.jar
      flex-messaging-opt.jar
      flex-messaging-proxy.jar
      flex-messaging-remoting.jar
      h2.jar
      jstl-1.1.2.jar
      log4j-1.2.11.jar
      lucene-core-2.4.1.jar
      org.springframework.aop-2.5.6.SEC01.jar
      org.springframework.context-2.5.6.SEC01.jar
      org.springframework.core-2.5.6.SEC01.jar
      org.springframework.flex-1.0.0.RELEASE.jar
      org.springframework.integration-1.0.2.RELEASE.jar
      org.springframework.jdbc-2.5.6.SEC01.jar
      org.springframework.jms-2.5.6.SEC01.jar
      org.springframework.transaction-2.5.6.SEC01.jar
      org.springframework.web-2.5.6.SEC01.jar
      org.springframework.web.servlet-2.5.6.SEC01.jar
      org.springframework.xml-1.5.2.A.jar
      spring-2.5.6.jar
      spring-security-acl-2.0.4.jar
      spring-security-catalina-2.0.4.jar
      spring-security-core-2.0.4.jar
      spring-security-core-tiger-2.0.4.jar
      spring-security-taglibs-2.0.4.jar
      standard-1.1.2.jar
      xalan.jar
      any help would be great....thank you.
      Last edited by srinda; Aug 8th, 2009, 08:58 PM.

      Comment


      • #4
        At this point, I do not have auth to worry about....once I removed <flex:secured />, the above problem went away..

        I added <load-on-startup>2</load-on-startup> to the child DispatcherServlet's but I still get the following exception

        HTML Code:
        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 java.lang.RuntimeException: MessageBroker already defined from MessageBrokerServlet with init parameter messageBrokerId = '_messageBroker'
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        	at java.security.AccessController.doPrivileged(Native Method)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
        	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
        	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
        	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
        	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
        	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
        	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
        	at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:402)
        	at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:316)
        	at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:282)
        	at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
        	at javax.servlet.GenericServlet.init(GenericServlet.java:211)
        	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029)
        	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862)
        	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013)
        	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357)
        	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
        	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
        	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
        	at org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:903)
        	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.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216)
        	at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256)
        	at org.apache.commons.digester.Rule.end(Rule.java:276)
        	at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
        	at org.apache.catalina.util.CatalinaDigester.endElement(CatalinaDigester.java:76)
        	at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
        	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
        	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        	at org.apache.commons.digester.Digester.parse(Digester.java:1567)
        	at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:488)
        	at org.apache.catalina.core.StandardHost.install(StandardHost.java:863)
        	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:483)
        	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
        	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
        	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
        	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
        	at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
        	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
        	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
        	at org.apache.catalina.core.StandardService.start(StandardService.java:480)
        	at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
        	at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
        	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:287)
        	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
        Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBroker': Invocation of init method failed; nested exception is java.lang.RuntimeException: MessageBroker already defined from MessageBrokerServlet with init parameter messageBrokerId = '_messageBroker'
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        	at java.security.AccessController.doPrivileged(Native Method)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
        	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
        	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
        	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
        	at org.springframework.beans.factory.support.AbstractBeanFactory.isSingleton(AbstractBeanFactory.java:366)
        	at org.springframework.context.support.AbstractApplicationContext.isSingleton(AbstractApplicationContext.java:896)
        	at org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler(AbstractUrlHandlerMapping.java:296)
        	at org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.registerHandlers(SimpleUrlHandlerMapping.java:129)
        	at org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.initApplicationContext(SimpleUrlHandlerMapping.java:103)
        	at org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:119)
        	at org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:69)
        	at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:73)
        	at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:70)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:350)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1331)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
        
        the thing of interest that I found is http://blog.dotkam.com/2008/07/09/sp...xt-visibility/, could PropertyPlaceholderConfigurer be an issue?

        or am I not seeing the obvious ?

        Comment


        • #5
          Are you getting that last error even after a clean re-start of your server? There is a bug in 1.0 where if the app deploy fails once everything wasn't getting cleaned up properly resulting in the "MessageBroker already defined" error message on re-deploy. (This is fixed in trunk and will be in the upcoming 1.0.1)

          If you're getting that message even on a completely clean startup, then you've probably got multiple application contexts loading the message broker.

          Comment


          • #6
            Found it, the issue is because the context gets loaded twice...thank you...it was very easy once you confirmed it was getting loaded twice.

            Comment

            Working...
            X