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(a)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(a)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(DelegatingMethodAccessor
Impl.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(DelegatingMethodAccessor
Impl.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(DelegatingMethodAccessor
Impl.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(MVELDialectRuntimeDa
ta.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(DelegatingMethodAccessor
Impl.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(DialectRuntimeRegist
ry.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(KnowledgeStatele
ssServlet.java:109)
at
org.drools.server.KnowledgeStatelessServlet.doPost(KnowledgeStatelessSer
vlet.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(Applicati
onFilterChain.java:411)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:317)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:198)
at
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFi
lter.java:390)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:230)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:198)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:288)
at
WARNING:
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCon
textValve.java:271)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.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:5
71)
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:5
71)
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.invokeAdap
ter(DefaultProcessorTask.java:637)
at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(
DefaultProcessorTask.java:568)
at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(De
faultProcessorTask.java:813)
at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcesso
rTask(DefaultReadTask.java:341)
at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultR
eadTask.java:263)
at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultR
eadTask.java:214)
at
com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(Po
rtUnificationPipeline.java:380)
at
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at
com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWork
erThread.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(KnowledgeStatele
ssServlet.java:109)
at
org.drools.server.KnowledgeStatelessServlet.doPost(KnowledgeStatelessSer
vlet.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(Applicati
onFilterChain.java:411)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:317)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:198)
at
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFi
lter.java:390)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:230)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:198)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:288)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCon
textValve.java:271)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.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:5
71)
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:5
71)
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.invokeAdap
ter(DefaultProcessorTask.java:637)
at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(
DefaultProcessorTask.java:568)
at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(De
faultProcessorTask.java:813)
at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcesso
rTask(DefaultReadTask.java:341)
at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultR
eadTask.java:263)
at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultR
eadTask.java:214)
at
com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(Po
rtUnificationPipeline.java:380)
at
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at
com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWork
erThread.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(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev