Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-394

java.lang.RuntimeException: cannot invoke getter

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 5.5.1.Final
    • None
    • None
    • None

      we are using drools 5.4.final. and below is the rule

      rule "EnergyUsage data not empty"
      dialect "java"
      salience 100
      no-loop
      when
      $httpResponse : HttpResponse(
      (((EnergyUsage)responseData).energyUsageDetail.billingGroup!=null && ((EnergyUsage)responseData).energyUsageDetail.billingGroup!=0) ||
      ((EnergyUsage)responseData).energyUsageDetail.capacityPLCs.size()>0 ||
      ((EnergyUsage)responseData).energyUsageDetail.networkServicePLCs.size()>0 ||
      ((EnergyUsage)responseData).energyUsageDetail.servicePoint!=null ||
      ((EnergyUsage)responseData).energyUsageDetail.historicalUsages.size() > 0
      );

      then
      System.out.println("[EnergyUsage data not empty] rule has been fired...");
      $httpResponse.setStatusCode(EisConstants.STATUS_OK);
      $httpResponse.setErrorMessage("");
      end

      rule "EnergyUsage data empty"
      dialect "java"
      no-loop
      when
      $httpResponse : HttpResponse(
      (((EnergyUsage)responseData).energyUsageDetail.billingGroup==null || ((EnergyUsage)responseData).energyUsageDetail.billingGroup==0) &&
      ((EnergyUsage)responseData).energyUsageDetail.capacityPLCs.size()==0 &&
      ((EnergyUsage)responseData).energyUsageDetail.networkServicePLCs.size()==0 &&
      ((EnergyUsage)responseData).energyUsageDetail.servicePoint==null &&
      ((EnergyUsage)responseData).energyUsageDetail.historicalUsages.size() == 0
      );

      then
      System.out.println("[EnergyUsage data empty] rule has been fired...");
      $httpResponse.setStatusCode(EisConstants.STATUS_OK);
      $httpResponse.setErrorMessage("Data Screen Scrapping is empty for this account");
      end

      Here is log error:
      -------------------------
      java.lang.RuntimeException: cannot invoke getter: getEnergyUsageDetail [declr.class: com.bluestarenergy.core.eis.common.usage.EnergyUsage; act.class: com.bluestarenergy.core.eis.common.usage.EnergyUsage] (see trace)
      at org.mvel2.optimizers.impl.refl.nodes.GetterAccessor.getValue(GetterAccessor.java:74)
      at org.mvel2.ast.Union.getReducedValueAccelerated(Union.java:41)
      at org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:107)
      at org.mvel2.ast.Or.getReducedValueAccelerated(Or.java:34)
      at org.mvel2.ast.Or.getReducedValueAccelerated(Or.java:34)
      at org.mvel2.ast.Or.getReducedValueAccelerated(Or.java:34)
      at org.mvel2.ast.Or.getReducedValueAccelerated(Or.java:34)
      at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
      at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:123)
      at org.mvel2.MVEL.executeExpression(MVEL.java:930)
      at org.drools.rule.constraint.MvelConditionEvaluator.evaluate(MvelConditionEvaluator.java:70)
      at org.drools.rule.constraint.MvelConditionEvaluator.evaluate(MvelConditionEvaluator.java:49)
      at org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:167)
      at org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:124)
      at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
      at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
      at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
      at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
      at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
      at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:337)
      at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:298)
      at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:888)
      at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
      at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
      at com.aepenergy.b2b.services.energyusage.UsageRulesServiceImpl.ruleCompliance(UsageRulesServiceImpl.java:19)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
      at $Proxy161.ruleCompliance(Unknown Source)
      at com.aepenergy.b2b.services.energyusage.EnergyUsageCommunicationServiceImpl.processRequestEnergyUsageHttp(EnergyUsageCommunicationServiceImpl.java:52)

              mproctor@redhat.com Mark Proctor
              llizana leonardo lizana (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: