[rules-users] Eval0Invoker : java.lang.NullPointerException

Michael Anstis michael.anstis at gmail.com
Thu Dec 15 12:21:44 EST 2011


What is RegistrationDeregistrationPersistence?

Is it a Fact to be reasoned over or a verification service?

If a verification service I *would* use this as a global changing your rule
to:-

rule "User Name validation check rule"
       when
               $serviceContext : ServiceContext()
               eval( myService.validateUserName( $serviceContext ) )
       then
               throw new Error("USER ID is invalid");
end

Where "myService" is a global called "myService" of type
RegistrationDeregistrationPersistence.

I removed the "<= -1" but you could include it (IMO the service should
return true or false).

On 15 December 2011 16:59, Venkat <ven12344 at yahoo.com> wrote:

> Manstis, can you please tell me what is wrong with this rule
>
>
> rule "User Name validation check rule"
>         when
>                $serviceContext : ServiceContext()
>                RegistrationDeregistrationPersistence( eval(
> validateUserName(
> $serviceContext ) <= -1 ) ) // condition
>        then
>                throw new Error("USER ID is invalid"); // consequence
> end
>
>
> I am getting this RuntimeException
>
>
>
> java.lang.RuntimeException: Rule Compilation error : [Rule name='User Name
> validation check rule']
>
>
> com/ge/energy/drms/external/integration/service/impl/Rule_User_Name_validation_check_rule.java
> (9:1042) : The method validateUserName(ServiceContext) is undefined for the
> type Rule_User_Name_validation_check_rule
>
>
>        at
>
> com.ge.energy.drms.external.integration.service.impl.PANDeviceRegistrationServiceImpl.createKnowledgeBase(PANDeviceRegistrationServiceImpl.java:142)
>        at
>
> com.ge.energy.drms.external.integration.service.impl.PANDeviceRegistrationServiceImpl.provisionPANDevice(PANDeviceRegistrationServiceImpl.java:77)
>        at
>
> com.ge.energy.drms.external.integration.service.impl.test.ProvisionPanDeviceRequestValidationTest.testCustomerAndServiceContext(ProvisionPanDeviceRequestValidationTest.java:39)
>         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 junit.framework.TestCase.runTest(TestCase.java:168)
>        at junit.framework.TestCase.runBare(TestCase.java:134)
>        at junit.framework.TestResult$1.protect(TestResult.java:110)
>        at junit.framework.TestResult.runProtected(TestResult.java:128)
>        at junit.framework.TestResult.run(TestResult.java:113)
>        at junit.framework.TestCase.run(TestCase.java:124)
>        at junit.framework.TestSuite.runTest(TestSuite.java:232)
>        at junit.framework.TestSuite.run(TestSuite.java:227)
>        at
>
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
>        at
>
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
>        at
>
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>        at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>        at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>        at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>        at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>
>
> Thanks,
> Venkat.
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Eval0Invoker-java-lang-NullPointerException-tp3586222p3589227.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20111215/aaee3c55/attachment.html 


More information about the rules-users mailing list