[rules-users] Question about drools server

Xinhua Zhu xhzhu at it.uts.edu.au
Thu Oct 14 10:13:02 EDT 2010


Hi,

I am following below article to call drools server with a client. I met a
Marshaller issue.

http://www.plugtree.com/?p=469

I found that BatchExecutionCommand<http://www.jboss.com/products/rules/drools-api/apidocs/org/drools/command/BatchExecutionCommand.html>is
changed to BatchExecutionCommandImpl

when I call
 jaxbContext =
DroolsJaxbContextHelper.createDroolsJaxbContext(myDomainClasses, null);

errors happen.

java.lang.Error: Unresolved compilation problem:

    at
org.plugtree.drools.server.util.DroolsJaxbContextHelper.createDroolsJaxbContext(DroolsJaxbContextHelper.java:75)
    at
org.plugtree.drools.server.DroolsServerTest.testDroolsServer(DroolsServerTest.java:75)
    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:46)
    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)


If I use below sentence
String xmlReq = BatchExecutionHelper.newXStreamMarshaller().toXML(cmd);
The error information is

java.lang.NullPointerException
    at
com.thoughtworks.xstream.io.xml.PrettyPrintWriter.writeText(PrettyPrintWriter.java:203)
    at
com.thoughtworks.xstream.io.xml.PrettyPrintWriter.writeAttributeValue(PrettyPrintWriter.java:195)
    at
com.thoughtworks.xstream.io.xml.PrettyPrintWriter.addAttribute(PrettyPrintWriter.java:190)
    at
com.thoughtworks.xstream.io.WriterWrapper.addAttribute(WriterWrapper.java:41)
    at
org.drools.runtime.help.impl.XStreamXML$InsertConverter.marshal(XStreamXML.java:119)
    at
com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
    at
com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78)
    at
com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63)
    at
com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at
com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:55)
    at
com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
    at
com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78)
    at
com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63)
    at
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:115)
    at
com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129)
    at
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100)
    at
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58)
    at
com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
    at
com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78)
    at
com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63)
    at
com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:98)
    at
com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:38)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:837)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:826)
    at com.thoughtworks.xstream.XStream.toXML(XStream.java:801)
    at com.thoughtworks.xstream.XStream.toXML(XStream.java:789)
    at
org.plugtree.drools.server.DroolsServerTest.testDroolsServer(DroolsServerTest.java:81)
    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:46)
    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)


How can I Marshaller the command?

BR
Xinhua




On Thu, Oct 14, 2010 at 9:50 PM, Xinhua Zhu <xhzhu at it.uts.edu.au> wrote:

> oh, thanks.
>
> If you replace
> address="/kservice/rest"
> with
> address="/rest"
>
> in camel-server.xml
>
> there should be only one "kservice" is ok.
>
> br
> xinhua
>
>
>
> On Thu, Oct 14, 2010 at 5:24 PM, Ji Oh Yoo <jioh.yoo.dev at gmail.com> wrote:
>
>>
>> hmm.. I just found the answer: in camel-client.xml, make your to uri to:
>>
>> <to
>> uri="cxfrs://
>> http://localhost:8080/drools-server-app/kservice/kservice/rest"/>
>> instead of just one "kservice".
>>
>> And I am not sure why the kservice is written twice.
>>
>> --
>> View this message in context:
>> http://drools-java-rules-engine.46999.n3.nabble.com/Question-about-drools-server-tp1698427p1699021.html
>> Sent from the Drools - User 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/20101015/7e15d673/attachment.html 


More information about the rules-users mailing list