Help : How do I retrieve the repository or uuid of assets from java code?
by Han Ming Low
Hi,
I'm trying to construct a url in the format
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/Guvnor.html#...
by replacing the #asset=[uuid]
Thus, I would need to know the uuid of each asset in the repository.
I have tried to use the following code
Repository repository;
JCRRepositoryConfigurator configurator = new
JackrabbitRepositoryConfigurator();
repository = configurator.getJCRRepository(
"C:\\Programs\\Drools\\5.1\\jboss-4.2.3.GA\\repository\\" );
Session jcrsession = repository.login(new SimpleCredentials("admin",
"admin1".toCharArray()));
RulesRepository rrepository = new RulesRepository(jcrsession);
or
RulesRepository rrepository = RepositorySessionUtil.getRepository();
My drools persistence is set to MySQL.
So, RepositorySessionUtil.getRepository() kind of work but because it is
retrieving from a new repository, so it does not serve the purpose.
When I put the code above into a jsp in exploded drools-guvnor.war in jboss,
I have the following error.
org.drools.repository.RulesRepositoryException:
javax.jcr.RepositoryException: The repository home C:\Programs\Drools\5.1\
jboss-4.2.3.GA\bin\repository appears to be in use since the file named
.lock is already locked by the current process.
org.drools.repository.RepositorySessionUtil.getRepository(RepositorySessionUtil.java:90)
org.apache.jsp.test_jsp._jspService(test_jsp.java:105)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.seam.web.ContextFilter$1.process(ContextFilter.java:42)
org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:53)
org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:37)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
But, I'm not even sure if what I'm trying to do is correct.
What I want to do is to be able to retrieve the uuid of the assets in
repository from a web application.
Can someone please help in providing a snippet of code or point me in some
direction on what should I retrieve in order to query the repository.
Thanks.
Han Ming
14 years, 2 months
java.lang.RuntimeException: Unable to load session snapshot
by Gustavo Tenrreiro
Hi,
I am using JPA session persistance. Everything is working fine, then a
rule fires that detects an Event, and after that trying to recreate
the session fails with a:
Caused by: java.lang.RuntimeException: Unable to load session snapshot
at org.drools.persistence.session.JPASessionMarshallingHelper.loadSnapshot(JPASessionMarshallingHelper.java:96)
Can anyone help me with this ?
Thanks
14 years, 2 months
Re: [rules-users] RuleFlowProcessFactory - no XML output?
by Jeff Parks
I should have mentioned that I am using Drools 5.1.1
From: Jeff Parks [mailto:jeff.parks@comcast.net]
Sent: Tuesday, August 31, 2010 4:33 PM
To: 'rules-users(a)lists.jboss.org'
Subject: RuleFlowProcessFactory - no XML output?
I like the idea of creating a Drools Process via the Process API. It fits my
usage model very well . What surprises me is that I have not seen a way to
take the RuleFlowProcess and create a Process in XML format, which I would
think to be a natural extension. I have to think I am missing something -
can someone share me some code snippet that accomplishes my goal?
thanks
14 years, 3 months
Multiple StatefulKnowledgeSessions at a time?
by skasab2s
Hello,
(I'm sorry if this question already has been asked.) My company uses Drools
for answering questions. For every asked question, a new
StateFulknowledgeSession is created and after the question has been answerd
by Drools, the StateFulknowledgeSession is being disposed. Now we have the
situation that multiple questions can be asked at the same point of time.
That's why we have to decide if we should have only one
StatefulKnowledgeSession at a time (i.e execute the questions sequentially)
or allow parallelism (i.e. have many instances of StateFulknowledgeSession
at one time). Which from the both alternatives would you propose to use? On
what could depend our decision?
Many thanks and best regards,
Svetlomir Kasabov.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Multiple-StatefulKnow...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 3 months
concurrent execution for the first time thorws error
by Sudhir M
Hi,
In our application we have different rulesets which we load them on
demand and cache them (knowledge base) for the sub-sequent requests.
For the first time before caching if we hit the server concurrently we
are getting the following exception which is not very clear.
I assume knowledge bases are thread safe and we can create multiple
stateful sessions using the same knowledege base.
we are using drools 5.1 final release.
java.lang.IllegalArgumentException: org.drools.process.instance.impl
at java.lang.ClassLoader.definePackage(ClassLoader.java:1452)
at java.net.URLClassLoader.definePackage(URLClassLoader.java:348)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1781)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:866)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1319)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
at org.drools.SessionConfiguration.initProcessInstanceManagerFactory(SessionConfiguration.java:302)
at org.drools.SessionConfiguration.getProcessInstanceManagerFactory(SessionConfiguration.java:291)
at org.drools.common.AbstractWorkingMemory.<init>(AbstractWorkingMemory.java:367)
at org.drools.common.AbstractWorkingMemory.<init>(AbstractWorkingMemory.java:295)
at org.drools.common.AbstractWorkingMemory.<init>(AbstractWorkingMemory.java:259)
at org.drools.reteoo.ReteooWorkingMemory.<init>(ReteooWorkingMemory.java:96)
at org.drools.reteoo.ReteooStatefulSession.<init>(ReteooStatefulSession.java:80)
at org.drools.reteoo.ReteooRuleBase.newStatefulSession(ReteooRuleBase.java:386)
at org.drools.reteoo.ReteooRuleBase.newStatefulSession(ReteooRuleBase.java:371)
at org.drools.impl.KnowledgeBaseImpl.newStatefulKnowledgeSession(KnowledgeBaseImpl.java:172)
at org.drools.impl.KnowledgeBaseImpl.newStatefulKnowledgeSession(KnowledgeBaseImpl.java:155)
Please help us in this regard.
Thanks
sudhir.
14 years, 3 months
where to find version 4.2.2GA in svn?
by Alex.Porras@dds.net
Hello,
I purchased a copy of Paul Browne's "JBoss Drools Business Rules", and am
trying to learn Guvnor via the book's examples. However, they are written
for use in drools 4.2.2GA and seem to be incompatible with version 5.1.
So, I am going the "download and build source" route. Browsing the SVN
tree, this seems to be the closest tag to a "4.2.2GA" version I could
find.
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/tags/DROOLS_SOA_4_2_1...
Could someone be so kind as to confirm whether this is the correct tag for
that release, or point me in the right direction?
Regards,
Alex
14 years, 3 months
Grouping of rules in Guvnor GUI
by Swapnil Sawant
Hi,
How can I achieve grouping of rules through Guvnor GUI ?
For example,
Lets say I have created Rule 1 , Rule 2 , Rule 3 and Rule 4 by using "Guvnor GUI only".
Now , I want to group Rule 1 and 2 in "RuleGrp1" and Rule 3 and 4 in "RuleGrp2" using "Guvnor GUI only".
I have heard about "agenda-group" in DRL files. But , I don't wish to write this attribute in DRL files(in other words,I want to avoid writing DRL file manually) and then run the RuleGroup.
I want this whole process of creating and grouping of rules to be done "only using Guvnor" , so that I can point to the resulting binary package URL directly in my changeset.xml and start firing rules in my application.
Can any one pl help me in finding how to achieve this ?
Thanks & Regards,
Swapnil Sawant
________________________________
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.
______________________________________________________________________
14 years, 3 months
Getting rule's body to application.
by tom ska
Hello,
what I want to do, is to get rule's body(rule's code written in DRL). For
example: I have a ConsequenceException, and I can get rule's name, and
package this way:
.
.
.
catch (ConsequenceException e) {
e.getRule().getName();
e.getRule().getPackageName();
}
But for me it is not enough. I want to see rule's code. haw can I get it?
Thanks,
tom.
14 years, 3 months