Thanks a lot for the help! And it works very well!

 

As the communication between client and the server is based on an xml request/response (in certain format), how to pass in objects that contains other objects? For example, in the sample_request.xml, “Person”, “Result” and “Car” all contains primitive type of fields. What if one of the fields is of complex type? (e.g., “Car” contains a field called “time”, whose class is java.util.Date). How to pass the time value to the server? I’ve tried:

 

  <inFacts>

    <anon-fact>

      <fact class="something.Car">

        <name>saab</name>

        <type>wagon</type>

        <named-fact>

            <id>time</id>

            <fact class="java.util.Date">

                  <fastTime>32875987345</fastTime>         

            </fact>

        </named-fact>       

      </fact>

    </anon-fact>

</inFacts>

 

But it doesn’t work. The server always returns errors like:

com.thoughtworks.xstream.converters.ConversionException: Cannot parse date

 

Thanks,

Jing


From: rules-dev-bounces@lists.jboss.org [mailto:rules-dev-bounces@lists.jboss.org] On Behalf Of David Sinclair
Sent: Monday, February 02, 2009 7:51 PM
To: Rules Dev List
Subject: Re: [rules-dev] Problems when using drools-server

 

The properties file is loaded via the class loader. The DRLs are loaded relative to working directory of the server, or absolute if that is how you specify the file.

On Mon, Feb 2, 2009 at 7:04 PM, Zhang Jing-A52198 <j.zhang@motorola.com> wrote:

Thanks!! It really helps!!! I was using Guvnor M4 with drools-server M5. Now I'm upgrading everything to M5. And it works!!

 

One more question, when I try to build/deploy drools-server from source, where should the drl file be put (e.g., the properties file contains: file=test_rules1.drl)? I know that the rule agent configurations are to be placed in the "resources" directory. Should the drl file be put in the same dir? Or a specific place?

 

Thanks,

Jing

 


From: rules-dev-bounces@lists.jboss.org [mailto:rules-dev-bounces@lists.jboss.org] On Behalf Of David Sinclair
Sent: Monday, February 02, 2009 5:30 PM


To: Rules Dev List
Subject: Re: [rules-dev] Problems when using drools-server

 

Sorry, I should have stated that differently. The version you are getting from Guvnor, is different than the version the execution server has. Which version did u compile you packages on guvnor with?

On Mon, Feb 2, 2009 at 6:10 PM, Zhang Jing-A52198 <j.zhang@motorola.com> wrote:

In addition, I've changed testservice.properties as:

 

newInstance=true

url=http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/something/LATEST

 

Thanks a lot for your help!!!

 

Jing

 


From: rules-dev-bounces@lists.jboss.org [mailto:rules-dev-bounces@lists.jboss.org] On Behalf Of Zhang Jing-A52198
Sent: Monday, February 02, 2009 4:39 PM
To: Rules Dev List
Subject: RE: [rules-dev] Problems when using drools-server

 

The client file is as:

 

import java.io.*;

import java.net.*;

 

public class DroolsClient {

            public static void main(String[] args) {

 

                        try {

                                   

                                    InputStream inXML = DroolsClient.class.getResourceAsStream("sample_request.xml");

                                   

                                    URL url = new URL("http://localhost:8080/drools-server/knowledgebase/testservice");

                                    URLConnection conn = url.openConnection();

                                    conn.setDoOutput(true);

                                    // conn.setRequestProperty(key, value);

                                   

                                    BufferedReader in = new BufferedReader(new InputStreamReader(inXML));

                                   

                                    DataOutputStream outXML = new DataOutputStream(conn.getOutputStream());

                                   

                                    String requestline;

                                   

                                    while ((requestline = in.readLine()) != null) {

                                                System.out.println(requestline);

                                                outXML.writeBytes(requestline);

                                    }

                                   

                                    in.close();

                                    outXML.flush();

                                    outXML.close();                         

                                                           

                                    BufferedReader response = new BufferedReader(new InputStreamReader(conn.getInputStream()));

 

                                    String responseLine;

                                   

                                    while ((responseLine = response.readLine()) != null) {

                                                System.out.println(responseLine);

                                    }

                                   

                                    response.close();

                                   

                        } catch (MalformedURLException ex) {

                                   

                        } catch (IOException ex) {

                                   

                        }

            }

 

}

 

How to make it consistent to the drools-server?

 

Thanks,

Jing

 


From: rules-dev-bounces@lists.jboss.org [mailto:rules-dev-bounces@lists.jboss.org] On Behalf Of David Sinclair
Sent: Monday, February 02, 2009 4:26 PM
To: Rules Dev List
Subject: Re: [rules-dev] Problems when using drools-server

 

Looks like the version of drools on your server is different than your client. That would explain the class version issue

On Mon, Feb 2, 2009 at 5:19 PM, Zhang Jing-A52198 <j.zhang@motorola.com> wrote:

Hi All,

 

When I access the drools-server by URLConnection, I've always got such errors:

 

WARNING: RuleAgent(default) EXCEPTION (Mon Feb 02 16:09:46 CST 2009): org.drools.base.BaseEvaluator; local class incompatible: stream classdesc serialVersionUID = -7767879457606879276, local class serialVersionUID = -7149415669283058142. Stack trace should follow.

WARNING: java.io.InvalidClassException: org.drools.base.BaseEvaluator; local class incompatible: stream classdesc serialVersionUID = -7767879457606879276, local class serialVersionUID = -7149415669283058142

                at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:562)

                at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)

                at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)

                at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)

                at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)

                at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)

                at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)

                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)

                at org.drools.rule.LiteralRestriction.readExternal(LiteralRestriction.java:66)

                at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)

                at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)

                at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)

                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)

                at org.drools.rule.LiteralConstraint.readExternal(LiteralConstraint.java:67)

                at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)

                at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)

                at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)

                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)

                at java.util.ArrayList.readObject(ArrayList.java:593)

                at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)

                at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)

                at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)

                at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)

                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)

                at org.drools.rule.Pattern.readExternal(Pattern.java:115)

                at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)

                at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)

                at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)

                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)

                at java.util.ArrayList.readObject(ArrayList.java:593)

                at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)

                at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)

                at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)

                at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)

                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)

                at org.drools.rule.GroupElement.readExternal(GroupElement.java:57)

                at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)

                at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)

                at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)

                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)

                at org.drools.rule.Rule.readExternal(Rule.java:170)

                at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)

                at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)

                at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)

                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)

                at java.util.HashMap.readObject(HashMap.java:1029)

                at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)

                at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)

                at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)

                at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)

                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)

                at org.drools.rule.MVELDialectRuntimeData.readExternal(MVELDialectRuntimeData.java:42)

                at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)

                at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)

                at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)

                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)

                at java.util.HashMap.readObject(HashMap.java:1030)

                at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)

                at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)

                at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)

                at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)

                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)

                at org.drools.rule.DialectRuntimeRegistry.readExternal(DialectRuntimeRegistry.java:41)

                at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)

                at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)

                at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)

                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)

                at org.drools.rule.Package.readExternal(Package.java:197)

                at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)

                at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)

                at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)

                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)

                at org.drools.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:189)

                at org.drools.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:158)

                at org.drools.agent.HttpClientImpl.fetchPackage(HttpClientImpl.java:47)

                at org.drools.agent.URLScanner.readPackage(URLScanner.java:148)

                at org.drools.agent.URLScanner.getChangeSet(URLScanner.java:120)

                at org.drools.agent.URLScanner.loadPackageChanges(URLScanner.java:96)

                at org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:410)

                at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:362)

                at org.drools.agent.RuleAgent.configure(RuleAgent.java:347)

                at org.drools.agent.RuleAgent.init(RuleAgent.java:247)

                at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:187)

                at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:147)

                at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:256)

                at org.drools.server.KnowledgeStatelessServlet.getRuleBase(KnowledgeStatelessServlet.java:109)

                at org.drools.server.KnowledgeStatelessServlet.doPost(KnowledgeStatelessServlet.java:71)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)

                at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)

                at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)

                at

WARNING: org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)

                at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)

                at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)

                at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)

                at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)

                at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)

                at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)

                at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)

                at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)

                at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)

                at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)

                at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)

                at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)

                at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)

                at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)

                at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)

                at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)

                at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)

                at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)

                at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)

                at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)

                at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

 

WARNING: java.lang.NullPointerException

                at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:363)

                at org.drools.agent.RuleAgent.configure(RuleAgent.java:347)

                at org.drools.agent.RuleAgent.init(RuleAgent.java:247)

                at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:187)

                at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:147)

                at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:256)

                at org.drools.server.KnowledgeStatelessServlet.getRuleBase(KnowledgeStatelessServlet.java:109)

                at org.drools.server.KnowledgeStatelessServlet.doPost(KnowledgeStatelessServlet.java:71)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)

                at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)

                at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)

                at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)

                at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)

                at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)

                at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)

                at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)

                at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)

                at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)

                at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)

                at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)

                at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)

                at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)

                at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)

                at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)

                at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)

                at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)

                at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)

                at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)

                at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)

                at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)

                at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)

                at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)

                at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

 

 

 

Can anyone help me to fix this problem? I've got the same errors when trying to run KnowledgeServiceServletTest.java from the drool-server source code.

 

Thanks,

Jing


_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev

 


_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev

 


_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev