简体   繁体   中英

Liferay Service Builder Not recognized function

I added a new method on my Service Builder:

public IRRule ruleCreation()
throws SystemException, PortalException {
    IRRule rule = new IRRuleImpl();
    return rule;
}

The method is recognised from the portlet class (No errors are presented):

public class RulePortlet extends MVCPortlet{

public void addRule(ActionRequest request, ActionResponse response)
throws Exception {
    ThemeDisplay themeDisplay =
    (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);

    IRRule rule = IRRuleLocalServiceUtil.ruleCreation(); // This is The Method!!!!


    rule.setCompanyId(themeDisplay.getCompanyId());
    rule.setGroupId(themeDisplay.getScopeGroupId());
    rule.setRuleName(ParamUtil.getString(request, "ruleName"));
    rule.setRuleDescription(ParamUtil.getString(request, "ruleDescription"));
    rule.setRuleFile(ParamUtil.getString(request, "ruleFile"));

    ArrayList<String> errors = new ArrayList<String>();
    if (RuleValidator.validateRule(rule, errors)) {
        IRRuleLocalServiceUtil.addRule(rule,
        themeDisplay.getUserId());
        SessionMessages.add(request, "product-saved-successfully");
    } else {
        SessionErrors.add(request, "fields-required");
    }
}
...

But at the time of testing this function I'm having this error throw the console...

java.lang.NoSuchMethodError: com.ent.oriol.inputrules.service.IRRuleLocalServiceUtil.ruleCreation()Lcom/ent/oriol/inputrules/model/IRRule;

How is that possible? What I should do to solve this problem?? In the past I added other functions to the service Builder (LocalServiceImpl class) without troubles!

Thank you for the help, Oriol

As you commented that a restart helped, the issue is probably some old code that got cached somehow, maybe in a running debugger process that did not pick up the class changes caused by servicebuilder when the services were rebuilt.

It's hard to tell this after the fact - if you can reproduce this, it would be interesting to know the circumstances, eg IDE, test setup etc. Otherwise, I'm afraid, you'll have to see it as a glitch in the matrix.

 Goto service.xml--->select Overview--->In the right corner build services option is there--->click that

在此处输入图片说明

if any changes seen in service.xml just follow the above screen what i mentioned you will rectify easily.In his statement he mentioned like some changes done in service builder thats the reason i gave the solution

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM