Hi,
I am running an application in Geronimo 2.1.7 and that requires a valid
scope, but what we see is java.lang.IllegalStateException during application
startup
Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException: unknown scope defined: null
at
org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResol
verImpl.java:71)
at
org.apache.myfaces.el.convert.VariableResolverToELResolver.getValue(Vari
ableResolverToELResolver.java:93)
at
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
---------------
---------------
Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
at
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.access$3
01(FacesCompositeELResolver.java:46)
at
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver$4.invoke
(FacesCompositeELResolver.java:108)
at
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.invoke(F
acesCompositeELResolver.java:148)
at
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue
(FacesCompositeELResolver.java:104)
at
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
I have created a small debug application and tested the scenario to find the
valid scopes.It looks to be the scopes are available for the application and
only thing is some how the scope value getting as null before a call made to
org.apache.myfaces.el.VariableResolverImpl.resolveVariable and it leads the
above exception.
11:25:26,650 XXXX Thread[http-0.0.0.0-8463-1,5,main]: scope after
setScope() is JSP.
..
..
11:25:26,652 XXXX Thread[http-0.0.0.0-8463-1,5,main]: scope after
setScope() is Faces.
....
11:25:26,652 XXXX Thread[http-0.0.0.0-8463-1,5,main]: scope before
unsetScope() is Faces.
...
the following is the code snippet where it sets and unsets the scope values.
try
{
setScope(requestMap);
super.setValue(context, base, property, val);
}
finally
{
unsetScope(requestMap);
}
So to fix the above issue i made changes to the following code snippet in
the FacesCompositeELResolver to put back previous scope value for
application availability
try
{
prevScope = getScope(requestMap);
setScope(requestMap);
super.setValue(context, base, property, val);
}
finally
{
if( prevScope != null){
setScope(requestMap, prevScope);
}else{
unsetScope(requestMap);
}
}
Can any one review the changes made to the following patch for the above
issue and provide your comments.
https://issues.apache.org/jira/browse/MYFACES-3166
Thanks
Mohan R Siripi