[midPoint] NULL prismContext
Pavol Mederly
mederly at evolveum.com
Fri Oct 11 15:39:41 CEST 2019
Hello Jan,
this kind of exceptions (i.e. NPE related to prism context being null)
has been beating me for years.
Generally, is issue occurs when Wicket serializes and then deserializes
content of a page and then invokes a method to do something.
A quite universal way of preventing it is to call adopt() method on any
objects that could have come from such deserialization.
An example:
https://github.com/Evolveum/midpoint/blob/8eac39e2553501a59221ba7a13afc4b13a7dff88/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java#L418
Here the "user" comes from delegationsModel.getObject() that can be
possibly serialized and deserialized, because it's part of a page.
At least this is how I understand it. I try to avoid messing with GUI as
much as I can. :-)
Best regards,
Pavol Mederly
Software developer
evolveum.com
On 11.10.2019 15:01, Jan Vaňáček - AMI Praha a.s. wrote:
>
> Hi guys,
>
> I am using midPoint 3.7 support and l am looking into NPE connected
> with prismContext and I am a little bit getting frustrated since I
> have no idea how to find root cause.
>
> This NPE occurs when computing authorizations for Org tree.
>
> I have an authorization (for deleting subunits):
>
> <authorization>
>
> <name>_org_-delete-subunit</name>
>
> <action>http://midpoint.evolveum.com/xml/ns/public/security/authorization-model-3#delete</action>
>
> <object>
>
> <type>OrgType</type>
>
> <orgRelation>
>
> <subjectRelation>org:manager</subjectRelation>
>
> <scope>allDescendants</scope>
>
> <includeReferenceOrg>true</includeReferenceOrg>
>
> </orgRelation>
>
> <filter>
>
> <q:equal>
>
> <q:path>orgType</q:path>
>
> <q:value>ROLE_FOLDER</q:value>
>
> </q:equal>
>
> </filter>
>
> </object>
>
> </authorization>
>
> When I click into Org. structure and then I click on any item in a
> tree (including root org) authorizations will be computed.
>
> But when it gets to computing root org object. It invokes
> object.getPrismContext() which is null resulting in Error 500:
> /org.apache.wicket.WicketRuntimeException: Error attaching this
> container for rendering: [ListView [Component id = menuItem]]/
>
> When I try to click (compute) it for the second time it is OK. But
> then it occures sometimes again (especially when I log out and log in,
> but it depends – sometimes it is just on the 10th attempt, sometimes
> on the 2nd attempt)
>
> I noticed that in com.evolveum.midpoint.prism.Item is mentioned:
> „beware, this one can easily be null“, but in QueryJaxbConvertor it is
> not checked for null…
>
> Is there any way how to make sure that there always be prismContext
> for a root org? Or what else should I check?
>
> *Jan Vaňáček*
> JAVA programátor
>
> gsm: [+420] 734 510 214
> e-mail: jan.vanacek at ami.cz <mailto:jan.vanacek at ami.cz>
>
> *AMI Praha a.s.*
> Pláničkova 11, 162 00 Praha 6
>
> tel.: [+420] 274 783 239 | web: www.ami.cz <http://www.ami.cz/>
>
> AMI Praha a.s.
>
> Textem tohoto e‑mailu podepisující neslibuje uzavřít ani neuzavírá
> za společnost AMI Praha a.s.
> jakoukoliv smlouvu. Každá smlouva, pokud bude uzavřena, musí mít
> výhradně písemnou formu.
>
> Tento e‑mail je určen výhradně pro potřeby jeho adresáta/ů a může
> obsahovat důvěrné nebo osobní
> informace. Nejste‑li zamýšleným příjemcem, je zakázáno jakékoliv
> zveřejňování, zprostředkování
> nebo jiné použití těchto informací. Pokud jste obdrželi e‑mail
> neoprávněně, informujte o tom prosím
> odesílatele a vymažte neprodleně všechny kopie tohoto e‑mailu včetně
> všech jeho příloh. Nakládáním
> s neoprávněně získanými informacemi se vystavujete riziku právního
> postihu.
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20191011/3484efee/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 2900 bytes
Desc: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20191011/3484efee/attachment.gif>
More information about the midPoint
mailing list