[cas-dev] NullPointerException in externalRedirect endstate

Scott Battaglia scott_battaglia at rutgers.edu
Fri Jun 23 09:09:55 EDT 2006


Good catch.  I've committed the fix.  It should be available in CVS and 
will make it into the RC3 (or Final) of 3.0.5

Thanks
-Scott

Renaud Bruyeron wrote:
> I think I found the reason why I don't get more info from the logs:
>
> http://developer.ja-sig.org/source/viewrep/jasig/cas3/core/src/main/java/org/jasig/cas/web/flow/GenerateServiceTicketAction.java?r=1.4
>
> It does this:
>
> try {
>    // find TGT from registry
> } catch(TicketException e){
>     if(gateway)
>         return gateway();
> }
>
> It does not log the ticketexception - I think the scenario that triggers 
> the problem below is that my TGT is not in the registry for some reason 
> (CAS restart maybe?). This triggers the gateway transition in my case. 
> However the code above is missing this in the finally clause:
> ContextUtils.addAttribute(context, WebConstants.SERVICE, service);
>
> Indeed, if I gateway, the webflow skips the warnAction, and the 
> warnAction is where the service is stored in the requestScope. So the 
> scenario is this:
> 1) CAS restart after I got a TGT
> 2) start a CAS roundtrip with gateway=true
> 3) GenerateServiceTicketAction fails silently, and returns the gateway 
> resolution
> 4) the webflow skips warnAction
> 5) requestScope.service is null -> NPE
>
> I will create an issue in JIRA with a patch.
>
>   - Renaud
>
> Scott Battaglia wrote:
>   
>> Renaud,
>>
>> Can you consistently reproduce it?  If so, what are the Urls?  Your 
>> assessment that requestScope.service should not be null seems correct.
>>
>> -Scott
>>
>> Renaud Bruyeron wrote:
>>     
>>> Hi,
>>>
>>> I am running into a problem with the "gateway" mode of CAS 3.0.5.
>>> The client webapp always triggers a "gateway" roundtrip with CAS if it 
>>> knows that its identity info is stale (for example when the HttpSession 
>>> is created) so it can get the new identity.
>>>
>>> However, it triggers a NPE in some conditions. Below is an extract of 
>>> the logs (in DEBUG) which shows the execution of the webflow, and the 
>>> stacktrace when the externalRedirect endstate is reached:
>>>
>>> 2006-06-21 18:46:52,559 DEBUG 
>>> [org.jasig.cas.web.flow.AutomaticCookiePathSetterAction] - <Action 
>>> 'AutomaticCookiePathSetterAction' beginning execution>
>>> 2006-06-21 18:46:52,559 DEBUG 
>>> [org.jasig.cas.web.flow.AutomaticCookiePathSetterAction] - <Action 
>>> 'AutomaticCookiePathSetterAction' completed execution; result is 'success'>
>>> 2006-06-21 18:46:52,559 DEBUG 
>>> [org.jasig.cas.web.flow.TicketGrantingTicketExistsAction] - <Action 
>>> 'TicketGrantingTicketExistsAction' beginning execution>
>>> 2006-06-21 18:46:52,560 DEBUG 
>>> [org.jasig.cas.web.flow.TicketGrantingTicketExistsAction] - <Action 
>>> 'TicketGrantingTicketExistsAction' completed execution; result is 
>>> 'ticketGrantingTicketExists'>
>>> 2006-06-21 18:46:52,560 DEBUG 
>>> [org.jasig.cas.web.flow.HasServiceCheckAction] - <Action 
>>> 'HasServiceCheckAction' beginning execution>
>>> 2006-06-21 18:46:52,560 DEBUG 
>>> [org.jasig.cas.web.flow.HasServiceCheckAction] - <Action 
>>> 'HasServiceCheckAction' completed execution; result is 'hasService'>
>>> 2006-06-21 18:46:52,561 DEBUG 
>>> [org.jasig.cas.web.flow.RenewRequestCheckAction] - <Action 
>>> 'RenewRequestCheckAction' beginning execution>
>>> 2006-06-21 18:46:52,561 DEBUG 
>>> [org.jasig.cas.web.flow.RenewRequestCheckAction] - <Action 
>>> 'RenewRequestCheckAction' completed execution; result is 
>>> 'generateServiceTicket'>
>>> 2006-06-21 18:46:52,561 DEBUG 
>>> [org.jasig.cas.web.flow.GenerateServiceTicketAction] - <Action 
>>> 'GenerateServiceTicketAction' beginning execution>
>>> 2006-06-21 18:46:52,562 DEBUG 
>>> [org.jasig.cas.ticket.registry.DefaultTicketRegistry] - <Attempting to 
>>> retrieve ticket [TGT-3-0Vw02NvOVnLcK2DHQ4qElTfw641BV1nasgK-50]>
>>> 2006-06-21 18:46:52,562 DEBUG 
>>> [org.jasig.cas.web.flow.GenerateServiceTicketAction] - <Action 
>>> 'GenerateServiceTicketAction' completed execution; result is 'gateway'>
>>> 2006-06-21 18:46:52,563 ERROR 
>>> [org.apache.catalina.core.ContainerBase.[Catalina].[xxxxx.f6.fr].[/cas].[cas]] 
>>> - <Servlet.service() for servlet cas threw exception>
>>> java.lang.NullPointerException: target is null for method indexOf
>>>          at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:821)
>>>          at ognl.ASTMethod.getValueBody(ASTMethod.java:75)
>>>          at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
>>>          at ognl.SimpleNode.getValue(SimpleNode.java:210)
>>>          at ognl.ASTChain.getValueBody(ASTChain.java:109)
>>>          at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
>>>          at ognl.SimpleNode.getValue(SimpleNode.java:210)
>>>          at ognl.ASTNotEq.getValueBody(ASTNotEq.java:49)
>>>          at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
>>>          at ognl.SimpleNode.getValue(SimpleNode.java:210)
>>>          at ognl.ASTTest.getValueBody(ASTTest.java:49)
>>>          at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
>>>          at ognl.SimpleNode.getValue(SimpleNode.java:210)
>>>          at ognl.Ognl.getValue(Ognl.java:333)
>>>          at ognl.Ognl.getValue(Ognl.java:310)
>>>          at 
>>> org.springframework.binding.expression.support.OgnlExpression.evaluateAgainst(OgnlExpression.java:60)
>>>          at 
>>> org.springframework.binding.expression.support.CompositeStringExpression.evaluateAgainst(CompositeStringExpression.java:33)
>>>          at 
>>> org.springframework.webflow.support.ExternalRedirectSelector.makeSelection(ExternalRedirectSelector.java:73)
>>>          at org.springframework.webflow.EndState.doEnter(EndState.java:127)
>>>          at org.springframework.webflow.State.enter(State.java:192)
>>>          at 
>>> org.springframework.webflow.Transition.execute(Transition.java:216)
>>>          at 
>>> org.springframework.webflow.TransitionableState.onEvent(TransitionableState.java:80)
>>>
>>> My guess is that ${requestScope.service} is null, even though it should 
>>> not be since hasServiceCheckAction returned "hasService".
>>> Before I go digging inside webflow and CAS, do you have any idea on what 
>>> could be the problem?
>>>
>>>   - Renaud
>>>
>>> _______________________________________________
>>> cas-dev mailing list
>>> cas-dev at tp.its.yale.edu
>>> http://tp.its.yale.edu/mailman/listinfo/cas-dev
>>>   
>>>       
>
> _______________________________________________
> cas-dev mailing list
> cas-dev at tp.its.yale.edu
> http://tp.its.yale.edu/mailman/listinfo/cas-dev
>   



More information about the cas-dev mailing list