[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
WorkPageDispatcher returns null WorkpageContainer  XML
Forum Index -> Development
Author Message
mmohr

Active

Joined: 13/04/2021 08:22:08
Messages: 7
Offline

Hi Björn,
I'm currently trying to solve an npe with the following stacktrace on cc version 20210201:
Code:
Caused by: java.lang.NullPointerException
                                               	at org.eclnt.workplace.WorkpageDefaultStarter.startWorkpage(WorkpageDefaultStarter.java:40)
                                               	at org.eclnt.workplace.WorkpageDefaultStarter.startWorkpage(WorkpageDefaultStarter.java:23)
                                               	at de.vps.act.frontend.workplace.controller.WorkplaceController.createBaseBean(WorkplaceController.java:74)
                                               	at de.vps.act.frontend.workplace.controller.WorkplaceController.openOverlayPopup(WorkplaceController.java:111)
                                               	at de.vps.act.frontend.workplace.controller.WorkplaceController.openProcessPage(WorkplaceController.java:101)
                                               	at de.vps.act.explorer.action.commands.CoreObjectHistoryButtonCommand.execute(CoreObjectHistoryButtonCommand.java:26)
                                               	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                               	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                                               	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                                               	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
                                               	at org.eclnt.jsfserver.util.StackedMethodExpression.invoke(StackedMethodExpression.java:68)
                                               	... 85 more

My code that calls captaincasa looks like this
Code:
private IWorkpage createBaseBean(final WorkpageStartInfo startInfo) {
         if (startInfo == null)
             return null;
         
         var topDispatcher = (IWorkpageDispatcher) m_bean.getOwningDispatcher().getTopOwner();
 
         return WorkpageStarterFactory.getWorkpageStarter().startWorkpage(
                 topDispatcher, topDispatcher.getWorkpageContainer(), startInfo);
     }

Apparently the WorkpageContainer that is returned by my topDispatcher is null, now I'm wondering how this can happen. The null WorkpageContainer leads later to the npe when passed to captaincasa code. I really have no idea how this can ever become null, do you have any idea how I can debug this further?

Best regards
Marcel
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5516
Offline

Hi Marcel,
the dispatcher that you pick from...
Code:
  (IWorkpageDispatcher) m_bean.getOwningDispatcher().getTopOwner();

..is passed into the "m_bean" object within the constructor of the m_bean-instance. Could you please a breakpoint into the constructor and check who is calling it? Page beans with workpage-reference are typcially extended from "WorkpageDispatchedPageBean", so this is the constructor that should be somehow called by your extension:
Code:
 public class Xxx extends WorkpageDispatchedPageBean
 {
     public Xxx(IWorkpageDispatcher dispatcher)
     {
         super(dispatcher); // <== put breakpoint here + check if null
         ...
     }
 
 

(I assume in your case you have some class-layers between your class and WorkpageDispatchedPageBean... - but somehwere the dispatcher must be passed...)

Kind regads! Björn

Björn Müller, CaptainCasa GmbH
mmohr

Active

Joined: 13/04/2021 08:22:08
Messages: 7
Offline

CaptainCasa wrote:
snippet 

Hi Björn,
Thanks for your answer.
I checked what you said, but my problem is I cannot reproduce it locally (only happens on customer side) and it appears randomly.
So on my side workpagecontainer is not null when inspecting the dispatcher inside the constructor of the bean.
The code that's calling it looks like this, but I don't think this is of any help:
Code:
WorkplaceBean workplace = (WorkplaceBean) dispatcher.getDispatchedBean("workplace");

The bean extends "WorkpageDispatchedPageBean".
Is there any function that I could look out for that modifies the WorkpageContainer of the dispatcher, so that it could ever return null? Isn't the only possibility that "destroy" is called on a dispatcher which sets the WorkpageContainer to null?

Best regards
Marcel
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5516
Offline

Hi Marcel,

yes, the destroy method is the only one to set it back to "null".

You are working with the top-dispatcher, so the only chance that this one is destroyed is, that the session is closed.
Is it possible that the session is closed by session timeout (web.xml definition of duration...)? This also is in hamorny with "happends randomly".

Kind regards! Björn

Björn Müller, CaptainCasa GmbH
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team