spring社交版1.0.3:为什么我';ve字段或属性';名称';在空错误上找不到
我使用SpringSocial1.0.3在我的登录页面上添加“使用Facebook登录”和“使用Twitter登录”。这里是我的登录查看页面: 登录视图:spring社交版1.0.3:为什么我';ve字段或属性';名称';在空错误上找不到,spring,spring-mvc,spring-social,Spring,Spring Mvc,Spring Social,我使用SpringSocial1.0.3在我的登录页面上添加“使用Facebook登录”和“使用Twitter登录”。这里是我的登录查看页面: 登录视图: <form action="<c:url value="/connect/twitter" />" method="POST"> <p><button type="submit"><img src="<c:url value="/resources/images/social/
<form action="<c:url value="/connect/twitter" />" method="POST">
<p><button type="submit"><img src="<c:url value="/resources/images/social/twitter/sign-in-with-twitter-d.png" />"/>
</button></p>
</form>
<form action="<c:url value="/connect/facebook" />" method="POST">
<p><button type="submit"><img src="<c:url value="/resources/images/social/facebook/sign-in-with-facebook.png" />"/>
</button></p>
</form>
url应用程序http://localhost:8080/myapp
已在facebook应用程序中授权
当我点击“使用Twitter登录”或“使用Facebook登录”时,我会被重定向到Twitter或Facebook以提交我的登录名和密码
1.Twitter当我提交凭据时,另一个页面要求我允许该应用程序
我允许应用程序,然后出现以下错误:
DEBUG [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver] [] http-bio-8080-exec-10 Resolving exception from handler [public java.lang.String org.springframework.social.connect.web.ConnectController.connectionStatus(java.lang.String,org.springframework.web.context.request.NativeWebRequest,org.springframework.ui.Model)]: org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Field or property 'name' cannot be found on null
DEBUG [org.springframework.web.servlet.DispatcherServlet] [] http-bio-8080-exec-10 Could not complete request
org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Field or property 'name' cannot be found on null
The complete error is here http://pastebin.com/hyRicyFu
2.Facebook当我提交凭据时,我会出现以下错误:
org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Field or property 'name' cannot be found on null
DEBUG [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver] [] http-bio-8080-exec-2 Resolving exception from handler [public java.lang.String org.springframework.social.connect.web.ConnectController.connectionStatus(java.lang.String,org.springframework.web.context.request.NativeWebRequest,org.springframework.ui.Model)]: org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Field or property 'name' cannot be found on null
DEBUG [org.springframework.web.servlet.DispatcherServlet] [] http-bio-8080-exec-2 Could not complete request
org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Field or property 'name' cannot be found on null
完全的错误就在这里
问题:
据我所知,这个错误来自
<bean id="connectionRepository" factory-method="createConnectionRepository"
factory-bean="usersConnectionRepository" scope="request">
<constructor-arg value="#{request.userPrincipal.name}" />
<aop:scoped-proxy proxy-target-class="false" />
</bean>
错误消息:在null上找不到字段或属性“name”
我需要一些确认:
当用户提交时,我必须在数据库中创建用户吗?我必须扩展哪个控制器?如果有人举个例子,这会有所帮助
b-如果我错了,发生了什么,为什么我会出错?是的,你是对的-问题在于配置
<bean id="connectionRepository" factory-method="createConnectionRepository"
factory-bean="usersConnectionRepository" scope="request">
<constructor-arg value="#{request.userPrincipal.name}" />
<aop:scoped-proxy proxy-target-class="false" />
</bean>
您将看到,对于社交注册,有一种完全不同的方法(相对于与社交第三方集成的登录用户)
<bean id="connectionRepository" factory-method="createConnectionRepository"
factory-bean="usersConnectionRepository" scope="request">
<constructor-arg value="#{request.userPrincipal.name}" />
<aop:scoped-proxy proxy-target-class="false" />
</bean>
<bean id="connectionRepository" factory-method="createConnectionRepository"
factory-bean="usersConnectionRepository" scope="request">
<constructor-arg value="#{request.userPrincipal.name}" />
<aop:scoped-proxy proxy-target-class="false" />
</bean>