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
Liferay DXP serviceLocator problem
Hi,
im trying to acces to serviceLocator services but its giving me an error
i already did the steps which are commented here ---> https://web.liferay.com/de/community/forums/-/message_boards/view_message/73386692#_19_message_74729187
2 diferent ways: in the portal and creating the file. what's going on?
thanks in advanced.
Regards.
im trying to acces to serviceLocator services but its giving me an error
The following has evaluated to null or missing:
==> serviceLocator.findService("com.liferay.portlet.blogs.service.impl.BlogsEntryLocalServiceImpl") [in template "20116#20152#42734" at line 6, column 12]
----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing<!--#if-->. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----i already did the steps which are commented here ---> https://web.liferay.com/de/community/forums/-/message_boards/view_message/73386692#_19_message_74729187
2 diferent ways: in the portal and creating the file. what's going on?
thanks in advanced.
Regards.
I don't think serviceLocator is missing. I guess it just can't locate "com.liferay.portlet.blogs.service.impl.BlogsEntryLocalServiceImpl". You can't access the impl classes, you need to use the interface "com.liferay.blogs.kernel.service.BlogsEntryLocalService".
Thank you Christoph, i didn't know that i have to use the interface. i had tried using the Util class aswell but same result. With the interface it works finally. Thank you very much my friend.