的Liferay服务生成器不能识别功能

问题描述:

我对我的服务生成器添加了一个新方法:的Liferay服务生成器不能识别功能

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类)中,而不会出现任何问题!

谢谢你的帮助, 奥里奥尔

+0

您是否在构建服务时检查了'ant-console'中是否有任何错误? – 2013-04-25 15:18:38

+0

我重新启动了电脑,问题解决了。在测试时我没有收到任何控制台问题,我认为这是线程问题! – user1592470 2013-04-26 07:33:24

正如您所评论的那样,重新启动有帮助,问题可能是一些旧代码以某种方式被缓存,也许在ar unning调试器进程没有选择重建服务时由servicebuilder引起的类更改。

在事实之后很难说出这一点 - 如果你能重现这一点,那么了解情况会很有趣, IDE,测试设置等。否则,恐怕您必须将其视为矩阵中的一个小故障。

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

enter image description here

如果service.xml中看到任何变化只要按照上面的画面是什么我提到你会纠正easily.In他在发言中提到的就像服务建设者所做的一些更改,这就是我给出解决方案的原因

+0

OP表示他之前在服务构建器中使用LocalServiceImpl构建了其他方法:***在过去,我将其他函数添加到了服务构建器(LocalServiceImpl类)中,而且没有任何问题!***所以这并不回答我认为的问题。 – 2013-04-25 11:39:50