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(a)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(a)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(a)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(a)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(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users