Enlisted 是我用来从 Guvnor 读取规则的方式,用于验证用户给出的输入 1. 为用户形成 GUI 的 Web 应用程序(Tomcat v7.0 服务器) 2. Web 服务(JBoss EAP 6.0) 使用 drools API 从 Guvnor 读取规则并将它们公开为 Web 服务 3. Guvnor(Jboss AS 7) 作为规则的存储库。
当我尝试提交表单(网络应用程序)时,我在控制台上收到以下错误:-
INFO [stdout] (Thread-77) [2012:10:296 10:10:504:info] KnowledegAgent has started listening for ChangeSet notifications
10:52:17,800 INFO [stdout] (http-localhost/127.0.0.1:8180-1) (null: 5, 174): cvc-elt.1: Cannot find the declaration of element 'change-set'.
10:52:17,831 INFO [stdout] (http-localhost/127.0.0.1:8180-1) [2012:10:296 10:10:831:info] KnowledgAgent applying ChangeSet
10:52:17,831 INFO [stdout] (http-localhost/127.0.0.1:8180-1) [2012:10:296 10:10:831:debug] KnowledgeAgent subscribing to resource=[UrlResource path='http://localhost:8080/jboss-brms/org.drools.guvnor.Guvnor/package/DroolsPackage/LATEST']
10:52:17,831 INFO [stdout] (http-localhost/127.0.0.1:8180-1) [2012:10:296 10:10:831:debug] ResourceChangeNotification subscribing listener=org.drools.agent.impl.KnowledgeAgentImpl@295b9a to resource=[UrlResource path='http://localhost:8080/jboss-brms/org.drools.guvnor.Guvnor/package/DroolsPackage/LATEST']
10:52:17,831 INFO [stdout] (http-localhost/127.0.0.1:8180-1) [2012:10:296 10:10:831:debug] ResourceChangeScanner subcribing notifier=org.drools.io.impl.ResourceChangeNotifierImpl@13d0493 to resource=[UrlResource path='http://localhost:8080/jboss-brms/org.drools.guvnor.Guvnor/package/DroolsPackage/LATEST']
10:52:17,831 INFO [stdout] (http-localhost/127.0.0.1:8180-1) [2012:10:296 10:10:831:debug] KnowledgeAgent ChangeSet requires KnowledgeBuilder
10:52:17,831 INFO [stdout] (http-localhost/127.0.0.1:8180-1) [2012:10:296 10:10:831:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
10:52:17,831 INFO [stdout] (http-localhost/127.0.0.1:8180-1) [2012:10:296 10:10:831:debug] KnowledgeAgent building resource=[UrlResource path='http://localhost:8080/jboss-brms/org.drools.guvnor.Guvnor/package/DroolsPackage/LATEST']
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) [2012:10:296 10:10:955:exception]
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) java.lang.RuntimeException: KnowledgeAgent exception while trying to deserialize KnowledgeDefinitionsPackage
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:418)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:120)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:109)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at com.test.drools.ExposeDroolsWebService.checkedColor(ExposeDroolsWebService.java:50)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at java.lang.reflect.Method.invoke(Method.java:597)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:194)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
10:52:17,955 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
10:52:17,971 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
10:52:17,971 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679)
10:52:17,971 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931)
10:52:17,971 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at java.lang.Thread.run(Thread.java:662)
10:52:17,971 INFO [stdout] (http-localhost/127.0.0.1:8180-1) Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:8080/jboss-brms/org.drools.guvnor.Guvnor/package/DroolsPackage/LATEST
10:52:17,971 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
10:52:17,971 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.drools.io.impl.UrlResource.getInputStream(UrlResource.java:76)
10:52:17,971 INFO [stdout] (http-localhost/127.0.0.1:8180-1) at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:407)
10:52:17,971 INFO [stdout] (http-localhost/127.0.0.1:8180-1) ... 29 more
这是我用于访问规则的代码:-
Resource resource = ResourceFactory
.newClassPathResource("com/test/rules/Color.xml");
KnowledgeAgent kagent = KnowledgeAgentFactory
.newKnowledgeAgent("kagent");
kagent.monitorResourceChangeEvents(true);
kagent.applyChangeSet(resource);
KnowledgeBase kbase = kagent.getKnowledgeBase();
kbase.getKnowledgePackages();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
ksession.insert(colorBean);
ksession.fireAllRules();
System.out.println(colorBean.getColor());
ksession.dispose();
return colorBean;
有人可以帮我解决这个错误。