Announcement Announcement Module
Collapse
No announcement yet.
connectionFactories Map not List Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • connectionFactories Map not List

    Hi,
    I was trying to config my facebook app following this example:
    http://static.springsource.org/sprin...onnecting.html

    This is how I am putting it in my context:
    HTML Code:
    <bean id="connectionFactoryLocator" 
          class="org.springframework.social.connect.support.ConnectionFactoryRegistry">
        <property name="connectionFactories">
                <bean class="org.springframework.social.facebook.connect.FacebookConnectionFactory">
                    <constructor-arg value="xxxx" />
                    <constructor-arg value="xxxx" />				
                </bean>
        </property>
    </bean>
    But I find out that the Class ConnectionFactoryRegistry has the connectionFactories property as a map:
    Code:
    private final Map<String, ConnectionFactory<?>> connectionFactories = new HashMap<String, ConnectionFactory<?>>();
    I am including the versions artifacts in this way:
    HTML Code:
    		<org.springframework.social-version>1.0.0.RELEASE</org.springframework.social-version>
    		<org.springframework-version>3.0.0.RELEASE</org.springframework-version>
    
                      [...]
    
    		<dependency>
    		    <groupId>org.springframework</groupId>
    		    <artifactId>spring-web</artifactId>
    		    <version>${org.springframework-version}</version>
    	    </dependency>
    		
    		
    		<dependency>
    		    <groupId>org.springframework.social</groupId>
    		    <artifactId>spring-social-core</artifactId>
    	        <version>${org.springframework.social-version}</version>
    	    </dependency>
    		
    		<dependency>
    		    <groupId>org.springframework.social</groupId>
    		    <artifactId>spring-social-facebook</artifactId>
    	        <version>${org.springframework.social-version}</version>
    	    </dependency>
    	    
    	    <dependency>
    		    <groupId>org.springframework</groupId>
    		    <artifactId>spring-core</artifactId>
    	        <version>${org.springframework-version}</version>
    	    </dependency>


    This is throwing the following error at runtime:
    Code:
    Error creating bean with name 'connectionFactoryLocator' defined in class path resource [applicationContext-security-facebook.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
    PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'connectionFactories' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.core.GenericTypeResolver.resolveTypeArgument(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Class;
    I am not sure if I should configure the connectionFactories as a map or if I am doing something else wrong.

    Can somebody help me?

    Thanks in advance, Regards.

  • #2
    Originally posted by kadorrna View Post
    HTML Code:
    <bean id="connectionFactoryLocator" 
          class="org.springframework.social.connect.support.ConnectionFactoryRegistry">
        <property name="connectionFactories">
                <bean class="org.springframework.social.facebook.connect.FacebookConnectionFactory">
                    <constructor-arg value="xxxx" />
                    <constructor-arg value="xxxx" />				
                </bean>
        </property>
    </bean>
    I was missing the LIST tag, that's why it was not working. When I put it as a map the error was
    Code:
    2011-11-11 16:30:53.787:WARN::FAILED app: java.lang.RuntimeException: Exception constructing service 'ApplicationContext': Error creating bean with name 'connectionFactoryLocator' defined in class path resource [applicationContext-security-facebook.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.util.LinkedHashMap] to required type [java.util.List] for property 'connectionFactories'
    which makes a lot of sense according to the documentation, but I still don't get why in the Class is a MAP.

    Anyways, when I put it as a List the error is:
    Code:
    ontext initialization failed 
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionFactoryLocator' defined in class path resource [applicationContext-security-facebook.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
    PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'connectionFactories' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.core.GenericTypeResolver.resolveTypeArgument(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Class;

    Can somebody give me a hint?

    Thanks in advance.

    Comment


    • #3
      I have found that the problem was that I had 2 different version of spring for different artifacts.
      I have changed that and now is working fine.

      Comment

      Working...
      X