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, e.g. IDE, test setup etc. Otherwise, I'm afraid, you'll have to see it as a glitch in the matrix.