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

  • Configuration when using multiple mappings

    Greetings,
    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.

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


    <servlet>
    <servlet-name>foo</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
    <servlet-name>foo</servlet-name>
    <url-pattern>/messagebroker/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
    <servlet-name>foo</servlet-name>
    <url-pattern>/someOtherApp/*</url-pattern>
    </servlet-mapping>


    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>
    <bean class="org.springframework.web.servlet.mvc.annotat ion.AnnotationMethodHandlerAdapter"/>
    ...
    <flex:message-broker
    services-config-path="/WEB-INF/blazeds-services-config.xml"
    mapping-order="1">
    <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"/>
    </flex:message-broker>


    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 3.2.0.3978, 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.

    Comment

    Working...
    X