[rules-users] Drools and Jersey

mike mikemps at gmail.com
Wed Mar 14 12:23:31 EDT 2012


Wait ... I haven't solved the problem ... I mean, as of now I cannot use
mvel if I want to use Jersey ... and I don't think it's Jersey's fault
because it works in any condition except when using mvel. I thought that
the Drools team follows this list and might be interested in that bug.

Thank you very much
Mike

2012/3/14 Mauricio Salatino <salaboy at gmail.com>

> Cool that you find that :)
> Cheers
>
>
> 2012/3/14 mike <mikemps at gmail.com>
>
>> Hi Mauricio,
>>
>> I spent like 2 days debugging, before realizing that mvel was the
>> culprit. The error is a Null Exception when resolving some service inside
>> Jersey. I have to check my browser history at home for more details but the
>> exception was happening inside Jersey.
>>
>> Please notice I reduced the code to the minimum. I had 'real' code doing
>> more reasonable things with new Client. Client c = new Client() fails too.
>>
>> Thank you very much
>>  Mike
>>
>>
>> 2012/3/14 Mauricio Salatino <salaboy at gmail.com>
>>
>>> Hi Mike, I've never tried that before (a rule without the when part..)
>>> is good to know that it works :)
>>> Humm that's sounds weird.. why the dialect is affecting your Client
>>> creation.
>>> It could be that there is something wrong with the expression evaluation.
>>> It looks like MVEL cannot compile the new Client(); expression -> at
>>> java.lang.String.<init>(Unknown Source)
>>> Did you try with something like:
>>> then \n
>>> Client c = new Client();
>>>
>>> I'm just guessing here, because it looks strange
>>>
>>>
>>> 2012/3/14 mike <mikemps at gmail.com>
>>>
>>>> Hi Mauricio,
>>>>
>>>> Thank you for the speedy reply. Ia m making rest call to web services
>>>> using jersey. I simplified the rule to the max. The 'when' is not really
>>>> needed. I get the exception on the call to "new Client()". Please keep in
>>>> mind it works without dialect "mvel".
>>>>
>>>> Thank you very much
>>>> Mike
>>>>
>>>> Here's the stack trace .............
>>>> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
>>>> at java.lang.String.<init>(Unknown Source)
>>>>  at
>>>> org.mvel2.CompileException.showCodeNearError(CompileException.java:149)
>>>> at
>>>> org.mvel2.CompileException.generateErrorMessage(CompileException.java:219)
>>>>  at org.mvel2.CompileException.toString(CompileException.java:62)
>>>> at java.lang.Throwable.<init>(Throwable.java:242)
>>>>  at java.lang.Exception.<init>(Unknown Source)
>>>> at java.lang.RuntimeException.<init>(Unknown Source)
>>>>  at
>>>> org.drools.runtime.rule.ConsequenceException.<init>(ConsequenceException.java:31)
>>>> at
>>>> org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
>>>>  at
>>>> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
>>>> at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
>>>>  at
>>>> org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
>>>> at
>>>> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:709)
>>>>  at
>>>> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:673)
>>>> at
>>>> org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
>>>>  at
>>>> com.ultimatesoftware.engine.tests.Wip.drools_new_client(Wip.java:32)
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>>>  at java.lang.reflect.Method.invoke(Unknown Source)
>>>> at
>>>> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
>>>>  at
>>>> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>>>> at
>>>> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
>>>>  at
>>>> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>>>> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
>>>>  at
>>>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
>>>> at
>>>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
>>>>  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
>>>> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
>>>>  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
>>>> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
>>>>  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
>>>> at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
>>>>  at
>>>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>>>> 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)
>>>>
>>>>
>>>>
>>>> 2012/3/14 Mauricio Salatino <salaboy at gmail.com>
>>>>
>>>>> what are you trying to do?
>>>>> what's the error?
>>>>>
>>>>> the rule should look like
>>>>>
>>>>> rule "create Rest Client"
>>>>>     when
>>>>>     then new Client();
>>>>> end
>>>>>
>>>>> 2012/3/14 mike <mikemps at gmail.com>
>>>>>
>>>>>>  Hi there,
>>>>>>
>>>>>> I am trying to make rest calls from Drools. For that I am using
>>>>>> Jersey http://jersey.java.net/. I cannot no get it to work if I use
>>>>>> mvel, otherwise it works fine.
>>>>>>
>>>>>> Here is a sample rule:
>>>>>> ----------------------------------------------------------
>>>>>> import com.sun.jersey.api.client.Client;
>>>>>>
>>>>>> dialect  "mvel"
>>>>>>
>>>>>> rule "create Rest Client"
>>>>>>     then new Client();
>>>>>> end
>>>>>> ----------------------------------------------------------
>>>>>>
>>>>>> I would love to be able to use mvel since it curves java syntax :)
>>>>>>
>>>>>> Thank you
>>>>>> Mike
>>>>>>
>>>>>> _______________________________________________
>>>>>> rules-users mailing list
>>>>>> rules-users at lists.jboss.org
>>>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>  - MyJourney @ http://salaboy.wordpress.com
>>>>>  - Co-Founder @ http://www.jugargentina.org
>>>>>  - Co-Founder @ http://www.jbug.com.ar
>>>>>
>>>>>  - Salatino "Salaboy" Mauricio -
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> rules-users mailing list
>>>>> rules-users at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> rules-users mailing list
>>>> rules-users at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>
>>>>
>>>
>>>
>>> --
>>>  - MyJourney @ http://salaboy.wordpress.com
>>>  - Co-Founder @ http://www.jugargentina.org
>>>  - Co-Founder @ http://www.jbug.com.ar
>>>
>>>  - Salatino "Salaboy" Mauricio -
>>>
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
>
> --
>  - MyJourney @ http://salaboy.wordpress.com
>  - Co-Founder @ http://www.jugargentina.org
>  - Co-Founder @ http://www.jbug.com.ar
>
>  - Salatino "Salaboy" Mauricio -
>
>
> _______________________________________________
> 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/20120314/eeb36bee/attachment.html 


More information about the rules-users mailing list