Liferay DXP serviceLocator problem

thumbnail
Jon Ander Gonzalez, modified 8 Years ago. Junior Member Posts: 28 Join Date: 5/30/17 Recent Posts
Hi,

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 &lt;#if myOptionalVar??&gt;when-present&lt;#else&gt;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.
thumbnail
Christoph Rabel, modified 8 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
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".
thumbnail
Jon Ander Gonzalez, modified 8 Years ago. Junior Member Posts: 28 Join Date: 5/30/17 Recent Posts
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.