我在我的 Service Builder 上添加了一个新方法:
public IRRule ruleCreation()
throws SystemException, PortalException {
IRRule rule = new IRRuleImpl();
return rule;
}
该方法是从 portlet 类中识别出来的(没有出现错误):
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");
}
}
...
但是在测试此功能时,我遇到此错误抛出控制台...
java.lang.NoSuchMethodError: com.ent.oriol.inputrules.service.IRRuleLocalServiceUtil.ruleCreation()Lcom/ent/oriol/inputrules/model/IRRule;
这怎么可能?我应该怎么做才能解决这个问题??过去我在服务构建器(LocalServiceImpl 类)中添加了其他功能,没有任何麻烦!
谢谢你的帮助,奥里奥尔