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: NoSuchMethodError from service builder
hi
i am using liferay 7.4 and service builder
there have 2 issues alway burder me.
when i writen a new method, and buildservice from -service, build from -api, deploy both.
sometimes, my other mvc-portlet using @Reference to call the method, it throws NoSuchMethodError.
the only way out is delete all in both modules and state of osgi, and restart server via clean. it will force all modules new.
how can i avoice this?
follows the first issue, another issue is, i have to install a jar from gogo shell, but after i delete state of osgi, i have to reinstall it again.
is there any way to make it always in there such like i copy the jar and put it in shielded-container-lib
thanks in advance.
If you @Reference something, make sure that you'll never hold on to that reference for longer - e.g. store it exactly in the component that declares the dependencies, and (best case) pass it as parameter to any other methods and objects that need access to some service.
Hi Olaf
thank you for reply.
i did modify my build.gradle, with "compileOnly project" for both -api and -service. btw, if i did not, i cannot even compile.
what is "never hold on to that reference for longer" mean? if you mean i will use it in a supper loop or sometime will keep it be hold-on, no, i just use it to get a value object with key.
@Reference will always work in mvc portlet, but in other object, such like some object extends from MessageListener, it won't work, i have to use xxxLocalServiceUtil.
Powered by Liferay™