Skip to main content

Dealing Gracefully with ViewExpiredException in JSF2

Posted by edburns on September 3, 2009 at 7:55 PM PDT

My previous entry dove under the covers for JSF 2.0 and examined href="http://weblogs.java.net/blog/edburns/archive/2009/09/02/jsf2-composite-component-metadata">composite
component metadata. This one is far less esoteric and shows how to
handle the ViewExpiredException using a new JSF feature,
the ExceptionHandler, contributed by href="http://blog.hibernate.org/Bloggers/Pete">Pete Muir a JSF
Expert Group representative from JBoss.

JSF throws a ViewExpiredException when a postback is
made to a view and, for whatever reason, that view cannot be restored.
Usually this is due to a session timeout, but a custom state management
solution could also cause this exception to be thrown. The default
behavior in JSF2 is to show the Facelets error page saying View
Expired. The default page is illustrated at right.

The default ViewExpiredException error page

One way to fix this is to declare an <error-page>
element in your web.xml, as shown here.

  1.     >
  2.         >javax.faces.application.ViewExpiredException>
  3.         >/faces/viewExpired.xhtml>
  4.     >
  5.  

This works well enough. You can even put JSF components on the error
page if you put the proper Faces Servlet mapping in the
<location> element, as shown above. If you want to
do some application level manipulation in response to the exception,
you'll want something different, however. In this case, a custom
ExceptionHandler is just the trick. I cover this in much
more detial in my upcoming book, href="http://bit.ly/edburnsjsf2">JavaServer Faces 2.0: The Complete
Reference, and the example shown in this blog entry is neatly
integrated into the chapter 10 sample app. Consider this blog entry an
appetizer. So delete that old web.xml (it's not needed if you have JSF2
and Servlet 3, which you get in Glassfish V3) and let's go.

First, we need to install a custom ExceptionHandler.
This is done using the tried and true JSF decorator pattern. In this
case, we place the following into the faces-config.xml.
There's no annotation for this because it's relatively uncommon, and we
expect advanced users to use the feature. Therefore, the EG tradeoff
was to not add yet another "scan for this annotation" clause to the
spec.

  1.   >
  2.       >com.sun.faces.ViewExpiredExceptionExceptionHandlerFactory>
  3.   >
  4.  

Here's the code for the class.

  1. package com.sun.faces;
  2.  
  3. import javax.faces.context.ExceptionHandler;
  4. import javax.faces.context.ExceptionHandlerFactory;
  5.  
  6. public class ViewExpiredExceptionExceptionHandlerFactory extends ExceptionHandlerFactory {
  7.  
  8.     private ExceptionHandlerFactory parent;
  9.  
  10.     public ViewExpiredExceptionExceptionHandlerFactory(ExceptionHandlerFactory parent) {
  11.         this.parent = parent;
  12.     }
  13.  
  14.     @Override
  15.     public ExceptionHandler getExceptionHandler() {
  16.         ExceptionHandler result = parent.getExceptionHandler();
  17.         result = new ViewExpiredExceptionExceptionHandler(result);
  18.  
  19.         return result;
  20.     }
  21.  
  22.  
  23. }

The interesting things happen on lines 15 - 20. This method is
called once per request must return a new ExceptionHandler
instance each time it's called. I know the method name should be
createExceptionHandler, but we stuck with
"get" for consistence with other JSF methods. On line 17, we call the
real ExceptionHandlerFactory and ask it to create the
instance, which we then wrap in our custom
ViewExpiredExceptionExceptionHandlerFactory class. This is
where the real interesting stuff happens.

  1. package com.sun.faces;
  2.  
  3. import java.util.Iterator;
  4. import java.util.Map;
  5. import javax.faces.FacesException;
  6. import javax.faces.application.NavigationHandler;
  7. import javax.faces.application.ViewExpiredException;
  8. import javax.faces.component.UIViewRoot;
  9. import javax.faces.context.ExceptionHandler;
  10. import javax.faces.context.ExceptionHandlerWrapper;
  11. import javax.faces.context.FacesContext;
  12. import javax.faces.event.ExceptionQueuedEvent;
  13. import javax.faces.event.ExceptionQueuedEventContext;
  14.  
  15. public class ViewExpiredExceptionExceptionHandler extends ExceptionHandlerWrapper {
  16.  
  17.     private ExceptionHandler wrapped;
  18.  
  19.     public ViewExpiredExceptionExceptionHandler(ExceptionHandler wrapped) {
  20.         this.wrapped = wrapped;
  21.     }
  22.  
  23.     @Override
  24.     public ExceptionHandler getWrapped() {
  25.         return this.wrapped;
  26.     }
  27.  
  28.     @Override
  29.     public void handle() throws FacesException {
  30.         for (Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator(); i.hasNext();) {
  31.             ExceptionQueuedEvent event = i.next();
  32.             ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();
  33.             Throwable t = context.getException();
  34.             if (t instanceof ViewExpiredException) {
  35.                 ViewExpiredException vee = (ViewExpiredException) t;
  36.                 FacesContext fc = FacesContext.getCurrentInstance();
  37.                 Map<String, Object> requestMap = fc.getExternalContext().getRequestMap();
  38.                 NavigationHandler nav =
  39.                         fc.getApplication().getNavigationHandler();
  40.                 try {
  41.                     // Push some useful stuff to the request scope for
  42.                     // use in the page
  43.                     requestMap.put("currentViewId", vee.getViewId());
  44.  
  45.                     nav.handleNavigation(fc, null, "viewExpired");
  46.                     fc.renderResponse();
  47.  
  48.                 } finally {
  49.                     i.remove();
  50.                 }
  51.             }
  52.         }
  53.         // At this point, the queue will not contain any ViewExpiredEvents.
  54.         // Therefore, let the parent handle them.
  55.         getWrapped().handle();
  56.  
  57.     }
  58. }
  59.  
  60.    
  61.  

On line 15, you see we take advantage of the
javax.faces.context.ExceptionHandlerWrapper convenience
class. JSF has lots of these wrapper classes and when you use them, you
need only override the getWrapped() method to return the
instance of the class you're wrapping, which is often simply passed to
the constructor, as shown on lines 19 - 21. Once you override
getWrapped(), you need only override those methods you're
interested in. In this case, we want to override only
handle(), which we do on lines 29 - 57.

We iterate over the unhandler exceptions using the iterator returned
from getUnhandledExceptionQueuedEvents().iterator(), as
shown on line 30. The ExeceptionQueuedEvent is a
SystemEvent (also described in detail in href="http://bit.ly/edburnsjsf2">my book) from which we can get the
actual ViewExpiredException, which I do on line 35. I know
I'm going to be ultimately showing a JSF page so I want to extract some
information from the exception and place it in request scope, so I can
access it via EL in the page. I do this on line 37.

On lines 45 and 46, I leverage the JSF implicit navigation system and
cause the server to navigate to the "viewExpired" page. This assumes,
of course, that there is a viewExpired.xhtml page out
there. Naturally, you could parameterize this howevere you like,
context-param, annotation, whatever. Line 46 causes the intervening
lifecycle phases to be skipped.

Note that we have a try-finally block here, and in the finally block,
on line 49, we call remove() on the iterator. This is an
important part of the ExceptionHandler usage contract. If
you handle an exception, you have to remove it from the list of
unhandled exceptions. That way, we know it's safe to call
getWrapped().handle() on line 55.

Finally, let's see my cheesy viewExpired.xhtml page in
action, shown at left.

The customized ViewExpiredException error page

This page is not much more visually appealing than the default one,
but that's not JSF's fault! The one in the JSF2 book will look nicer.
Here's the source for this cheesy one.

  1. <html xmlns="http://www.w3.org/1999/xhtml"
  2.      xmlns:h="http://java.sun.com/jsf/html"
  3.      xmlns:f="http://java.sun.com/jsf/core">
  4.   <title>Nice View Expired Page</title>
  5. </h:head>
  6.  
  7.     <p>To protect your security, we have taken the liberty of logging you
  8.     out. Those who sacrifice liberty for security deserve to have
  9.     their views expired.</p>
  10.  
  11.     <p>You were on page #{currentViewId}.  Maybe that's useful.</p>
  12.  
  13.   </h:form>
  14. </h:body>
  15. </html>
  16.    
  17.  

Note that we show the data from the exception on line 15.

This entry showed you how to programmatically intercept the
ViewExpiredException and do something nice with it. If you
have any other state that you can show in the page, it's easy to include
it in the Facelets view.

Technorati Tags:

Comments

I have successfully and Gracefully dealt with ...

I have successfully and Gracefully dealt with ViewExpiredException in JSF2.

Good solution.

getUnhandledExceptionQueuedEvents return an empty collection ...

getUnhandledExceptionQueuedEvents return an empty collection in case of ajax requests. How should I proceed?

<p>Hi Ed</p> <p>Im having an unexpected problem with the ...

Hi Ed

Im having an unexpected problem with the ExceptionHandlerWrapper.

Before the ExceptionHandlerWrapper handle the exception, the error is printed on the console. I do not want the exception apears inside the console. Something is intercepting and loggin it before entering the ExceptionHandlerWrapper

I cannot find anyreference on this "issue".

Any ideas ?

Excluding this "problem", the ExceptionHandlerWrapper works perfectly.

Thanks

<p>Nice article Ed.</p> <p>However, I find this part of the ...

Nice article Ed.
However, I find this part of the JSF API ugly. No offense to its designers but how would anyone know that you're going to need a constructor that accepts ExceptionHandlerFactory instance as an argument? They could have made an abstract method to set that instance variable. No one knows until somebody like you posts something like this or read the source code.
Hope to hear from you soon.

<p>Hi!<br /> I'm attempting to adapt this example in my ...

Hi!
I'm attempting to adapt this example in my application but encounter this error in the call: nav.handleNavigation(fc, null, "viewExpired");

java.lang.NullPointerException
at org.apache.myfaces.application.NavigationHandlerImpl.getNavigationCase(NavigationHandlerImpl.java:203)
at org.apache.myfaces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:77)
Line 203: String viewId = facesContext.getViewRoot().getViewId();
getViewRoot() returns null for some reason. Any ideas as to how I can fix this problem?
Appreciate any help. :)
UPDATE: Of course I found a workaround as soon as I posted the question. I perform the following before calling the navigate-method.

if ( fc.getViewRoot() == null )
{
UIViewRoot view = fc.getApplication().getViewHandler().createView( fc, vee.getViewId() );
fc.setViewRoot( view );
}

Perhaps you can explain what happened to the view root. ;)

Dealing Gracefully with

I've played around a bit with the version that is deployed with Mojarra 2.0.4. Unfortunately it doesn't seem to work properly when you are changing locales programmatically. The handler is triggered on:
FacesContext.getCurrentInstance().getViewRoot().setLocale(currentLocale);
A sample could be found at www.coreservlets.com/JSF-Tutorial/jsf2/#Events

Wrappety-wrap

Hi, What is the recommended way of handling wrapped exceptions in JSF 2? I tried throwing an intentional NPE from an EJB and it ended up wrapped in EvaluationException/EJBTransactionRolledbackException/etc. Tried using the getRootCause() but even that didn't get me the NPE I threw. -Nik

Don't wrap back

But seriously, this can be a tricky problem.  I recently discovered and fixed a case where an exception was thrown and swallowed, obscuring the true problem.

It's possible my recent checkin may make your problem go away.

Please try a nightly build within the last week. 

If you can't do that, please try to post a stacktrace here and we'll see what can be done.

Thanks,

Ed

Your nightlies of the 2.0.3

Your nightlies of the 2.0.3 were out of date since a month(?) and I couldn't build it from source (refused to get the servlet-3.0-SNAPSHOT jar even if I manually put it in my local repo) so I updated JBoss AS 6 M4 to the nightly 2.1, hope the fix is there, too. Anyway, I still get the wrapping in my ExceptionHandler, here is the stack trace:

2010-07-30 12:04:36,863 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http-localhost%2F127.0.0.1-8080-2) javax.ejb.EJBTransactionRolledbackException: NUK: javax.faces.el.EvaluationException: javax.ejb.EJBTransactionRolledbackException: NUK at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:98) [:2.1.0-SNAPSHOT] at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98) [:2.1.0-SNAPSHOT] at javax.faces.component.UICommand.broadcast(UICommand.java:311) [:2.1.0-SNAPSHOT] at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:785) [:2.1.0-SNAPSHOT] at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1250) [:2.1.0-SNAPSHOT] at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77) [:2.1.0-SNAPSHOT] at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97) [:2.1.0-SNAPSHOT] at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114) [:2.1.0-SNAPSHOT] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:334) [:2.1.0-SNAPSHOT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.20100721-M4] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.20100721-M4] at org.jboss.resteasy.plugins.server.servlet.FilterDispatcher.doFilter(FilterDispatcher.java:63) [:6.0.0.20100721-M4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.0.0.20100721-M4] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.20100721-M4] at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:68) [:1.0.1.SP4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.0.0.20100721-M4] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.20100721-M4] at com.acme.greetings.logging.MDCFilter.doFilter(MDCFilter.java:31) [:] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.0.0.20100721-M4] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.20100721-M4] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.0.0.20100721-M4] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [:6.0.0.20100721-M4] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.0.0.20100721-M4] at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.CR3] at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.CR3] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.20100721-M4] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:93) [:6.0.0.20100721-M4] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:6.0.0.20100721-M4] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.0.0.20100721-M4] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.20100721-M4] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.0.0.20100721-M4] at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.20100721-M4] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.0.0.20100721-M4] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.0.0.20100721-M4] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [:6.0.0.20100721-M4] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.0.0.20100721-M4] at java.lang.Thread.run(Unknown Source) [:1.6.0_20] Caused by: javax.ejb.EJBTransactionRolledbackException: NUK at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:148) [:0.0.1] at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:227) [:0.0.1] at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.required(CMTTxInterceptor.java:353) [:0.0.1] at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invoke(CMTTxInterceptor.java:209) [:0.0.1] at org.jboss.ejb3.tx2.aop.CMTTxInterceptorWrapper.invoke(CMTTxInterceptorWrapper.java:52) [:0.0.1] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) [:1.0.0.GA] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) [:1.0.3] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67) [:1.0.1] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:227) [:1.5.0-alpha-4] at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:142) [:1.5.0-alpha-4] at org.jboss.ejb3.nointerface.impl.invocationhandler.NoInterfaceViewInvocationHandler.invoke(NoInterfaceViewInvocationHandler.java:148) [:1.0.0-alpha-6] at org.jboss.ejb3.proxy.javassist.JavassistInvocationHandlerAdapter.invoke(JavassistInvocationHandlerAdapter.java:71) [:1.0.0-alpha-1] at com.acme.greetings.GreetingServer_$$_javassist_35.addGreeting(GreetingServer_$$_javassist_35.java) [:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_20] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_20] at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:304) [:1.0.1.SP4] at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54) [:1.0.1.SP4] at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163) [:1.0.1.SP4] at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:298) [:1.0.1.SP4] at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:127) [:1.0.1.SP4] at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43) [:1.0.1.SP4] at com.acme.greetings.GreetingServer_$$_javassist_22.addGreeting(GreetingServer_$$_javassist_22.java) [:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_20] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_20] at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:304) [:1.0.1.SP4] at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54) [:1.0.1.SP4] at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163) [:1.0.1.SP4] at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:298) [:1.0.1.SP4] at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:113) [:1.0.1.SP4] at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43) [:1.0.1.SP4] at com.acme.greetings.GreetingServer_$$_javassist_31.addGreeting(GreetingServer_$$_javassist_31.java) [:] at com.acme.greetings.GreetingClient.addGreeting(GreetingClient.java:45) [:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_20] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_20] at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:72) [:1.0.7] at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor$InvocationContext.proceed(InvocationContextInterceptor.java:138) [:1.0.7] at org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:143) [:6.0.0.20100721-M4] at org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor.doAroundInvoke(Jsr299BindingsInterceptor.java:116) [:6.0.0.20100721-M4] at sun.reflect.GeneratedMethodAccessor298.invoke(Unknown Source) [:1.6.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_20] at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:83) [:1.0.7] at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:70) [:1.0.7] at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:62) [:1.0.7] at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor$InvocationContext.proceed(InvocationContextInterceptor.java:138) [:1.0.7] at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:47) [:1.0.1.SP4] at sun.reflect.GeneratedMethodAccessor297.invoke(Unknown Source) [:1.6.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_20] at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:83) [:1.0.7] at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:70) [:1.0.7] at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:62) [:1.0.7] at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:76) [:1.0.7] at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:62) [:1.0.7] at sun.reflect.GeneratedMethodAccessor296.invoke(Unknown Source) [:1.6.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_20] at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72) [:1.0.7] at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_1050798512.invoke(InvocationContextInterceptor_z_fillMethod_1050798512.java) [:] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88) [:1.0.7] at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_1050798512.invoke(InvocationContextInterceptor_z_setup_1050798512.java) [:] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.async.impl.interceptor.FutureSerializingInterceptor.invoke(FutureSerializingInterceptor.java:88) [:1.0.0-alpha-5] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:60) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) [:1.0.3] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.core.context.SessionInvocationContextAdapter.proceed(SessionInvocationContextAdapter.java:90) [:1.5.0-alpha-4] at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:247) [:0.0.1] at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.required(CMTTxInterceptor.java:349) [:0.0.1] at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invoke(CMTTxInterceptor.java:209) [:0.0.1] at org.jboss.ejb3.tx2.aop.CMTTxInterceptorWrapper.invoke(CMTTxInterceptorWrapper.java:52) [:0.0.1] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) [:1.0.0.GA] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) [:1.0.3] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67) [:1.0.1] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:227) [:1.5.0-alpha-4] at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:142) [:1.5.0-alpha-4] at org.jboss.ejb3.nointerface.impl.invocationhandler.NoInterfaceViewInvocationHandler.invoke(NoInterfaceViewInvocationHandler.java:148) [:1.0.0-alpha-6] at org.jboss.ejb3.proxy.javassist.JavassistInvocationHandlerAdapter.invoke(JavassistInvocationHandlerAdapter.java:71) [:1.0.0-alpha-1] at com.acme.greetings.GreetingClient_$$_javassist_36.addGreeting(GreetingClient_$$_javassist_36.java) [:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_20] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_20] at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:304) [:1.0.1.SP4] at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54) [:1.0.1.SP4] at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163) [:1.0.1.SP4] at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:298) [:1.0.1.SP4] at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:127) [:1.0.1.SP4] at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43) [:1.0.1.SP4] at com.acme.greetings.GreetingClient_$$_javassist_21.addGreeting(GreetingClient_$$_javassist_21.java) [:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_20] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_20] at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:304) [:1.0.1.SP4] at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54) [:1.0.1.SP4] at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163) [:1.0.1.SP4] at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:298) [:1.0.1.SP4] at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:113) [:1.0.1.SP4] at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43) [:1.0.1.SP4] at com.acme.greetings.GreetingClient_$$_javassist_30.addGreeting(GreetingClient_$$_javassist_30.java) [:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_20] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_20] at org.apache.el.parser.AstValue.invoke(AstValue.java:196) [:6.0.0.20100721-M4] at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) [:6.0.0.20100721-M4] at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:43) [:1.0.1.SP4] at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:72) [:1.0.1.SP4] at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:43) [:1.0.1.SP4] at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:72) [:1.0.1.SP4] at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:102) [:2.1.0-SNAPSHOT] at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:84) [:2.1.0-SNAPSHOT] ... 36 more Caused by: java.lang.NullPointerException: NUK at com.acme.greetings.GreetingServer.addGreeting(GreetingServer.java:53) [:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_20] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_20] at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:72) [:1.0.7] at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor$InvocationContext.proceed(InvocationContextInterceptor.java:138) [:1.0.7] at org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:143) [:6.0.0.20100721-M4] at org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor.doAroundInvoke(Jsr299BindingsInterceptor.java:116) [:6.0.0.20100721-M4] at sun.reflect.GeneratedMethodAccessor298.invoke(Unknown Source) [:1.6.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_20] at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:83) [:1.0.7] at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:70) [:1.0.7] at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:62) [:1.0.7] at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor$InvocationContext.proceed(InvocationContextInterceptor.java:138) [:1.0.7] at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:47) [:1.0.1.SP4] at sun.reflect.GeneratedMethodAccessor297.invoke(Unknown Source) [:1.6.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_20] at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:83) [:1.0.7] at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:70) [:1.0.7] at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:62) [:1.0.7] at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:76) [:1.0.7] at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:62) [:1.0.7] at sun.reflect.GeneratedMethodAccessor296.invoke(Unknown Source) [:1.6.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20] at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_20] at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72) [:1.0.7] at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_1050798512.invoke(InvocationContextInterceptor_z_fillMethod_1050798512.java) [:] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88) [:1.0.7] at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_1050798512.invoke(InvocationContextInterceptor_z_setup_1050798512.java) [:] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.async.impl.interceptor.FutureSerializingInterceptor.invoke(FutureSerializingInterceptor.java:88) [:1.0.0-alpha-5] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:60) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) [:1.0.3] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81) [:1.5.0-alpha-4] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3] at org.jboss.ejb3.core.context.SessionInvocationContextAdapter.proceed(SessionInvocationContextAdapter.java:90) [:1.5.0-alpha-4] at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:223) [:0.0.1] ... 196 more

Sorry about the formatting, can't find any tag that would preserve the line breaks, here is a pastebin link: http://pastebin.com/cDBuDmjt

simpler reproducer

Hello, I have modified our systest app to reproduce this by throwing an NPE from a methodbinding. I've uploaded it to https://javaserverfaces.dev.java.net/servlets/ProjectDocumentList?folder...

Follow the instructions there and see if you can see the stack trace that ends with NullPointerException: is this masked?

Then, modify the app to install your custom exception handler and try again. Do you still see the same "is this masked?" message?

For the example the exception

For the example the exception if a FacesException and getCause reveals the NPE. OTOH, the scenario is not quite the same since there was EJB + CDI in my stack so the issue might be there. Perhaps the EJB exception thrown should be considered the root cause from the perspective of JSF. In any case, a one-liner Throwable getTrueRootCause(Throwable) with some recursion will dig out the root cause for most cases.

Where to dig out the root cause

I'm all for simplicity.  Where do you recommend digging out the root cause.  At the point in time when we catch the exception from EL?

 

Ed

I'm not sure why the

I'm not sure why the getRootCause from ExceptionHandlerWrapper failed to give me the proper NPE since there is a lot of code in ExceptionHandlerImpl for it. I had a small helper method like

return t.getCause() == null ? return t : return getTrueRootCause(t.getCause());

on top of that which did the trick for me. So perhaps the fix is to make sure getRootCause() always gets to the root of all evil since the method *is* there

not work

this not work with jboss richfaces in glassfish WARNING: ApplicationDispatcher[/uniplat] PWC1231: Servlet.service() for servlet Faces Servlet threw exception java.lang.NullPointerException at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119) at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523) at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:822) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:519) at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:488) at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:379) at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:485) at org.apache.catalina.core.StandardHostValve.dispatchToErrorPage(StandardHostValve.java:679) at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:311) at org.apache.catalina.core.StandardHostValve.postInvoke(StandardHostValve.java:241) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:334) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309) at java.lang.Thread.run(Thread.java:619)

Help me understand your problem.

This blog entry is about making custom tags with JSF2: how does richfaces fit into this?

Ed

The JSF 2.0 book

Ed, PLEASE don't let the book get released without a good index -- the first edition was great, but the index made it about 1/10 as useful as it would have been with a really good index. Thanks. Larry