Announcement Announcement Module
No announcement yet.
Configuration when using multiple mappings Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Configuration when using multiple mappings

    I'm trying to upgrade to RC2 ( from M2 ) and a configuration that once worked now seems broken. Wondered if anyone had seen this as well or if there was something I was overlooking.

    My web.xml describes several servlet-mappings for a single DispatcherServlet:

    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>



    My webapp context then uses both an AnnotationHandler to catch requests to someOtherApp ( @RequestMapping( "/someOtherApp" ) and flex:mapping ( pattern="/messagebroker/*" ):

    <bean class="org.springframework.web.servlet.mvc.annotat ion.DefaultAnnotationHandlerMapping">
    <property name="order" value="0" />
    <bean class="org.springframework.web.servlet.mvc.annotat ion.AnnotationMethodHandlerAdapter"/>
    <flex:mapping pattern="/messagebroker/*"/>
    <flex:remoting-service default-adapter-id="java-object" default-channels="my-amf"/>
    <flex:message-service default-adapter-id="actionscript" default-channels="my-streaming-amf"/>

    I explicitly add the DefaultAnnotationHandlerMapping even though I'm doing a component-scan because as I understand it, specifying any non-default mapping ( i.e. flex:mapping ) invalidates all defaults, so I need to add it and "order" appropriately, correct?

    After this, I go on to add a few remoting-destinations, etc...

    I'm using spring version 2.5.6.SEC01, blaze, and spring-flex 1.0.0.RC2.

    This config used to work with M2, using the older bean based instantiations, so I'm wondering if I was just doing something wrong back then and getting away with it, or if things have simply changed and I need to change as well... for instance, the old config used "alwaysUseFullPath" as part of it's SimpleUrlHandlerMapping, which doesn't seem to be available now, according to the xsd.

    Error Message:

    Error creating bean with name '_messageBrokerDefaultHandlerMapping': Initialization of bean failed; nested exception is
    org.springframework.beans.factory.BeanCreationExce ption: 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'

    This error occurs even if I browse to /someOtherApp, so I'm leaning toward it being something in the mapping stuff as opposed to other possible configuration problems.

  • #2
    Based on the error you're getting, I would suspect you are somehow loading multiple application contexts (perhaps you've got a ContextLoaderListener?), and both are trying to include the .xml file that contains your flex setup.