Drools planner & Scala
by Adam Warski
Hello,
I'm using Planner in a Scala program and it almost works without problems; the only one is in implementing the Solution interface, as it uses raw (erased) version of Score, which is normally generic (Score<S extends Score>). Scala generally doesn't like raw types and in most cases it's impossible to extend/implement interfaces which use them. A work-around is to introduce an "adapter" in Java, which you can later extend in Scala:
public abstract class ScalaSolution implements Solution {
public Score getScore() { return getScoreScala(); }
public abstract Score<?> getScoreScala();
public void setScore(Score score) { setScoreScala(score); }
public abstract void setScoreScala(Score<?> score);
}
and then in Scala:
class Schedule(...) extends ScalaSolution {
var score: Score[_] = _
def setScoreScala(score: Score[_]) = { this.score = score }
def getScoreScala = score
...
}
So the fix is to replace the raw Score type with Score<?>. Maybe it would be possible to apply that in the code? I tried it locally and it compiles without problems.
And a side question: do you have any plans on implementing multithreading in planner? So that several moves could be explored concurrently? I saw there's an open Jira issue for some time, but it didn't have any timeframe information.
--
Adam Warski
http://www.warski.org
http://www.softwaremill.eu
13 years, 8 months
Re: [rules-users] How to modify changeset.xml in guvnor
by kenichiwa
Maybe this will clarify things....
For this code:
...
...
...
String urlString =
"http://localhost:9080/drools-guvnor/org.drools.guvnor.Guvnor/package/defa...";
URL url = new URL(urlString);
KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent("TestAgent");
UrlResource urlResource = (UrlResource)ResourceFactory.newUrlResource(url);
urlResource.setBasicAuthentication("enabled");
urlResource.setUsername("admin");
urlResource.setPassword("");
kagent.applyChangeSet(urlResource);
KnowledgeBase kbase = kagent.getKnowledgeBase();
...
...
...
I am getting this exception:
[12/3/10 15:54:58:059 MST] 0000001d SystemOut O [2010:12:337
15:12:59:debug] KnowledgeAgent building resource map
[12/3/10 15:54:58:059 MST] 0000001d SystemOut O [2010:12:337
15:12:59:info] KnowledgeAgent created, with configuration:
monitorChangeSetEvents=true scanResources=true scanDirectories=true
newInstance=true
[12/3/10 15:54:58:059 MST] 00000027 SystemOut O [2010:12:337
15:12:59:info] KnowledegAgent has started listening for ChangeSet
notifications
[12/3/10 15:54:58:090 MST] 0000001f SystemOut O INFO 03-12 15:54:58,074
(NilAuthenticator.java:authenticate:51) All users are guests.
[12/3/10 15:54:58:090 MST] 0000001f SystemOut O INFO 03-12 15:54:58,090
(RepositoryServlet.java:allowUser:129) admin authenticated for rest api
[12/3/10 15:54:58:090 MST] 0000001f SystemOut O INFO 03-12 15:54:58,090
(PackageDeploymentServlet.java:a:136) PackageName: defaultPackage
[12/3/10 15:54:58:090 MST] 0000001f SystemOut O INFO 03-12 15:54:58,090
(PackageDeploymentServlet.java:a:137) PackageVersion: LATEST
[12/3/10 15:54:58:090 MST] 0000001f SystemOut O INFO 03-12 15:54:58,090
(PackageDeploymentServlet.java:a:138) PackageIsLatest: true
[12/3/10 15:54:58:090 MST] 0000001f SystemOut O INFO 03-12 15:54:58,090
(PackageDeploymentServlet.java:a:139) PackageIsSource: false
[12/3/10 15:55:18:934 MST] 0000001d SystemOut O [2010:12:337
15:12:934:info] KnowledgeAgent applying ChangeSet
[12/3/10 15:55:18:934 MST] 0000001d SystemOut O [2010:12:337
15:12:934:debug] KnowledgeAgent notifier subscribing to
resource=[UrlResource
path='http://localhost:9080/drools-guvnor/org.drools.guvnor.Guvnor/package/defa...']
[12/3/10 15:55:18:934 MST] 0000001d SystemOut O [2010:12:337
15:12:934:debug] ResourceChangeNotification subscribing
listener=org.drools.agent.impl.KnowledgeAgentImpl@3cec3cec to
resource=[UrlResource
path='http://localhost:9080/drools-guvnor/org.drools.guvnor.Guvnor/package/defa...']
[12/3/10 15:55:18:949 MST] 0000001d SystemOut O [2010:12:337
15:12:949:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O [2010:12:337
15:12:965:exception]
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O
java.lang.RuntimeException: KnowledgeAgent exception while trying to
deserialize KnowledgeDefinitionsPackage
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:664)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:889)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:704)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:584)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:185)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:168)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
com.mycompany.myapp.test.controllers.TestDroolsController.testDrools(TestDroolsController.java:41)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
java.lang.reflect.Method.invoke(Method.java:600)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:471)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:408)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
[12/3/10 15:55:18:965 MST] 0000001d SystemOut O at
javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1661)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1595)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.ui.preauth.AbstractPreAuthenticatedProcessingFilter.doFilterHttp(AbstractPreAuthenticatedProcessingFilter.java:69)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:932)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:500)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O Caused by:
java.io.IOException: Server returned HTTP response code: 401 for URL:
http://localhost:9080/drools-guvnor/org.drools.guvnor.Guvnor/package/defa...
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1308)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.drools.io.impl.UrlResource.grabStream(UrlResource.java:210)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.drools.io.impl.UrlResource.getInputStream(UrlResource.java:146)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:652)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O ... 63 more
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O [2010:12:337
15:12:980:debug] KnowledgeAgent obtaining pkg resource=[UrlResource
path='http://localhost:9080/drools-guvnor/org.drools.guvnor.Guvnor/package/defa...']
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O [2010:12:337
15:12:980:exception]
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O
java.lang.RuntimeException: KnowledgeAgent exception while trying to
deserialize KnowledgeDefinitionsPackage
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:914)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:704)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:584)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:185)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:168)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.mycompany.myapp.test.controllers.TestDroolsController.testDrools(TestDroolsController.java:41)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
java.lang.reflect.Method.invoke(Method.java:600)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:471)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:408)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1661)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1595)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.ui.preauth.AbstractPreAuthenticatedProcessingFilter.doFilterHttp(AbstractPreAuthenticatedProcessingFilter.java:69)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:932)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:500)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O Caused by:
java.lang.NullPointerException
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O at
org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:906)
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O ... 62 more
[12/3/10 15:55:18:980 MST] 0000001d SystemOut O [2010:12:337
15:12:980:info] KnowledgeAgent new KnowledgeBase now built and in use
[12/3/10 15:55:18:996 MST] 0000001d SystemOut O [2010:12:337
15:12:996:debug] KnowledgeAgent finished rebuilding KnowledgeBase using
ChangeSet
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/How-to-modify-changes...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 8 months
Problem persisting human tasks
by raic
Hi,
I'm having problems using drools flow persistance with human tasks. I'm
using drools server.
On one hand, I have my test application, which starts a MinaTaskServer for
registering human tasks, and then, the application generates JSON commands
for executing a flow with human tasks on the execution server.
Without using flow persistence, this is working ok, i'm able to retrieve the
pending tasks and completing them without problems.
When I try to configure flow persistence on the execution server, i can
start the process, the tasks are registered ok and drools flow tables are
generated in my database (processinstanceinfo,sessioninfo,workiteminfo...)
with the correct flow information. The problem appears when i retrieve a
pending task, and then, i want to complete it. It seems that the
communication between MinaTaskServer and ExecutionServer is not ok.
The error i'm getting is the following:
[2010:11:327 18:11:661:debug] Message receieved on client :
EventTriggerResponse
[2010:11:327 18:11:661:debug] Arguments :
[org.drools.task.event.EventPayload@1b2df13]
Task completed 1
[2010:11:327 18:11:661:debug] Message receieved on client :
EventTriggerResponse
[2010:11:327 18:11:661:debug] Arguments :
[org.drools.task.event.EventPayload@1f7c6e1]
Task completed 1
[2010:11:327 18:11:770:debug] Message receieved on client : GetTaskResponse
[2010:11:327 18:11:770:debug] Arguments : [org.drools.task.Task@d17fbb51]
[2010:11:327 18:11:770:exception] Uncaught exception on client
java.lang.IllegalStateException: EntityManager is closed
at org.hibernate.ejb.EntityManagerImpl.getSession(EntityManagerImpl.java
:66)
at
org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:182)
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.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:358)
at $Proxy132.find(Unknown Source)
at
org.drools.persistence.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:88)
at
org.drools.process.workitem.wsht.WSHumanTaskHandler$GetCompletedTaskResponseHandler.execute(WSHumanTaskHandler.java:250)
at
org.drools.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:80)
at
org.drools.task.service.mina.MinaTaskClientHandler.messageReceived(MinaTaskClientHandler.java:47)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:713)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)
at
org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:375)
at
org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:229)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)
at
org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:638)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:598)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:587)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:61)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:969)
at
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source)
at java.lang.Thread.run(Unknown Source)
And here is my configuration:
knowledge-services.xml (spring configuration)
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:drools="http://drools.org/schema/drools-spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://drools.org/schema/drools-spring
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-containe...">
<bean id="ds"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/drools_flow" />
<property name="username" value="user" />
<property name="password" value="pass" />
</bean>
<drools:connection id="connection1" type="local" />
<drools:execution-node id="node1" connection="connection1" />
<drools:kbase id="kbProcessWorkItems" node="node1">
<drools:resources>
<drools:resource type="CHANGE_SET"
source="classpath:changeset.xml"/>
</drools:resources>
</drools:kbase>
<bean id="myEmf"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="ds" />
<property name="persistenceUnitName"
value="org.drools.persistence.jpa.local" />
</bean>
<bean id="txManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="myEmf" />
</bean>
<drools:kstore id="kstore1" />
<drools:ksession id="ksession1" type="stateful" kbase="kbProcessWorkItems"
node="node1">
<drools:configuration>
<drools:jpa-persistence>
<drools:transaction-manager ref="txManager" />
<drools:entity-manager-factory ref="myEmf" />
<drools:variable-persisters>
<drools:persister for-class="javax.persistence.Entity"
implementation="org.drools.persistence.processinstance.persisters.JPAVariablePersister"/>
</drools:variable-persisters>
</drools:jpa-persistence>
</drools:configuration>
</drools:ksession>
</beans>
And here my persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd">
<persistence-unit name="org.drools.persistence.jpa.local"
transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>org.drools.persistence.session.SessionInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.processinstance.WorkItemInfo</class>
<class>org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo</class>
<class>org.drools.persistence.processinstance.variabletypes.JPAPersistedVariable</class>
<!-- my persistent variables -->
<class>com.sample.bussiness.model.ClientModel</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQL5Dialect"/>
<property name="hibernate.max_fetch_depth" value="3" />
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.show_sql" value="false" />
</properties>
</persistence-unit>
</persistence>
I've seen some examples that uses bitronix but i'm not using it, i don't
know if that is the problem...
Some ideas?
Thanks
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Problem-persisting-hu...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 8 months
How to specify relative URL in chagenset.xml file
by Pardeep Ruhil
Hi,
I am getting File Not Found Exception when I try to give relative path of the file.
<resource source='file:../HelloWorld.drl' type='DRL' />
But when I give the complete path, It picks the changeset.xml file.
<resource source='file:C:/Tomcat/webapps/DroolsCheck/HelloWorld.drl' type='DRL' />
Please tell me the syntax for using the relative path for my workflow or rule files.
Thanks & Regards
Pradeep Ruhil
________________________________
This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.
______________________________________________________________________
13 years, 8 months
taskService restart problem (urgent response needed)
by KiranP
i m having 2-3 tasks in my flow the flow works fine in the normal conditions
the tasks are handled by the MinaTaskServer and MinaTaskClient but the
problem is that it uses the command and the call back mechanism using the
map of tasks request (if i m not wrong) hence when the taskservice restarts
all the callback refrence is lost and completing any task wont updated to
the MinaTaskServer (even if the task is available)
can any one hint me who i can achieve trans-restart task completion.....
till today none of my posts got a reply..............i think u r all
busy............if some one gets time plz help....
bcoz now it has become a grave matter.........it urgent...
thanks
-----
Keep Working >>:working:
KiranP
--
View this message in context: http://n3.nabble.com/taskService-restart-problem-urgent-response-needed-t...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 8 months
Re: [rules-users] Drools 5.1: What happens when an incremental KA rebuild fails?
by Esteban Aliverti
I will check this problem. I'll need to create a test scenario first.
Which version of drools are you using? Does the error still occurrs if you
point to the drl instead of the directory?
Best regards!
El ene 14, 2011 5:14 p.m., "ljnelson" <ljnelson(a)gmail.com> escribió:
Seeing some strange things on a production system.
I have Drools set up to use a KnowledgeAgent.
I have the KnowledgeAgent set up to scan resources and directories.
The agent is pointed at--let's say--C:\LEAD\rules, where "LEAD" is the name
of the project in question and "rules" is a directory underneath which I
would like to have several .drl files.
I begin by placing one well-known, valid .drl file under there. That
obviously loads up fine and the rules go into effect.
If I deliberately introduce a syntax error, I hear about it in the
logs--that's fine too.
But if I then remove the syntax error, it's as though scanning stops. The
KnowledgeAgent appears as though it is never rebuilt again, so it appears
simply to be broken.
I will obviously supply more details as needed, but thought I'd fire this
quick flare to see if anyone knows of any simple cause here.
Best,
Laird
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-5-1-What-happe...
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
13 years, 9 months
Declaring events separately from rules breaks expires
by Samuli Saarinen
Hello,
I have the following situation with Drools 5.1.1: 2 drl files where one
contains an event declaration:
declare Event1
@role(event)
@expires(1s)
end
and other has a simple rule:
rule "Evt1"
when
e: Event1(value == 10)
then
System.out.println(e);
end
And I have the following test which fails:
ses.insert(new Event1(1));
ses.fireAllRules();
clock.advanceTime(2, TimeUnit.SECONDS);
ses.fireAllRules();
assertEquals(ses.getFactCount(), 0L);
The same test passes if the rule and event declaration are on the same
drl file.
Further more if I declare the event in both of the files with different
@expires the one being used is the one that is added first. I was hoping
that the first declaration to be a "default expires" that could be
overwritten later on with a new declaration but it seems that this is
currently not possible.
Cheers,
Samuli
--
Remion Oy Etävalvontajärjestelmät liiketoiminnan
Samuli Saarinen tehostamiseen
gsm +358 (0)50 3560075
fax +358 (0)3 2125064 www.remion.com
13 years, 9 months
Instructions for upgrading designer.war?
by Han Ming Low
Hi,
I understand that the designer.war is a project by intalio.
When looking at the source for the war at
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/contrib/designer/desi...,
I saw the changes to be made to make it compatible with Drools.
I think I can do some of the steps like
1) changing the web.xml to use tomcat instead of jetty
2) added slf4j library
3) move lib/bpmn2 library to web-inf/lib
4) changes to oryx.js that involve
- commenting out the header
- commenting out the log
- change the repository url from "/designer/uuidRepository?uuid="+ uuid to
"/drools-guvnor/org.drools.guvnor.Guvnor/guvnorAPI?action=load&uuid="+ uuid
However, I'm not sure what is the BPMN2 import/export classes to replace in
WEB-INF/classes
Can someone could tell me which are the classes?
I can also help to update the designer. :)
Thanks.
Han Ming
13 years, 9 months
How to write a rule that fires when it matches against specific facts in working memory.
by groovenarula
Hello,
I have a fact called 'Option' :
public class Option {
private String code;
private Item item;
public String getCode() {
return code;
}
public void setCode(String optionCode) {
this.code = optionCode;
}
At any point in time, the working memory can have several Option instances
with different code values. My rules need to fire specifically when the
working memory contains a specific set of options. e.g. Rule 1 should fire
if and only if the working memory contains 2 option instances one with code
"P1" and the other with "P2" (order should not matter).
I tried to use 'forall' as follows :
rule "Matched Options"
when
forall (
Option ( code == "P1" || code == "P2" )
)
then
//insert( new IsPriced( i ) );
System.out.println ( "Priced using G/S ");
end
However, the rule above never fires. Maybe I should be taking a different
approach. I'm still learning through how to create rules. So any
help/suggestions on how to tackle the above will be appreciated.
Thanks
Gurvinder
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/How-to-write-a-rule-t...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months
timer and duration
by OlliSee
Hello there.
I seem to have trouble with the "timer" operator which is documented to have
superseded the "duration" operator for use in the rule body. I might have
something to do with the "not" operator I use in my rule.
Scenario: A is a fact, B is an event
When I write something like this
rule "test"
timer(int: 5s 5s)
when
$a : A()
not (exists B(a == $a))
then
insert(new B($a)); // which means in the new B object: B.a
= $a
end
I expect this rule to fire every 5 seconds if and only if the LHS is true.
I just insert a few A objects at the beginning.
So I expect this rule to fire ONCE, because it will insert the B event which
makes this rule's LHS evaluate to false in the future.
BUT, reality is, this rule fires every 5 seconds, no matter what.
Using the deprecated duration operator with "duration(5s)" instead of the
timer operator, it works as expected.
I assume, that timer works differently compared to duration. So I conclude
that duration should coexist. Or am I missing something here on the usage of
the timer operator?
Thanks in advance.
Oliver
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/timer-and-duration-tp...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months