Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Unable to interpret notification in Liferay 7.2.1 CE GA2
Hi
In liferay 7.1 user and admin can see notification generated by workflow .
Now i migrate from liferay 7.1 to Liferay 7.2.1 CE GA2 and only admin can see notification generated by workflow
but user can't see notification generated by workflow, encountered an exception!!!!! (I've attached the exception)
How can i assign view permission to users for see their notification programmatically in liferay 7.2.1 CE GA2 ?
In liferay 7.1 user and admin can see notification generated by workflow .
Now i migrate from liferay 7.1 to Liferay 7.2.1 CE GA2 and only admin can see notification generated by workflow
but user can't see notification generated by workflow, encountered an exception!!!!! (I've attached the exception)
How can i assign view permission to users for see their notification programmatically in liferay 7.2.1 CE GA2 ?
Attachments:
Hi
did you see source code of WorkflowTaskPermissionChecker.java:169 ?
What is null there?
did you see source code of WorkflowTaskPermissionChecker.java:169 ?
What is null there?
Hi
Because i don't define permission for user to see own notifications , this feature is added in liferay 7.2.1
In liferay 7.1 user and admin can see notification generated by workflow and displaying the notifications is working properly.
Only i migrate from liferay 7.1 to Liferay 7.2.1 CE GA2 and my code has not changed.
This feature probably added in this release.
Do you know how can i assign view permission to users for see their notification programmatically in liferay 7.2.1 CE GA2 ?
Because i don't define permission for user to see own notifications , this feature is added in liferay 7.2.1
In liferay 7.1 user and admin can see notification generated by workflow and displaying the notifications is working properly.
Only i migrate from liferay 7.1 to Liferay 7.2.1 CE GA2 and my code has not changed.
This feature probably added in this release.
Do you know how can i assign view permission to users for see their notification programmatically in liferay 7.2.1 CE GA2 ?
It seems there is no asset renderer available.
AssetRenderer<?> assetRenderer = workflowHandler.getAssetRenderer( classPK);
Line 169: return assetRenderer.hasViewPermission(permissionChecker);
So, assetRenderer is null. Is this a custom asset?
AssetRenderer<?> assetRenderer = workflowHandler.getAssetRenderer( classPK);
Line 169: return assetRenderer.hasViewPermission(permissionChecker);
So, assetRenderer is null. Is this a custom asset?
Christoph Rabel:
It seems there is no asset renderer available.
AssetRenderer<?> assetRenderer = workflowHandler.getAssetRenderer( classPK);
Line 169: return assetRenderer.hasViewPermission(permissionChecker);
So, assetRenderer is null. Is this a custom asset?
Hi dear Christoph
I have asset render & asset render factory ( attached their )
And finally i extend BaseWorkflowHandler class ( attached )
what is the problem?
I don't know.
I would try to add logging. Is getAssetRenderer in your ImportationAssetRendererFactory actually called? I suspect, no.
Maybe you could also try to implement getAssetRenderer in your WorkflowHandler? If it is registered correctly, it should at least output some logging/be visible in the stacktrace.
You could also check the result of calling AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(), I suspect, it returns null.
I would try to add logging. Is getAssetRenderer in your ImportationAssetRendererFactory actually called? I suspect, no.
Maybe you could also try to implement getAssetRenderer in your WorkflowHandler? If it is registered correctly, it should at least output some logging/be visible in the stacktrace.
You could also check the result of calling AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(), I suspect, it returns null.
Christoph Rabel:
Maybe you could also try to implement getAssetRenderer in your WorkflowHandler? If it is registered correctly, it should at least output some logging/be visible in the stacktrace.
You could also check the result of calling AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(), I suspect, it returns null.
Hi dear Christoph
Yes, getAssetRenderer method in WorkflowHandler class can logging/be visible in the stack trace.
And i checked AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(), it returns null.
Your guess was very accurate
What is your suggestion now?
Hi everyone
How can handle this exception (Unable to interpret notification) ?
Is there a solution for him?
How can handle this exception (Unable to interpret notification) ?
Is there a solution for him?
It is likely not satisfactory, but I think you should debug your way through the WorkflowTaskPermissionChecker's hasAssetViewPermission() method.
You need to see what it is finding at each step along the way and why it is finding what it is.
There is some confusing code in the classes you've pasted in, you seem to be overriding some things I wouldn't think are necessary and hard-coding return values in other locations. It looks like you've spent a lot of time trying to get this all off the ground, it really shows.
I did see that you have a setGuestbookLocalService() method in your asset factory that takes your ImportationLocalService as a parameter, I'm guessing that some of this code started from the guestbook sample code. Have you tried deploying the guestbook code to see if its workflow is working? I'd hate to think you're banging your head trying to get your code working if the original fails too...
You need to see what it is finding at each step along the way and why it is finding what it is.
There is some confusing code in the classes you've pasted in, you seem to be overriding some things I wouldn't think are necessary and hard-coding return values in other locations. It looks like you've spent a lot of time trying to get this all off the ground, it really shows.
I did see that you have a setGuestbookLocalService() method in your asset factory that takes your ImportationLocalService as a parameter, I'm guessing that some of this code started from the guestbook sample code. Have you tried deploying the guestbook code to see if its workflow is working? I'd hate to think you're banging your head trying to get your code working if the original fails too...
Hi dear David H Nebinger
In liferay 7.1 users can see notification generated by workflow and displaying the notifications is working properly.
In liferay 7.2 When i assign administrator role to regular user, my problem solved and notification is displayed
how can i assign view permission to users for see their notification programmatically in liferay 7.2.1 CE GA2 ?
In liferay 7.1 users can see notification generated by workflow and displaying the notifications is working properly.
In liferay 7.2 When i assign administrator role to regular user, my problem solved and notification is displayed
how can i assign view permission to users for see their notification programmatically in liferay 7.2.1 CE GA2 ?
Setting programmatically has nothing to do with the exception you're currently dealing with. Solve the issue with the exception, then the programmatic thing for notifications will likely resolve itself.
Hi
Why i assign administrator role to regular user, my problem solved and notification is displayed ?
May be this is a bug of liferay7.2 ?
Why i assign administrator role to regular user, my problem solved and notification is displayed ?
May be this is a bug of liferay7.2 ?
Maybe. I think the point that David is trying to make, and he's right, is that until the code executes without exception you can't know for sure. If the exception is being thrown BEFORE the lines where the permissions are set then that would explain why the user can't see their own notification (because the corresponding record is not yet in the table). That's why David is saying that you should eliminate the exception first.
The administrator role is not a valid test. It surpasses all checks and is the equivalent of not having any permissions at all. Take David's advice. After 15,000 posts, I think it's safe to say he knows what he's doing
The administrator role is not a valid test. It surpasses all checks and is the equivalent of not having any permissions at all. Take David's advice. After 15,000 posts, I think it's safe to say he knows what he's doing

ali yeganeh:
Why i assign administrator role to regular user, my problem solved and notification is displayed ?
Admin is not a good test case. Admins have all access to everything, no permission issues at all to deal with. You can't ever assume that just because something works for admin it will automatically work for everyone else.
Hi dear David
I couldn't find the problem.
Could the exception be outside of the files I attached?
Please comment on the files I attached.
I couldn't find the problem.
Could the exception be outside of the files I attached?
Please comment on the files I attached.
I don't see anything specifically wrong with the code, that's why I suggested debugging and stepping through the WorkflowTaskPermissionChecker's hasAssetViewPermission() method. You need to figure out why that code is returning null, triggering the NPE.
David H Nebinger:
Hi dear David H Nebinger
I don't see anything specifically wrong with the code, that's why I suggested debugging and stepping through the WorkflowTaskPermissionChecker's hasAssetViewPermission() method. You need to figure out why that code is returning null, triggering the NPE.
I debugging the WorkflowTaskPermissionChecker's hasAssetViewPermission() method.
Attachments:
Okay, so now you know that you're not getting an AssetRenderer using the WorkflowHandler's getAssetRenderer() method, so you have to drill down into that method to see where it is failing...
Note that I don't have any real answers for you, it is going to take these kinds of debugging actions to figure out where a failure point is. I don't have a magical answer for you here, we have to find the point of failure and see where it takes us.
Note that I don't have any real answers for you, it is going to take these kinds of debugging actions to figure out where a failure point is. I don't have a magical answer for you here, we have to find the point of failure and see where it takes us.
Hi dear David H Nebinger
According to the attachment file ( 5.jpg ) , class name isn't in map !!!
According to the attachment file ( 5.jpg ) , class name isn't in map !!!
So given that, I went back to the ImportationAssetRendererFactory class and found the following:
The class name for your asset factory shouldn't be its own, it should be the class name for the asset to be rendered, so this should be returning Importation.class.getName() instead.
Check step 5 on https://portal.liferay.dev/docs/7-2/frameworks/-/knowledge_base/f/creating-a-factory-for-the-asset-renderer for verification of what I found.
@Override
public String getClassName()
{
return ImportationAssetRendererFactory.CLASS_NAME;
}
The class name for your asset factory shouldn't be its own, it should be the class name for the asset to be rendered, so this should be returning Importation.class.getName() instead.
Check step 5 on https://portal.liferay.dev/docs/7-2/frameworks/-/knowledge_base/f/creating-a-factory-for-the-asset-renderer for verification of what I found.
I wrote AssetRenderer and AssetRendererFactory classes from scratch according to the link and My problem solved .
Dear David H Nebinger, Thank you very much for taking the time to guide me .
Dear David H Nebinger, Thank you very much for taking the time to guide me .
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™