NoSuchMethodError from service builderNoSuchMethodError from service builderhttps://liferay.dev/c/message_boards/find_thread?p_l_id=119785333&threadId=1214395912024-03-28T14:09:18Z2024-03-28T14:09:18ZRE: RE: NoSuchMethodError from service builderScarletake Bwihttps://liferay.dev/c/message_boards/find_message?p_l_id=119785333&messageId=1214429132022-06-16T01:04:22Z2022-06-16T01:04:21Z<p>Hi Olaf</p>
<p>thank you for reply. </p>
<p>i did modify my build.gradle, with "compileOnly project"
for both -api and -service. btw, if i did not, i cannot even compile. </p>
<p>what is "<em>never</em> 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.</p>
<p>@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.</p>Scarletake Bwi2022-06-16T01:04:21ZRE: NoSuchMethodError from service builderOlaf Kockhttps://liferay.dev/c/message_boards/find_message?p_l_id=119785333&messageId=1214431642022-06-15T15:11:27Z2022-06-15T15:11:27Z<p>If you @Reference something, make sure that you'll <em>never</em>
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.</p>Olaf Kock2022-06-15T15:11:27ZNoSuchMethodError from service builderScarletake Bwihttps://liferay.dev/c/message_boards/find_message?p_l_id=119785333&messageId=1214395902022-06-07T02:05:03Z2022-06-07T02:05:02Z<p>hi </p>
<p>i am using liferay 7.4 and service builder</p>
<p>there have 2 issues alway burder me.</p>
<p>when i writen a new method, and buildservice from -service, build
from -api, deploy both.</p>
<p>sometimes, my other mvc-portlet using @Reference to call the method,
it throws NoSuchMethodError.</p>
<p>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.</p>
<p>how can i avoice this?</p>
<p>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.</p>
<p>is there any way to make it always in there such like i copy the jar
and put it in shielded-container-lib</p>
<p>thanks in advance.&