Announcement Announcement Module
Collapse
No announcement yet.
Null Pointer Exception creating _MessageBroker Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Null Pointer Exception creating _MessageBroker

    Hi, im trying to integrate Spring 3 with Spring-Flex 1.5, but i keep getting the following error:

    Code:
    <25/10/2012 12:11:59 PM CDT> <Error> <HTTP> <BEA-101216> <Servlet: "blaze" failed to preload on startup in Web application: "/scpi".
    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.NullPointerException
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
    	Truncated. see log file for complete stacktrace
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBroker': Invocation of init method failed; nested exception is java.lang.NullPointerException
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    	Truncated. see log file for complete stacktrace
    java.lang.NullPointerException
    	at flex.messaging.MessageBroker.stop(MessageBroker.java:355)
    	at org.springframework.flex.core.MessageBrokerFactoryBean.destroy(MessageBrokerFactoryBean.java:218)
    	at org.springframework.flex.core.MessageBrokerFactoryBean.afterPropertiesSet(MessageBrokerFactoryBean.java:206)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
    	Truncated. see log file for complete stacktrace
    This are the files im using, i'm not very experienced with neither Flex or Spring, so any advice is greatly appreciated!

    web.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    		  http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
             version="2.5">
        <display-name>SCPI</display-name>
    
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
                /WEB-INF/applicationContext.xml
                /WEB-INF/blaze-servlet.xml
            </param-value>
        </context-param>
    
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
        <listener>
            <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
        </listener>
    
        <!-- filters -->
        <filter>
            <filter-name>sitemesh</filter-name>
            <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
        </filter>
        <!-- filter mappings -->
        <filter-mapping>
            <filter-name>sitemesh</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    
        <servlet>
            <servlet-name>spring-mvc</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
    
        <servlet>
            <servlet-name>blaze</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
    
        <servlet-mapping>
            <servlet-name>blaze</servlet-name>
            <url-pattern>/messageBroker/*</url-pattern>
        </servlet-mapping>
    
        <servlet-mapping>
            <servlet-name>spring-mvc</servlet-name>
            <url-pattern>*.do</url-pattern>
        </servlet-mapping>
    
        <filter>
            <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
            <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
        </filter>
    
        <filter-mapping>
            <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    
        <welcome-file-list>
            <welcome-file>/home/init.do</welcome-file>
        </welcome-file-list>
    
        <login-config>
            <auth-method>CLIENT-CERT</auth-method>
            <realm-name>NoSuchRealm</realm-name>
        </login-config>
    
    
    
    </web-app>
    blaze-servlet.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:flex="http://www.springframework.org/schema/flex"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:mvc="http://www.springframework.org/schema/mvc"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans.xsd
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context-3.1.xsd
           http://www.springframework.org/schema/mvc
           http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
           http://www.springframework.org/schema/flex
    		http://www.springframework.org/schema/flex/spring-flex-1.5.xsd">
    
        <context:annotation-config/>
        <context:component-scan base-package="com.test.scpif"/>
        <mvc:annotation-driven/>
        <flex:message-broker>
            <flex:message-service default-channels="my-amf" />
        </flex:message-broker>
    </beans>
    services-config.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <services-config>
        <channels>
            <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
                <endpoint url="http://{server.name}:{server.port}/{context.root}/messageBroker/amf"
                			class="flex.messaging.endpoints.AMFEndpoint"/>
                <properties>
    				<polling-enabled>true</polling-enabled>
    			</properties>
            </channel-definition>
        </channels>
    </services-config>

  • #2
    Other files

    Also here is my applicationContext.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:jpa="http://www.springframework.org/schema/data/jpa"
           xmlns:p="http://www.springframework.org/schema/p"
           xmlns:tx="http://www.springframework.org/schema/tx"
           xmlns:aop="http://www.springframework.org/schema/aop"
           xmlns:jee="http://www.springframework.org/schema/jee"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
                               http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                               http://www.springframework.org/schema/context
                               http://www.springframework.org/schema/context/spring-context-3.1.xsd
                               http://www.springframework.org/schema/data/jpa
                               http://www.springframework.org/schema/data/jpa/spring-jpa-1.0.xsd
                               http://www.springframework.org/schema/tx
                               http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
                               http://www.springframework.org/schema/aop
                               http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
                               http://www.springframework.org/schema/jee
                               http://www.springframework.org/schema/jee/spring-jee-3.1.xsd">
        <context:annotation-config/>
        <context:component-scan base-package="com.test.scpif"/>
    
        <aop:aspectj-autoproxy/>
    
        <tx:annotation-driven transaction-manager="transactionManager"/>
    
        <jpa:repositories base-package="com.test.scpif.dao" entity-manager-factory-ref="entityManagerFactory"/>
    
        <jee:jndi-lookup id="jndiDataSource" jndi-name="jdbc/scpiDS"/>
    
        <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
              p:dataSource-ref="jndiDataSource"
              p:persistenceUnitName="SCPIF_PU">
            <property name="persistenceXmlLocation" value="classpath:META-INF/scpif-persistence.xml"/>
            <property name="jpaPropertyMap">
                <map>
                    <entry key="hibernate.transaction.manager_lookup_class"
                          value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
                    <entry key="hibernate.current_session_context_class"
                          value="jta"/>
                </map>
            </property>
            <property name="jpaVendorAdapter">
                <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
                      p:databasePlatform="org.hibernate.dialect.Oracle10gDialect" p:database="ORACLE" p:showSql="true"/>
            </property>
        </bean>
    
        <bean id="transactionManager" class="org.springframework.transaction.jta.WebLogicJtaTransactionManager">
            <property name="transactionManagerName" value="javax.transaction.TransactionManager"/>
        </bean>
    
        <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
            <property name="javaMailProperties">
                <props>
                    <prop key="mail.transport.protocol">smtp</prop>
                    <prop key="mail.smtp.host">mailhost.test.com</prop>
                    <prop key="mail.debug">true</prop>
                </props>
            </property>
        </bean>
    
        <bean id="multipartResolver"
              class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
            <!-- one of the properties available; the maximum file size in bytes -->
            <property name="maxUploadSize" value="100000000"/>
        </bean>
    
        <bean id="messageSource"
              class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
            <property name="basename" value="classpath:messages"/>
            <property name="fallbackToSystemLocale" value="false"/>
            <property name="defaultEncoding" value="UTF-8"/>
        </bean>
    
    </beans>
    and pom.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:mvc="http://www.springframework.org/schema/mvc"
           xmlns:context="http://www.springframework.org/schema/context"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
                               http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                               http://www.springframework.org/schema/mvc
                               http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
                               http://www.springframework.org/schema/context
                               http://www.springframework.org/schema/context/spring-context-3.1.xsd">
    
        <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
            <property name="prefix" value="/WEB-INF/jsp/"/>
            <property name="suffix" value=".jsp"/>
        </bean>
    
        <!--  <bean class="com.test.scpif.web.controller.admin.MessageDistributionListController"> </bean>
     <bean class="com.test.scpif.web.controller.catalog.RoleController"> </bean> -->
    
        <context:component-scan base-package="com.test.scpif.web"/>
    
        <mvc:interceptors>
            <bean class="org.springframework.web.servlet.mvc.WebContentInterceptor">
                <property name="cacheSeconds" value="0"/>
                <property name="useExpiresHeader" value="true"/>
                <property name="useCacheControlHeader" value="true"/>
                <property name="useCacheControlNoStore" value="true"/>
            </bean>
        </mvc:interceptors>
    
        <bean id="messageSource"
              class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
            <property name="basename" value="classpath:messages" />
            <property name="defaultEncoding" value="UTF-8"/>
        </bean>
    
         <mvc:annotation-driven validator="validator">
            <mvc:argument-resolvers>
                <bean class="com.test.scpif.web.support.DataTablesPageableArgumentResolver"/>
            </mvc:argument-resolvers>
        </mvc:annotation-driven>
    
        <bean id="validator"
              class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
            <property name="validationMessageSource" ref="messageSource"/>
        </bean>
    
    </beans>

    Comment

    Working...
    X