Announcement Announcement Module
Collapse
No announcement yet.
Spring Social in a portlet Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Social in a portlet

    Hi,
    I'm trying to add facebook signin button into a portlet. I did some progress, but I'm stucked now with a "Mode mappings conflict between method and type level: [{providerId}] versus [/connect/]" IllegalStateException:
    Code:
    2011-03-15 11:55:26,978 ERROR [org.springframework.web.portlet.DispatcherPortlet] - <Context initialization failed>
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.portlet.mvc.annotation.DefaultAnnotationHandlerMapping#0' defined in PortletContext resource [/WEB-INF/context/Facebook-context.xml]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: Mode mappings conflict between method and type level: [{providerId}] versus [/connect/]
    	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: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.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
    ...
    Caused by: java.lang.IllegalStateException: Mode mappings conflict between method and type level: [{providerId}] versus [/connect/]
    	at org.springframework.web.portlet.mvc.annotation.DefaultAnnotationHandlerMapping$1.doWith(DefaultAnnotationHandlerMapping.java:196)
    	at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:452)
    	... 40 more
    I think problem is with @RequestMapping("VIEW") in controllers for portlet, so how can I add org.springframework.social.web.connect.ConnectCont roller?

    Facebook-context.xml:
    Code:
    <bean id="facebookController" class="cz.mis.controller.FacebookController">
    		<property name="user" ref="user"/>
    	</bean>
    	
    	<bean class="org.springframework.social.web.connect.ConnectController">
    		<constructor-arg value="${application.url}" />
    	</bean>
    	
    	<bean class="org.springframework.web.portlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>
    	
    	<bean id="portletModeHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">
    		<property name="portletModeMap">
    			<map>
    			</map>
    		</property>
    	</bean>
    Thanks in advance

  • #2
    Ah, adding another Dispatcher Servlet may help 8-)

    Comment


    • #3
      Originally posted by shmoula View Post
      Ah, adding another Dispatcher Servlet may help 8-)
      Not sure but i think you are right.

      Comment


      • #4
        ok, what about some more info? what it does, what it doesn't, how are you adding it...I don't have crystal ball :-)

        Comment


        • #5
          Mode mappings conflict between method and type level

          Hi!
          I have same problem!
          My Controller:
          Code:
          @RequestMapping(params="command=uploadFile",method = RequestMethod.GET)
              public String redirect() {
                 return "redirect:newfile.html";
              }
          
           @RequestMapping(value = "/newfile",method = {RequestMethod.GET, RequestMethod.POST})
              public @ModelAttribute("libraryFile") LibraryFile getForm(){
                  LibraryFile libraryFile = new LibraryFile();
                  return libraryFile;
              }
          This is a link to form:
          HTML Code:
          <a href="
          <portlet:renderURL>
              <portlet:param name="command" value="uploadFile"/>
          </portlet:renderURL>
          ">Upload</a>
          And this is a form:
          HTML Code:
          <form:form modelAttribute="libraryFile" action="uploadFile" method="post">
              <form:hidden path="${libraryFile.id}"/>
                 <form:label path="${libraryFile.name}">Filename: </form:label>
                 <form:input path="${libraryFile.name}"/>
                 <form:label path="${libraryFile.title}">Title: </form:label>
                 <form:input path="${libraryFile.title}"/>
                 <form:label path="${libraryFile.description}">Description:</form:label>
                 <form:textarea path="${libraryFile.description}"/>
                 <c:forEach items="${libraryFile.categories}" var="cat">
                     <form:select path="${libraryFile.categories}">
                         <form:hidden path="${cat.id}"/>
                         <form:option value="${cat.name}"/>
                     </form:select>
                 </c:forEach>
                 <c:forEach items="${libraryFile.fileAttributes}" var="attrs" varStatus="vs">
                     <form:hidden path="${attrs.id}"/>
                     <form:label path="${attrs.attribute.attributeName}">
                         <c:out value="${attrs.attribute.attributeName}"/>
                     </form:label>
                     <form:input path="${attrs.attribute.attributeValues}"/>
                 </c:forEach>
          </form:form>
          the problem is:
          Code:
          Error 500: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.portlet.mvc.annotation.DefaultAnnotationHandlerMapping#0' defined in PortletContext resource [/WEB-INF/DocLibPortlet-portlet.xml]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: Mode mappings conflict between method and type level: [/newfile.html] versus [VIEW]

          Comment


          • #6
            The @RequestMapping in your controller (as well as the request mapping in Spring Social's ConnectController) are given paths of a URL to match. In your case, the path is "/newfile". But for portlets, the request mapping is not path-based...it is portlet mode-based. So, it should be something like @RequestMapping("VIEW") or @RequestMapping("EDIT").

            I recommend that you read http://static.springsource.org/sprin...requestmapping to get a better understanding of how to handle request mappings in portlet controllers.

            Comment

            Working...
            X