unable to update the changes (guvnor rules) to application using changeset
by srinivasasanda
Hi All
I am not able to get the updated rules still i used change set , can any one
plz sort out this problem
The source code is
using this program i am printing the rule name in package for every five
seconds.
for first time it prints rule names in package, after that packages are not
available in kbase...
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseFactory;
import org.drools.agent.KnowledgeAgent;
import org.drools.agent.KnowledgeAgentFactory;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderError;
import org.drools.builder.KnowledgeBuilderErrors;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.definition.KnowledgePackage;
import org.drools.io.ResourceChangeScannerConfiguration;
import org.drools.io.ResourceFactory;
import org.drools.logger.KnowledgeRuntimeLogger;
import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.StatelessKnowledgeSession;
import org.drools.agent.*;
public class ChangeSet1
{
private ChangeSet1()
{
}
public static synchronized ChangeSet1 start()
{
try{
if ( _instance == null)
{
_instance = new ChangeSet1();
String url="file:H:\\RuleFiles\\ChangeSet.xml";
_kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyAgent" );
System.out.println("after creating kagent");
_kagent.applyChangeSet(ResourceFactory.newUrlResource(url));
System.out.println("after apply change set");
//Create Knowledge Base
_kbase = _kagent.getKnowledgeBase();
ResourceChangeScannerConfiguration sconf=
ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
sconf.setProperty("drools.resource.scanner.interval", "5");
ResourceFactory.getResourceChangeScannerService().configure(sconf);
ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();
System.out.println("After starting Notification service");
}
}catch(Exception e)
{
System.out.println(e.getMessage());
}
return _instance;
}
private static KnowledgeAgent _kagent;
private static ChangeSet1 _instance;
private static KnowledgeBase _kbase=null;
private static StatelessKnowledgeSession _ksession=null;
public static void main(String[] args)
{
int counter=0;
try
{
System.out.println("Before rule engine start ");
ChangeSet1.start();
System.out.println("After rule engine start ");
do{
_kbase = _kagent.getKnowledgeBase();
Collection<KnowledgePackage> kpackages =
_kbase.getKnowledgePackages();
System.out.println("no of packages"+kpackages.size());
for(KnowledgePackage kpackage : kpackages)
{
for(org.drools.definition.rule.Rule rule1
:kpackage.getRules())
{
String packname= rule1.getPackageName();
String rulename=rule1.getName();
System.out.println("This is : "+packname+" Packages and
RuleName is " +rulename);
}
}
counter++;
try{
Thread.sleep(10000);
}catch (InterruptedException e){
System.out.println("Sleep exception occured");
}
}while(counter < 10000);
}catch (Throwable t){
t.printStackTrace();
}
}
}
This is my changeset.xml
<change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/...'
>
<add>
<resource
source='http://localhost:8080/guvnor-5.3.0.Final-jboss-as-5.1/rest/packages/prici...'
type='DRL' />
<resource
source='http://localhost:8080/guvnor-5.3.0.Final-jboss-as-5.1/rest/packages/searc...'
type='DRL' />
</add>
</change-set>
Output:--
Before rule engine start
after creating kagent
after apply change set
After starting Notification service
After rule engine start
no of packages2
This is : pricing Packages and RuleName is ageprice
This is : pricing Packages and RuleName is incomeprice
This is : pricing Packages and RuleName is cpvprice
This is : search Packages and RuleName is age
This is : search Packages and RuleName is income
This is : search Packages and RuleName is cpv
no of packages0
<after updating package count is 0 so no rules>
no of packages0
no of packages0
--
View this message in context: http://drools.46999.n3.nabble.com/unable-to-update-the-changes-guvnor-rul...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Building Guvnor - Required Java version?
by Stephen Masters
Hi folks,
Having grabbed Guvnor from github and switched to the 5.3.1.Final tag, I'm getting test failures when in the IDE project. Now, I' am admittedly building with Java 1.7.0_02, so that may be the issue. Has anybody else tried building with Java 7? Did you experience success/failure in doing so?
I'm just wondering whether I need to install a version of Java 6 just to get this building or whether the issue is likely to be something else.
Many thanks,
Steve
p.s. Build summary below...
[INFO] Reactor Summary:
[INFO]
[INFO] Guvnor multiproject ............................... SUCCESS [0.933s]
[INFO] Guvnor repository connector multiproject .......... SUCCESS [0.126s]
[INFO] Guvnor repository connector JCR ................... SUCCESS [2.029s]
[INFO] Guvnor repository connector Jackrabbit ............ SUCCESS [1.132s]
[INFO] Guvnor repository connector ModeShape ............. SUCCESS [1.301s]
[INFO] Guvnor repository ................................. SUCCESS [8:22.963s]
[INFO] Drools and jBPM IDE common ........................ FAILURE [15.296s]
[INFO] Guvnor web application ............................ SKIPPED
[INFO] Guvnor bulk importer .............................. SKIPPED
[INFO] Guvnor examples ................................... SKIPPED
12 years, 10 months
Re: [rules-users] AUTO MIGRATION Error when creating a new rule package
by the_ricker
I am attempting to use an existing Jackrabbit repository. To do so, I have
added a simple repository confuigurator as follows:
public class GuvnorCrxDavConfigurator extends JCRRepositoryConfigurator {
public GuvnorCrxDavConfigurator() {
log.info("Creating CRX configurator.");
defaultJCRImplClass = RepositoryFactoryImpl.class.getName();
}
@Override
public Repository getJCRRepository(Properties properties) throws
RepositoryException {
log.info("Creating CRX client repository.");
try {
String url = null;
if (properties != null) {
url = properties.getProperty(REPOSITORY_URL);
}
if (url == null) {
url = DEFAULT_URL;
}
log.info("Repository URL is " + url);
repository = JcrUtils.getRepository(url);
if (repository != null) {
log.info("Client repository created.");
} else {
log.error("Repository NOT created.");
}
return repository;
} catch (Exception e) {
throw new RepositoryException(e);
}
}
public Session login(String userName) throws RepositoryException {
log.info("Attempted login with username " + userName);
System.out.println("Logging in with username " + userName);
Credentials credentials = new SimpleCredentials(userName,
"password".toCharArray());
return repository.login(credentials);
}
@Override
public Session login(String userName, String password) throws
RepositoryException {
log.info("Attempted login with username " + userName + " and password " +
password);
System.out.println("Logging in with username " + userName + " and password
" + password);
return super.login(userName, password);
}
public void registerNodeTypesFromCndFile(String cndFileName, Session
session, Workspace workspace)
throws RepositoryException {
log.info("Manually load CND files to CRX");
}
/**
* {@inheritDoc}@see
* org.drools.repository.JCRRepositoryConfigurator#shutdown()
*/
public void shutdown() {
if (repository instanceof TransientRepository) {
((TransientRepository) repository).shutdown();
}
}
}
And I have registered the new configurator in
<component name="repositoryConfiguration">
<property name="properties">
<key>org.drools.repository.configurator</key>
<value>com.statestreet.rxp3.pilot.guvnor.GuvnorCrxDavConfigurator</value>
<key>org.apache.jackrabbit.repository.uri</key>
<value>http://localhost:7402/crx/server</value>
<key>org.drools.repository.admin.username</key>
<value>guvnor</value>
<key>org.drools.repository.admin.password</key>
<value>guvnor</value>
</property>
</component>
The root nodes are created in the repository, but then somewhere in the auto
migration process, it barfs.
I guess I am new territory here.
--
View this message in context: http://drools.46999.n3.nabble.com/AUTO-MIGRATION-Error-when-creating-a-ne...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
AUTO MIGRATION Error when creating a new rule package
by Jeffrey Ricker
I am deploying Guvnor 5.3.0.Final on Tomcat 7.
I get the following error when I launch a new install. Has anyone seen this before? Is there a workaround?
INFO: Deploying web application directory guvnor
INFO 24-01 12:49:07,278 (RulesRepositoryConfigurator.java:getInstance:46) Creating an instance of the RulesReposi
toryConfigurator.
Logging in with username guvnor and password guvnor
INFO 24-01 12:49:08,418 (RulesRepositoryConfigurator.java:setupRepository:99) Setting up the repository, registering
node types etc.
INFO 24-01 12:49:09,387 (MigrateDroolsPackage.java:migrate:42) AUTO MIGRATION: Performing drools.package migra
tion...
ERROR 24-01 12:49:09,465 (RulesRepository.java:createPackage:870) Error when creating a new rule package
javax.jcr.ItemNotFoundException: Cannot remove a non-existing property.
at org.apache.jackrabbit.jcr2spi.NodeImpl.setProperty(NodeImpl.java:289)
at org.apache.jackrabbit.jcr2spi.NodeImpl.setProperty(NodeImpl.java:317)
at org.apache.jackrabbit.jcr2spi.NodeImpl.setProperty(NodeImpl.java:303)
at org.drools.repository.RulesRepository.createPackage(RulesRepository.java:851)
at org.drools.repository.RulesRepository.createPackage(RulesRepository.java:793)
at org.drools.repository.RulesRepository.listPackages(RulesRepository.java:1371)
at org.drools.repository.migration.MigrateDroolsPackage.migrate(MigrateDroolsPackage.java:43)
at org.drools.repository.RulesRepository.checkForDataMigration(RulesRepository.java:148)
at org.drools.repository.RulesRepository.<init>(RulesRepository.java:135)
at org.drools.guvnor.server.repository.RepositoryStartupService.create(RepositoryStartupService.java:163)
at org.drools.guvnor.server.repository.RepositoryStartupService.create(RepositoryStartupService.java:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
at org.drools.guvnor.server.repository.RepositoryStartupService_$$_javassist_seam_2.create(RepositoryStartupServ
ice_$$_javassist_seam_2.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
at org.jboss.seam.Component.callComponentMethod(Component.java:2275)
at org.jboss.seam.Component.callCreateMethod(Component.java:2198)
at org.jboss.seam.Component.newInstance(Component.java:2158)
at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:143)
at org.jboss.seam.init.Initialization.init(Initialization.java:744)
at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:36)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Jan 24, 2012 12:49:09 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Jan 24, 2012 12:49:09 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/guvnor] startup failed due to previous errors
INFO 24-01 12:49:09,512 (LoggingHelper.java:info:49) Removing listeners....
Removing all listeners...
Listeners removed...
INFO 24-01 12:49:09,543 (LoggingHelper.java:info:49) Shutting down repository....
INFO 24-01 12:49:09,543 (RulesRepositoryConfigurator.java:shutdown:172) SHUTDOWN RULES CONFIG
(I apologize if this message appears twice. The server said that the first one was rejected.)
Information Classification: General
12 years, 10 months
Need help with a simple predicate
by swaroop
Hi,
Iam trying to upgrade to 5.3.1 final from Drools 5.1 during the process came
across an issue where a simple rule detailed below has an issue when
migrating with respect to the "grade contains("A") || grade contains("B") ||
grade contains("C")" part, This was working in Drools 5.1, any inputs as in
how to restructure this will be helpful
rule "Some - Definitions"
when
$comp : Company()
$emp:Employee(grade contains("A") || grade contains("B") || grade
contains("C"))
then
System.out.println("EMployee is an operations executive");
end
Thanks
Swaroop
--
View this message in context: http://drools.46999.n3.nabble.com/Need-help-with-a-simple-predicate-tp368...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
drools with infinispan
by Apache Zoom
Hi,
Is there an example where thr working memory can point to an infinispan cache to query objects in drl files ? If not, can someone please post a working snippet of code on git hub or something ? I am ideally planning on using apache camel for this .
12 years, 10 months
changeset schema error
by domingo
I have some issues using changeset...
*Test - 1*
<change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set
drools-change-set-5.0.xsd'>
<add>
<resource source='classpath:dir1/dir2/filename.drl' type='DRL' />
</add>
</change-set>
when i use the above changeset (thanks to user forum)...the program works
fine no issues but i got the following warning messages...
(null: 1, 201): schema_reference.4: Failed to read schema document
'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the
document could not be read; 3) the root element of the document is not
<xsd:schema>.
(null: 1, 201): cvc-elt.1: Cannot find the declaration of element
'change-set'.
(null: 1, 207): schema_reference.4: Failed to read schema document
'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the
document could not be read; 3) the root element of the document is not
<xsd:schema>.
(null: 1, 285): schema_reference.4: Failed to read schema document
'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the
document could not be read; 3) the root element of the document is not
<xsd:schema>.
(null: 1, 374): schema_reference.4: Failed to read schema document
'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the
document could not be read; 3) the root element of the document is not
<xsd:schema>.
(null: 1, 446): schema_reference.4: Failed to read schema document
'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the
document could not be read; 3) the root element of the document is not
<xsd:schema>.
(null: 1, 534): schema_reference.4: Failed to read schema document
'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the
document could not be read; 3) the root element of the document is not
<xsd:schema>.
*Question: how to get rid of this? I completely google the web including
user forum no answer.If it is available in the forum, my apologies for
missing that info...some one could forward me to that info location.*
*Test - 2*
<change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/...'
>
<add>
<resource source='classpath:dir1/dir2/filename.drl' type='DRL' />
</add>
</change-set>
when i use the above changeset (grepcode drools-compiler 5.2.1
Final)...after 1 minute it gives the following error message and the thread
is open for ever...nothing happen.
INFO: KnowledgeDefinitionBuilder::::: changeset == <change-set
xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/...'
> <add> <resource source='classpath:dir1/dir2/filename.drl' type='DRL' />
</add> </change-set>
(null: 1, 285): schema_reference.4:
Failed to read schema document
'http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/...',
because 1) could not find the document; 2) the document could not be read;
3) the root element of the document is not <xsd:schema>.
(null: 1, 285): cvc-elt.1: Cannot find the declaration of element
'change-set'.
*Question: I copied the schemaLocation from the src, why it is not working?
please advise me?*
-----
with kind regards,
--
View this message in context: http://drools.46999.n3.nabble.com/changeset-schema-error-tp3682951p368295...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months