Announcement Announcement Module
Collapse
No announcement yet.
M4 Upgrade: "Error creating bean with name '_messageBrokerDefaultHandlerMapping' Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • M4 Upgrade: "Error creating bean with name '_messageBrokerDefaultHandlerMapping'

    Simply upgrading to Spring Framework 3.0.0.M4 causes the following error:

    SEVERE: Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: 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.NullPointerException
    web.xml:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
    
        <display-name>MyApp</display-name>
        <description>MyApp Description</description>
    
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
                /WEB-INF/config/web-application-config.xml
            </param-value>
        </context-param>
        
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
    
        <!-- MessageBroker Servlet -->
        <servlet>
            <servlet-name>flex</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
    
        <servlet-mapping>
            <servlet-name>flex</servlet-name>
            <url-pattern>/messagebroker/*</url-pattern>
         </servlet-mapping>
          
        <welcome-file-list>
            <welcome-file>index.html</welcome-file>
            <welcome-file>index.htm</welcome-file>
        </welcome-file-list>
        
    </web-app>
    web-application-config.xml:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	   xmlns:flex="http://www.springframework.org/schema/flex"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:context="http://www.springframework.org/schema/context"
           xsi:schemaLocation="
    			http://www.springframework.org/schema/beans
    			http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    			http://www.springframework.org/schema/flex 
    			http://www.springframework.org/schema/flex/spring-flex-1.0.xsd
    			http://www.springframework.org/schema/context 
    			http://www.springframework.org/schema/context/spring-context-2.5.xsd">
    
    	<flex:message-broker/>
        
    	<context:component-scan base-package="com.myco.myapp.onsite.upload"/>
    	<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>
    	<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>
    
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    		<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    		<property name="url" value="jdbc:mysql://localhost/myapp"/>
    		<property name="username" value="myUser"/>
    		<property name="password" value="myPass"/>
    	</bean>
    <bean id="photoSetDAO" class="com.lonepalm.liveshot.onsite.photoSet.PhotoSetDAO">
        	<constructor-arg ref="dataSource"/>
        </bean>
        
        <bean id="widgetSetService" class="com.myco.myapp.onsite.widgetSet.WidgetDelegate">
            <constructor-arg ref="widgetSetDAO"/>
        </bean>
    
    	<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/>
    	
    	<bean id="widgetUploadController" class="com.myco.myapp.onsite.upload.WidgetUploadController">
        	<property name="widgetDelegate" ref="photoDelegate"/>
    	</bean>
    
    	<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    		<property name="prefix">
    			<value>/</value>
    		</property>
    		<property name="suffix">
    			<value>.jsp</value>
    		</property>
    	</bean>
    	
    	<flex:remoting-destination ref="widgetSetService"/>
        
    </beans>

  • #2
    I have tried to reproduce this and have been unsuccessful. Plugging Spring 3.0.0.M4 into the testdrive sample works just fine after making some changes to the pom.xml.

    Make sure that your classpath does not have any lingering 2.5.6 jars on it. Using maven, for example, I had to explicitly add the following Spring dependencies in order to override the transitive 2.5.6.SEC01 dependencies that get pulled down because of the pom for spring-flex:
    Code:
    <!-- Overrides for using Spring 3.0 -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <!-- End Overrides -->

    Comment

    Working...
    X