2013-08-27 79 views
2

视图时尝试使用的Webflow,我不断收到以下错误:NPE试图渲染春天的Webflow

{ 
    "failure":"true", 
    "exception.message":"org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing [email protected]5beb in state 'accountCannotLogInView' of flow 'login' -- action execution attributes were 'map[[empty]]'", 
    "exception.stacktrace":"org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing [email protected]5beb in state 'accountCannotLogInView' of flow 'login' -- action execution attributes were 'map[[empty]]' 
    ... 
    Caused by: java.lang.IllegalStateException: Exception occurred rendering view null 
     at org.springframework.webflow.mvc.view.AbstractMvcView.render(AbstractMvcView.java:191) 
     at org.springframework.webflow.action.ViewFactoryActionAdapter.doExecute(ViewFactoryActionAdapter.java:40) 
     at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188) 
     at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51) 
     ... 66 more 
    Caused by: java.lang.NullPointerException 
     at org.springframework.webflow.mvc.servlet.ServletMvcView.doRender(ServletMvcView.java:50) 
     at org.springframework.webflow.mvc.view.AbstractMvcView.render(AbstractMvcView.java:187) 
     ... 69 more 
    " 
} 

没有任何人有任何想法,这样做的原因可能是什么? 从我的login-webflow.xml:

<action-state id="checkAccountType"> 
    <evaluate expression="lookupAccountTypeAction.lookup(flowScope.principal)" /> 
    <transition on="EMAIL" to="accountCannotLogInView" /> 
    <transition on="Login" to="checkAccountStatus" /> 
    <transition on="CONTACT" to="accountCannotLogInView" /> 
</action-state> 

<end-state id="accountCannotLogInView" view="myAccountCannotLogInView"/> 

从default_views.properties:

myAccountCannotLogInView.(class)=org.springframework.web.servlet.view.JstlView 
myAccountCannotLogInView.url=/WEB-INF/view/jsp/default/ui/myAccountCannotLogInView.jsp 

从我的日志文件:

2013-09-09 08:29:25,645 DEBUG [org.springframework.webflow.engine.EndState] - Entering state 'accountCannotLogInView' of flow 'login' 
2013-09-09 08:29:25,645 DEBUG [org.springframework.webflow.execution.ActionExecutor] - Executing [email protected]136a 
2013-09-09 08:29:25,645 DEBUG [org.springframework.webflow.mvc.view.AbstractMvcView] - Rendering MVC [null] with model map [{flowRequestContext=[[email protected] externalContext = [email protected]74, currentEvent = EMAIL, requestScope = map['ticketGrantingTicketId' -> 'TGT-1-GxALVR7PEtbagbnRlStOTbHoRHlb61YVm1m2hvWx3pgWCEXgPb-cas01.example.org'], attributes = map[[empty]], messageContext = [[email protected] sourceMessages = map[[null] -> list[[empty]]]], flowExecution = [[email protected] flow = 'login', flowSessions = list[[[email protected] flow = 'login', state = 'accountCannotLogInView', scope = map['principal' -> sso_test_user, 'userInfoBean' -> [email protected][username=<null>,firstName=<null>,lastName=<null>,emailAddress=<null>,streetAddress=<null>,city=<null>,state=<null>,zip=<null>,country=<null>], 'changePasswordBean' -> com.mycompany.authentication.ChangePasswordBean(username=null, newPassword=null, confirmNewPassword=null), 'service' -> https://my.server.com:443/casauth/facade/norenew?idp=https://my.server.com/idp/externalAuthnCallback, 'credentials' -> [username: sso_test_user], 'warnCookieValue' -> false, 'ticketGrantingTicketId' -> 'TGT-1-GxALVR7PEtbagbnRlStOTbHoRHlb61YVm1m2hvWx3pgWCEXgPb-cas01.example.org']]]]], flashScope=map[[empty]], principal=sso_test_user, currentUser=null, [email protected][username=<null>,firstName=<null>,lastName=<null>,emailAddress=<null>,streetAddress=<null>,city=<null>,state=<null>,zip=<null>,country=<null>], changePasswordBean=com.mycompany.authentication.ChangePasswordBean(username=null, newPassword=null, confirmNewPassword=null), service=https://my.server.com:443/casauth/facade/norenew?idp=https://my.server.com/idp/externalAuthnCallback, credentials=[username: sso_test_user], flowExecutionKey=e1s1, warnCookieValue=false, flowExecutionUrl=/authentication/login?username=%5BLjava.lang.String%3B%405b65afa5&submit=%5BLjava.lang.String%3B%4070eea883&_eventId=%5BLjava.lang.String%3B%4044796a61&service=%5BLjava.lang.String%3B%407f372965&lt=%5BLjava.lang.String%3B%407e7ee722&password=%5BLjava.lang.String%3B%403d78aa0f&execution=%5BLjava.lang.String%3B%403ce4de50, ticketGrantingTicketId=TGT-1-GxALVR7PEtbagbnRlStOTbHoRHlb61YVm1m2hvWx3pgWCEXgPb-cas01.example.org}] 
2013-09-09 08:29:25,645 DEBUG [org.springframework.webflow.engine.impl.FlowExecutionImpl] - Attempting to handle [org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing [email protected]136a in state 'accountCannotLogInView' of flow 'login' -- action execution attributes were 'map[[empty]]'] with root cause [java.lang.NullPointerException] 
2013-09-09 08:29:25,645 DEBUG [org.springframework.webflow.engine.impl.FlowExecutionImpl] - Rethrowing unhandled flow execution exception 

是的,该文件确实存在该位置。我一直在这里喋喋不休几天,所以如果有人有任何见解,我会非常感激。

+0

我不明白你应该如何获得属性值到你的flow.xml,但你有没有尝试过使用硬编码路径?或者你有没有尝试在你的状态下添加'.url'? –

+0

我不知道 - CAS处理。我对CAS和Spring Webflow都很陌生,现在也不会特别激动。 :-)你的意思是有一种方法可以将URL直接放入标签中? –

+0

它适用于我的应用程序 –

回答

2

和正确的答案是 “用户错误”。我正在通过maven构建CAS。我创建了配置文件来保存日志记录,然后错误地配置它以使default_views.properties文件不在配置文件中。因此,当CAS在Maven构建中覆盖它时,它包含了基线default_views.properties而不是我的副本。

1

好像你的属性没有被解析到你的flow.xml中。

定义你的硬编码视图应该工作。

在这里看到:Specifying view identifiers

+0

不幸的是,它没有。我仍然得到NPE。 :-( –

+0

因为你把我推向了正确的方向,我会把赏金奖给你,我只需要等22个小时就可以做到。 –

+0

非常感谢你! –

0

此问题的原因是:未找到JSP视图。

在CAS-servlet.xml中,提到其具有定制JSP视图的“视图解析器”豆如下内的基名属性文件:

<bean id="viewResolver" 
    class="org.springframework.web.servlet.view.ResourceBundleViewResolver" 
    p:order="0"> 
    <property name="basenames"> 
     <util:list> 
      <value>${cas.viewResolver.basename}</value> 
      <value>custom_view</value> 
      <value>protocol_views</value> 
     </util:list> 
    </property> 
</bean> 

而在custom_view.properties,提及以下:

casRegisterView.(class)=org.springframework.web.servlet.view.JstlView 
casRegisterView.url=/WEB-INF/view/jsp/default/ui/casRegisterView.jsp 

这里的JSP视图是“casRegisterView.jsp”。 将custom_view.properties放置在/ src/main/resources中。