Results 1 to 2 of 2

Thread: NullPointerException in custom LoginCommand configuration

  1. #1
    Join Date
    Jul 2011
    Posts
    2

    Default NullPointerException in custom LoginCommand configuration

    Hi, I am trying to configure custom LoginCommand. I get the following error
    Code:
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityLoginCommand' defined in ServletContext resource [/WEB-INF/flex-servlet.xml]: Post-processing failed of bean type [class org.springframework.flex.samples.secured.OurSpringSecurityLoginCommand] failed; nested exception is java.lang.NullPointerException
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:803)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:493)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
    	... 76 more
    Caused by: java.lang.NullPointerException
    	at org.springframework.flex.security3.SecurityConfigurationPostProcessor.postProcessMergedBeanDefinition(SecurityConfigurationPostProcessor.java:86)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:798)
    	... 83 more
    Please help me resolve this issue. It appears only when i extends SpringSecurityLoginCommand.

    My flex configuration file:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:flex="http://www.springframework.org/schema/flex"
    	xmlns:mvc="http://www.springframework.org/schema/mvc"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:aop="http://www.springframework.org/schema/aop"
    	xsi:schemaLocation="
    	http://www.springframework.org/schema/aop
                               http://www.springframework.org/schema/aop/spring-aop.xsd
    		http://www.springframework.org/schema/beans
    		http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    		http://www.springframework.org/schema/context 
    		http://www.springframework.org/schema/context/spring-context-3.0.xsd
    		http://www.springframework.org/schema/flex 
    		http://www.springframework.org/schema/flex/spring-flex-1.5.xsd
    		http://www.springframework.org/schema/mvc 
    		http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
    
     	<mvc:annotation-driven/>
     	
     	<mvc:default-servlet-handler/>
     
     	<!-- Flex-specific Configuration -->
    	<flex:message-broker mapping-order="1">
    		<flex:mapping pattern="/messagebroker/*"/>
    		<flex:message-service
    			default-channels="my-amf" />
    		<flex:secured login-command="springSecurityLoginCommand" />
    	</flex:message-broker>
    
        <bean class="org.springframework.flex.samples.secured.OurSpringSecurityLoginCommand" id="springSecurityLoginCommand">
            <constructor-arg ref="authenticationManager"/>
        </bean>
        <!--<bean class="org.springframework.flex.samples.secured.OurLoginCommand" id="ourLoginCommand">
            <constructor-arg ref="authenticationManager"/>
        </bean>-->
    	
    	<!-- Expose the productService bean for BlazeDS remoting -->
    	<flex:remoting-destination ref="securedService" />
    
    </beans>
    And LoginCommand source code:
    Code:
    package org.springframework.flex.samples.secured;
    
    import org.springframework.flex.security3.SpringSecurityLoginCommand;
    import org.springframework.security.authentication.AuthenticationManager;
    
    public class OurSpringSecurityLoginCommand extends SpringSecurityLoginCommand{
        /**
         * Creates a new SpringSecurityLoginCommand with the provided {@link org.springframework.security.authentication.AuthenticationManager}
         *
         * @param authManager the authentication manager
         */
        public OurSpringSecurityLoginCommand(AuthenticationManager authManager) {
            super(authManager);
        }
    }

  2. #2
    Join Date
    Aug 2011
    Posts
    1

    Default

    You can copy all the code from org.springframework.flex.security3.SpringSecurityL oginCommand, then add your own logic.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •