Conversation Context not active when method called on conversation

Splash Forums PrettyFaces Users Conversation Context not active when method called on conversation

This topic contains 21 replies, has 3 voices, and was last updated by  jllado 4 years, 4 months ago.

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #19274

    jllado
    Participant

    Happy new year!

    I have in pretty-config.xml this mapping:

    <url-mapping id="forums">
    <pattern value="/forums" />
    <view-id value="/forums.jsf" />
    </url-mapping>
    <url-mapping parentId="forums" id="forumTopic">
    <pattern value="/#{forumTopicId}">
    <validate index="0" validator="#{user.validateUrlParameters}"
    onError="pretty:forums" />
    </pattern>
    <view-id value="#{user.targetPage}" />
    </url-mapping>

    Validator user.validateUrlParameters is called successfully and it throws ValidatorException:

    throw new ValidatorException(new FacesMessage());

    Instead of going to pretty:forums due to error I have this in server.log:

    java.lang.IllegalStateException
    at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:506)
    at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:164)
    at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:164)
    at com.ocpsoft.pretty.faces.application.PrettyRedirector.send404(PrettyRedirector.java:110)
    at com.ocpsoft.pretty.faces.config.dynaview.DynaviewEngine.processDynaView(DynaviewEngine.java:108)
    at com.ocpsoft.pretty.faces.event.PrettyPhaseListener.afterPhase(PrettyPhaseListener.java:109)
    at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:807)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:671)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:505)
    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:476)
    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:355)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:305)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:722)

    INFO: this is an exception itself: java.lang.IllegalStateException
    INFO: this is a cause of exception: null
    INFO: this is a message of exception: null
    INFO: This is attributes of exception {javax.faces.event.ExceptionQueuedEventContext.IN_AFTER_PHASE=true}
    WARNING: ApplicationDispatcher[/javahelp] PWC1231: Servlet.service() for servlet Faces Servlet threw exception
    javax.enterprise.context.ContextNotActiveException: Conversation Context not active when method called on conversation Transient conversation
    at org.jboss.weld.context.conversation.ConversationImpl.verifyConversationContextActive(ConversationImpl.java:197)
    at org.jboss.weld.context.conversation.ConversationImpl.isTransient(ConversationImpl.java:149)
    at org.jboss.weld.jsf.ConversationAwareViewHandler.getActionURL(ConversationAwareViewHandler.java:102)
    at com.sun.faces.application.view.MultiViewHandler.getRedirectURL(MultiViewHandler.java:381)
    at com.ocpsoft.pretty.faces.application.PrettyViewHandler.getRedirectURL(PrettyViewHandler.java:150)
    at javax.faces.application.ViewHandlerWrapper.getRedirectURL(ViewHandlerWrapper.java:204)
    at org.jboss.weld.jsf.ConversationAwareViewHandler.getRedirectURL(ConversationAwareViewHandler.java:133)
    at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:166)
    at com.ocpsoft.pretty.faces.application.PrettyNavigationHandler.handleNavigation(PrettyNavigationHandler.java:64)
    at com.javahelp.util.exception.JavaHelpExceptionHandler.handle(JavaHelpExceptionHandler.java:81)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:807)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:671)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:505)
    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:476)
    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:355)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:305)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:722)

    WARNING: StandardWrapperValve[default]: PWC1406: Servlet.service() for servlet default threw exception
    javax.enterprise.context.ContextNotActiveException: Conversation Context not active when method called on conversation Transient conversation
    at org.jboss.weld.context.conversation.ConversationImpl.verifyConversationContextActive(ConversationImpl.java:197)
    at org.jboss.weld.context.conversation.ConversationImpl.isTransient(ConversationImpl.java:149)
    at org.jboss.weld.jsf.ConversationAwareViewHandler.getActionURL(ConversationAwareViewHandler.java:102)
    at com.sun.faces.application.view.MultiViewHandler.getRedirectURL(MultiViewHandler.java:381)
    at com.ocpsoft.pretty.faces.application.PrettyViewHandler.getRedirectURL(PrettyViewHandler.java:150)
    at javax.faces.application.ViewHandlerWrapper.getRedirectURL(ViewHandlerWrapper.java:204)
    at org.jboss.weld.jsf.ConversationAwareViewHandler.getRedirectURL(ConversationAwareViewHandler.java:133)
    at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:166)
    at com.ocpsoft.pretty.faces.application.PrettyNavigationHandler.handleNavigation(PrettyNavigationHandler.java:64)
    at com.javahelp.util.exception.JavaHelpExceptionHandler.handle(JavaHelpExceptionHandler.java:81)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:807)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:671)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:505)
    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:476)
    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:355)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:305)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:722)

    Thank you!

    #23363

    jllado
    Participant

    Actually I removed from my exception handler redirecting to new location (after error is processed) :

    navigHandler.handleNavigation(fc, null, "/index.jsf?faces-redirect=true");

    Now the error I get (if pretty faces validator throws ValidatorException) is much shorter:

    INFO: Custom Exception Handler
    java.lang.IllegalStateException
    at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:506)
    at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:164)
    at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:164)
    at com.ocpsoft.pretty.faces.application.PrettyRedirector.send404(PrettyRedirector.java:110)
    at com.ocpsoft.pretty.faces.config.dynaview.DynaviewEngine.processDynaView(DynaviewEngine.java:108)
    at com.ocpsoft.pretty.faces.event.PrettyPhaseListener.afterPhase(PrettyPhaseListener.java:109)
    at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:807)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:671)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:505)
    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:476)
    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:355)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:305)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:722)

    INFO: this is an exception itself: java.lang.IllegalStateException
    INFO: this is a cause of exception: null
    INFO: this is a message of exception: null
    INFO: This is attributes of exception {javax.faces.event.ExceptionQueuedEventContext.IN_AFTER_PHASE=true}

    #23364

    Does this error only occur if your custom exception handler is active? You could try to disable your custom exception handling and test if it work in this case.

    HttpServletResponse.sendError() will throw an IllegalStateException if the response is already committed. So it seems like some component has written something to the response stream or has already set a response code for the request. If this is the case, PrettyFaces won’t be able to send a 404 response.

    #23365

    I just had a look at the corresponding code of DynaviewEngine. It seems like PrettyFaces tries to send a 404 because some exception is thrown within the DynaView engine. Unfortunately the IllegalStateException hides the root cause of the problem. I guess you will have to set a break point in DynaviewEngine:107 to see which exception is thrown.

    #23366

    jllado
    Participant

    I set breakpoint at line 107 and when the execution was suspended there was only my print statement indicating that pretty validator entered

    ‘INFO: UserSessionBean.validateUrlParameters.value=JSF’

    Frankly I did not know what to do next and began to press F5 which means ‘Step into’. I pressed it very many times and

    finally exception which I posted above appeared.

    At the moment when execution was suspended at line 107 there was no exception and next the same exception was logged.

    My custom exception handler was disabled in faces-config.xml !

    With disabled exception handler one new line appeared before error itself

    INFO: Exception when handling error trying to reset the response.

    You say that something was written to response stream before prettyfaces tried to redirect.

    How to find out what was written into response before?

    #23367

    You breakpoint in DynaviewEngine:107 is inside a catch block. Could you tell me which exception is catched there? Unfortunately this exception is not logged and therefore you will have to use your debugger.

    #23368

    jllado
    Participant

    As I understand , I debug when I have server started in debug mode and when there are some breakpoints to suspend server.

    There was no other errors logged!

    BUT I realised that I could just put all my validator method into try-catch block and see all exceptions caught.

    This way I found my amazingly easy mistake !

    Unfortunately my validator method also needs to look up Singleton programmatically.

    I cannot inject singleton anyway!

    My singleton’s head is:

    @Singleton
    @Startup
    @ApplicationScoped
    public class ApplicationBacking {

    I use initialContext.lookup(“java:comp/env/applicationBacking”); and it returns null.

    Can you tell me this?

    #23369

    jllado
    Participant

    I have resolved this already!

    It is bery simple. Singleton should be annotated by

    @Singleton(name="applicationBacking")

    And at injection point I use specified name:

    @EJB(name="applicationBacking",beanInterface=ApplicationBacking.class)
    private ApplicationBacking applicationBacking = null;

    #23370

    Good! Glad you got this figured out. Thanks for letting us know what you did to resolve the issue (and also glad it was not a bug ;)

    #23371

    jllado
    Participant

    It is logged that validator method is called twice at RESTORE_VIEW phase of single request.

    <view-id value=”#{user.targetPage}” />

    This targetPage is assigned in validator method.

    I don’t redirect to the same view again in validator method. Why is my validator called twice? Should it be so?

    #23372

    Could you add a breakpoint in your validator and post the stack-trace from each invocation? Thanks.

    #23373

    jllado
    Participant

    The stacktrace after first call. Stacktrace is obtained by Thread.currentThread().getStackTrace();

    INFO: java.lang.Thread.getStackTrace(Thread.java:1567)
    INFO: com.javahelp.backingbeans.UserSessionBean.validateUrlParameters(UserSessionBean.java:359)
    INFO: sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    INFO: sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    INFO: sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    INFO: java.lang.reflect.Method.invoke(Method.java:601)
    INFO: com.sun.el.parser.AstValue.invoke(AstValue.java:254)
    INFO: com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:302)
    INFO: org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39)
    INFO: org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
    INFO: com.ocpsoft.pretty.faces.util.FacesElUtils.invokeMethod(FacesElUtils.java:70)
    INFO: com.ocpsoft.pretty.faces.beans.ParameterValidator.validatePathParams(ParameterValidator.java:95)
    INFO: com.ocpsoft.pretty.faces.beans.ParameterValidator.validateParameters(ParameterValidator.java:60)
    INFO: com.ocpsoft.pretty.faces.event.PrettyPhaseListener.afterPhase(PrettyPhaseListener.java:93)

    INFO: com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189)
    INFO: com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107)
    INFO: com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
    INFO: com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    INFO: javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    INFO: org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
    INFO: org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
    INFO: org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    INFO: com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
    INFO: org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    INFO: org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    INFO: org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:807)
    INFO: org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:671)
    INFO: org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:505)
    INFO: org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:476)
    INFO: org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:355)
    INFO: org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:305)
    INFO: com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:119)
    INFO: org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    INFO: org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    INFO: org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
    INFO: org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    INFO: org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    INFO: org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    INFO: org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
    INFO: org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
    INFO: org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    INFO: com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
    INFO: com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    INFO: com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
    INFO: com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
    INFO: com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
    INFO: com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
    INFO: com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    INFO: com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    INFO: com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    INFO: com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    INFO: com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    INFO: com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    INFO: com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    INFO: com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    INFO: com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    INFO: java.lang.Thread.run(Thread.java:722)

    The stacktrace after second call. It was needed to restart server:

    INFO: java.lang.Thread.getStackTrace(Thread.java:1567)
    INFO: com.javahelp.backingbeans.UserSessionBean.validateUrlParameters(UserSessionBean.java:359)
    INFO: sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    INFO: sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    INFO: sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    INFO: java.lang.reflect.Method.invoke(Method.java:601)
    INFO: com.sun.el.parser.AstValue.invoke(AstValue.java:254)
    INFO: com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:302)
    INFO: org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39)
    INFO: org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
    INFO: com.ocpsoft.pretty.faces.util.FacesElUtils.invokeMethod(FacesElUtils.java:70)
    INFO: com.ocpsoft.pretty.faces.beans.ParameterValidator.validatePathParams(ParameterValidator.java:95)
    INFO: com.ocpsoft.pretty.faces.beans.ParameterValidator.validateParameters(ParameterValidator.java:60)
    INFO: com.ocpsoft.pretty.faces.event.PrettyPhaseListener.afterPhase(PrettyPhaseListener.java:93)
    INFO: com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189)
    INFO: com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107)
    INFO: com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
    INFO: com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    INFO: javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    INFO: org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
    INFO: org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
    INFO: org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    INFO: com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
    INFO: org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    INFO: org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    INFO: org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:807)
    INFO: org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:671)
    INFO: org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:505)
    INFO: org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:476)
    INFO: org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:355)
    INFO: org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:305)
    INFO: com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:119)
    INFO: org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    INFO: org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    INFO: org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
    INFO: org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    INFO: org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    INFO: org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    INFO: org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
    INFO: org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
    INFO: org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    INFO: com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
    INFO: com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    INFO: com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
    INFO: com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
    INFO: com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
    INFO: com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
    INFO: com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    INFO: com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    INFO: com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    INFO: com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    INFO: com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    INFO: com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    INFO: com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    INFO: com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    INFO: com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    INFO: java.lang.Thread.run(Thread.java:722)

    #23374

    Hmmmmm. It’s /possible/ this could be a bug, because this should not be happening twice..

    Could I ask you a big favor? Could you package up the sources for an example project that reproduces this issue? I’d like to debug.

    Thanks,

    ~Lincoln

    #23375

    You can attach the zip file with project sources directly to this post. Thanks.

    #23376

    jllado
    Participant

    I noticed the following things:

    1. If validator method throws ValidatorException and catches it I am not redirected to onError page.

    But if my ValidatorException is NOT caught by try-catch block I am redirected properly.

    2. If I assign targetPage in validator method the validator is running twice and it is logged !!!

    3. If I assign targetPage when it is declared and call value of targetPage from pretty-config.xml

    like <view-id value=”#{user.getTargetPage}” /> then validator method is running really twice and it is logged!!!

    4. If I don’t touch targetPage for view-id at all but simply specify :

    <view-id value=”/pageToRedirect.jsf” /> then validator method is running only once !!!

    I am at Glassfish 3.1.2 build 5 and use Maven and latest Eclipse Juno

    I packaged my project by 7-zip.

Viewing 15 posts - 1 through 15 (of 22 total)

You must be logged in to reply to this topic.

Comments are closed.