Deploying Guvnor on a existing repository DB
by maav
Hi!
I'm trying to get Guvnor to deploy on a pre-existing existing DB. The use
case beeing that we wan't to be able to bring up a backup instance of guvnor
in case the primary goes down.
But if a deploy guvnor on a "fresh" DB schema all tables get created along
with trigger and sequences (using Oracle 11).
But when I un-deploy guvnor.war and remove the repository-folder and then
deploy it again I get the following exception:
Caused by: java.sql.SQLException: ORA-00001: unique constraint
(ID_VERIFICATION.G_DEFAULT_BUNDLE_IDX) violated
at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
at
oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:219)
at
oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:970)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1190)
at
oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3370)
at
oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3476)
at
org.apache.jackrabbit.core.persistence.bundle.ConnectionRecoveryManager.executeStmtInternal(ConnectionRecoveryManager.java:371)
at
org.apache.jackrabbit.core.persistence.bundle.ConnectionRecoveryManager.executeStmtInternal(ConnectionRecoveryManager.java:298)
at
org.apache.jackrabbit.core.persistence.bundle.ConnectionRecoveryManager.executeStmt(ConnectionRecoveryManager.java:261)
at
org.apache.jackrabbit.core.persistence.bundle.ConnectionRecoveryManager.executeStmt(ConnectionRecoveryManager.java:239)
at
org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager.storeBundle(BundleDbPersistenceManager.java:1207)
... 59 more
What do I need to do to prevent this?
This is my repository.xml:
<?xml version="1.0"?>
<!DOCTYPE Repository
PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit
2.0//EN"
"http://jackrabbit.apache.org/dtd/repository-2.0.dtd">
<Repository>
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
</FileSystem>
<DataStore class="org.apache.jackrabbit.core.data.FileDataStore">
</DataStore>
<Security appName="Jackrabbit">
<SecurityManager
class="org.apache.jackrabbit.core.security.simple.SimpleSecurityManager"
workspaceName="security">
</SecurityManager>
<AccessManager
class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager">
</AccessManager>
<LoginModule
class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule">
</LoginModule>
</Security>
<Workspaces rootPath="${rep.home}/workspaces"
defaultWorkspace="default"/>
<Workspace name="${wsp.name}">
<FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
</FileSystem>
<PersistenceManager
class="org.apache.jackrabbit.core.persistence.bundle.OraclePersistenceManager">
</PersistenceManager>
<SearchIndex
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
</SearchIndex>
</Workspace>
<Versioning rootPath="${rep.home}/version">
<FileSystem
class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
</FileSystem>
<PersistenceManager
class="org.apache.jackrabbit.core.persistence.bundle.OraclePersistenceManager">
</PersistenceManager>
</Versioning>
<SearchIndex
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
</SearchIndex>
</Repository>
--
View this message in context: http://drools.46999.n3.nabble.com/Deploying-Guvnor-on-a-existing-reposito...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 11 months
Drools flow persistence with Oracle, error enlisting a JdbcConnectionHandle of a JdbcPooledConnection from datasource jdbc/DBD02 in state ACCESSIBLE wrapping oracle.jdbc.xa.client.OracleXAConnection@1de2b1 on oracle.jdbc.driver.OracleConnection@dee38
by loumimi
I'm trying to persist my workflow into an Oracle db, when I tried to create
the session
StatefulKnowledgeSession ksession =
JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );
I have the exception bellow
Hibernate: select hibernate_sequence.nextval from dual
May 12, 2011 2:14:09 PM org.hibernate.util.JDBCExceptionReporter
logExceptions
WARNING: SQL Error: 0, SQLState: null
May 12, 2011 2:14:09 PM org.hibernate.util.JDBCExceptionReporter
logExceptions
SEVERE: error enlisting a JdbcConnectionHandle of a JdbcPooledConnection
from datasource jdbc/DBD02 in state ACCESSIBLE wrapping
oracle.jdbc.xa.client.OracleXAConnection@1de2b1 on
oracle.jdbc.driver.OracleConnection@dee38
java.lang.RuntimeException: Could not commit session
at
org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:119)
at
org.drools.persistence.jpa.impl.JPAKnowledgeServiceProviderImpl.newStatefulKnowledgeSession(JPAKnowledgeServiceProviderImpl.java:44)
at
org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:93)
at com.sample.ProcessTest.main(ProcessTest.java:61)
Caused by: javax.persistence.PersistenceException:
org.hibernate.exception.GenericJDBCException: could not get next sequence
value
at
org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
at
org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:226)
at
org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:107)
... 3 more
Caused by: org.hibernate.exception.GenericJDBCException: could not get next
sequence value
at
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
at
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:119)
at
org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:122)
at
org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49)
at
org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:154)
at
org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:110)
at
org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:61)
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:645)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:619)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:623)
at
org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:220)
... 4 more
Caused by: java.sql.SQLException: error enlisting a JdbcConnectionHandle of
a JdbcPooledConnection from datasource jdbc/DBD02 in state ACCESSIBLE
wrapping oracle.jdbc.xa.client.OracleXAConnection@1de2b1 on
oracle.jdbc.driver.OracleConnection@dee38
at
bitronix.tm.resource.jdbc.JdbcConnectionHandle.enlistResource(JdbcConnectionHandle.java:61)
at
bitronix.tm.resource.jdbc.JdbcConnectionHandle.prepareStatement(JdbcConnectionHandle.java:200)
at
org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
at
org.hibernate.jdbc.AbstractBatcher.prepareSelectStatement(AbstractBatcher.java:145)
at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:96)
... 13 more
Caused by: bitronix.tm.internal.BitronixSystemException: cannot enlist an
XAResourceHolderState with uniqueName=jdbc/DBD02
XAResource=oracle.jdbc.xa.client.OracleXAResource@1790581 with XID a
Bitronix XID [3138342E35312E31362E3232300000012FE420DBC400000000 :
3138342E35312E31362E3232300000012FE420DC5100000002], error=XAER_PROTO
at
bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:83)
at
bitronix.tm.resource.common.TransactionContextHelper.enlist(TransactionContextHelper.java:267)
at
bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:49)
at
bitronix.tm.resource.jdbc.JdbcConnectionHandle.enlistResource(JdbcConnectionHandle.java:59)
... 17 more
Caused by: javax.transaction.xa.XAException
at
oracle.jdbc.xa.OracleXAResource.disallowLocalTxnMode(OracleXAResource.java:1045)
at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:153)
at
bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:179)
at bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:89)
at
bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:76)
... 20 more
Here is my configuration :
the code :
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("ruleflow.rf"),
ResourceType.DRF);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error: errors) {
System.err.println(error);
}
throw new IllegalArgumentException("Could not parse
knowledge.");
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
configureDataSource();
// create the entity manager factory and register it in the
environment
EntityManagerFactory emf = Persistence.createEntityManagerFactory(
"org.drools.persistence.jpa" );
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
env.set( EnvironmentName.TRANSACTION_MANAGER,
TransactionManagerServices.getTransactionManager() );
// create a new knowledge session that uses JPA to store the runtime
state
StatefulKnowledgeSession ksession =
JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );
public static void configureDataSource()
{
PoolingDataSource ds = new PoolingDataSource();
ds.setUniqueName("jdbc/DBD02");
ds.setClassName("oracle.jdbc.xa.client.OracleXADataSource");
ds.setMaxPoolSize(3);
ds.setAllowLocalTransactions(true);
ds.getDriverProperties().put("user", "xxx");
ds.getDriverProperties().put("password", "xxx");
ds.getDriverProperties().put("URL",
"jdbc:oracle:thin:@gfxdevdb01.fr.world.xxx:1567:DBD02");
ds.init();
}
the persistence.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence
version="1.0"
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"
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="org.drools.persistence.jpa"
transaction-type="RESOURCE_LOCAL" >
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/DBD02</jta-data-source>
<class>org.drools.persistence.session.SessionInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceEventInfo</class>
<class>org.drools.persistence.processinstance.WorkItemInfo</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.connection.driver_class"
value="oracle.jdbc.OracleDriver"/>
<property name="hibernate.connection.autocommit" value="true" />
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.BTMTransactionManagerLookup"/>
</properties>
</persistence-unit>
</persistence>
orm.xml
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="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/orm orm_1_0.xsd"
version="1.0">
<named-query name="ProcessInstancesWaitingForEvent">
<query>
select
processInstanceInfo.processInstanceId
from
ProcessInstanceInfo processInstanceInfo
where
:type in elements(processInstanceInfo.eventTypes)
</query>
</named-query>
</entity-mappings>
Do you have any idea about this problem ?
Thanks,
Regards,
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-flow-persistence-with-Oracle-err...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 11 months
Drools flow persistence with Oracle, Could not obtain BTM transaction manager instance
by loumimi
Hello,
I crated a sample application to test the persistent of drools workflow. I
tried the example given in the documentation using H2 Db, everything works
fine.
But when I tried to move to Oracle, I have several problems. I resolved the
bug related to entity names when they are longer than 30, but I still have
an other problem with BitronixTransactionManager
Can you please check if I'm missing some things ?
Here's my stack trace
INFO: schema export complete
May 11, 2011 12:50:14 PM bitronix.tm.BitronixTransactionManager logVersion
INFO: Bitronix Transaction Manager version 1.3.2
May 11, 2011 12:50:14 PM bitronix.tm.Configuration buildServerIdArray
WARNING: cannot get this JVM unique ID. Make sure it is configured and you
only use ASCII characters. Will use IP address instead (unsafe for
production usage!).
May 11, 2011 12:50:14 PM bitronix.tm.Configuration buildServerIdArray
INFO: JVM unique ID: <184.51.16.220>
May 11, 2011 12:50:14 PM bitronix.tm.journal.DiskJournal open
WARNING: active log file is unclean, previous server crash ?
javax.persistence.PersistenceException: [PersistenceUnit:
org.drools.persistence.jpa] Unable to build EntityManagerFactory
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
at
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
at com.sample.ProcessTest.main(ProcessTest.java:52)
Caused by: org.hibernate.HibernateException: Could not obtain BTM
transaction manager instance
at
org.hibernate.transaction.BTMTransactionManagerLookup.getTransactionManager(BTMTransactionManagerLookup.java:50)
at
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:357)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
... 4 more
Caused by: java.lang.reflect.InvocationTargetException
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.hibernate.transaction.BTMTransactionManagerLookup.getTransactionManager(BTMTransactionManagerLookup.java:47)
... 8 more
Caused by: bitronix.tm.utils.InitializationException: recovery failed,
cannot safely start the transaction manager
at
bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:65)
at
bitronix.tm.TransactionManagerServices.getTransactionManager(TransactionManagerServices.java:41)
... 13 more
Caused by: bitronix.tm.recovery.RecoveryException: error running recovery on
resource jdbc/CCOD02 (XAER_RMERR)
at bitronix.tm.recovery.Recoverer.recoverAllResources(Recoverer.java:191)
at bitronix.tm.recovery.Recoverer.run(Recoverer.java:105)
at
bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:49)
... 14 more
Caused by: javax.transaction.xa.XAException
at oracle.jdbc.xa.OracleXAResource.recover(OracleXAResource.java:626)
at bitronix.tm.recovery.RecoveryHelper.recover(RecoveryHelper.java:74)
at bitronix.tm.recovery.RecoveryHelper.recover(RecoveryHelper.java:39)
at bitronix.tm.recovery.Recoverer.recover(Recoverer.java:230)
at bitronix.tm.recovery.Recoverer.recoverAllResources(Recoverer.java:185)
... 16 more
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code =
-2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183):
[../../../src/share/back/util.c:820]
I overwrote the file persistence.xml of drools-persistence-jpa-5.0.1.jar
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence
version="1.0"
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"
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="org.drools.persistence.jpa"
transaction-type="RESOURCE_LOCAL" >
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/db</jta-data-source>
<class>org.drools.persistence.session.SessionInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceEventInfo</class>
<class>org.drools.persistence.processinstance.WorkItemInfo</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.connection.driver_class"
value="oracle.jdbc.OracleDriver"/>
<property name="javax.persistence.jdbc.url"
value="jdbc:oracle:thin:@gfxdevdb01.fr.world.xxx:1567:xxxx"/>
<property name="javax.persistence.jdbc.user" value="user"/>
<property name="javax.persistence.jdbc.password" value="pwd"/>
<property name="hibernate.connection.autocommit" value="true" />
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.BTMTransactionManagerLookup"/>
</properties>
</persistence-unit>
</persistence>
The data source is created with API way :
PoolingDataSource ds = new PoolingDataSource();
ds.setUniqueName("jdbc/db");
ds.setClassName("oracle.jdbc.xa.client.OracleXADataSource");
ds.setMaxPoolSize(3);
ds.setAllowLocalTransactions(true);
ds.getDriverProperties().put("user", "user");
ds.getDriverProperties().put("password", "pwd");
ds.getDriverProperties().put("URL",
"jdbc:oracle:thin:@gfxdevdb01.fr.world.xxx:1567:xxxx");
ds.init();
the exception is launched in this line
EntityManagerFactory emf = Persistence.createEntityManagerFactory(
"org.drools.persistence.jpa" );
Thanks for your help
Moundir
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-flow-persistence-with-Oracle-Cou...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 11 months
Problem (or question) about drools
by Nico ROEDERER
Hi,
I would like to know if it's the correct e-mail list for
problems/questions about Drools ?
If not, what's the correct email, please ?
Thank you.
N.
14 years, 11 months
Question / problem
by Nico ROEDERER
Hi,
I've got a little question. I've got a drl file which contains two rules :
rule "FirstRule"
salience 99
when
$testDrools : TestDroolsDto()
eval ( 1 == 1 )
then
System.out.println("Set my value to 1");
$testDrools.setMyValue("1");
end
rule "SecondRule"
salience 1
when
$testDrools : TestDroolsDto()
eval( $testDrools.getMyValue().equals("") )
then
System.out.println("My Value : " + $testDrools.getMyValue() );
end
Is it normal that in my second rule is verified ?
-> eval( $testDrools.getMyValue().equals("") ) is true
but : System.out.println("My Value : " + $testDrools.getMyValue() );
show me that myValue == 1
Perhaps I did something wrong ?
Thanks for your helping me.
N.
PS : Here is me TestDroolsDto :
public class TestDroolsDto {
private String myValue;
public TestDroolsDto() {
myValue="";
}
public String toString() {
return " --> " + myValue;
}
/**
* @return the myValue
*/
public String getMyValue() {
if ( myValue == null ) {
myValue = "";
}
return myValue;
}
/**
* @param myValue the myValue to set
*/
public void setMyValue( String myValue ) {
this.myValue = myValue;
}
}
14 years, 11 months
Re: [rules-users] Question / problem
by Bruno Freudensprung
You are right; your probably need to set a no-loop atttribute on your rule.
Or, preferably, put additional conditions to the LHS of your FirstRule
(it would probably be the case in a "real-life" rule).
As Wolfgang suggested, take some time to read Drools expert
documentation: I found it very well designed for beginners (like me).
Regards,
Bruno.
Le 12/05/2011 11:19, Nico ROEDERER a écrit :
> Ok, but when I did this, the first rule has no ending.
> If I don't want to, I've got to retract the object, but my second rule
> is never fired.
>
> Should I make two different files ?
>
> Thanks for the help.
> (Sorry for such a poor English writing :( )
>
> Le 12/05/2011 11:12, Bruno Freudensprung a écrit :
>>
>> Hi,
>>
>> In my understanding it is normal. However if you told Drools that
>> your FirstRule modified the $testDrools object, it should no longer
>> be the case:
>>
>> then
>> System.out.println("Set my value to 1");
>> $testDrools.setMyValue("1");
>> update($testDrools);
>>
>> Regards,
>>
>> Bruno.
>>
>>
>> Le 12/05/2011 10:58, Nico ROEDERER a écrit :
>>> Hi,
>>>
>>> I've got a little question. I've got a drl file which contains two
>>> rules :
>>>
>>> rule "FirstRule"
>>> salience 99
>>> when
>>> $testDrools : TestDroolsDto()
>>> eval ( 1 == 1 )
>>> then
>>> System.out.println("Set my value to 1");
>>> $testDrools.setMyValue("1");
>>>
>>> end
>>>
>>> rule "SecondRule"
>>> salience 1
>>> when
>>> $testDrools : TestDroolsDto()
>>> eval( $testDrools.getMyValue().equals("") )
>>> then
>>> System.out.println("My Value : " + $testDrools.getMyValue() );
>>> end
>>>
>>> Is it normal that in my second rule is verified ?
>>> -> eval( $testDrools.getMyValue().equals("") ) is true
>>> but : System.out.println("My Value : " + $testDrools.getMyValue() );
>>> show me that myValue == 1
>>>
>>> Perhaps I did something wrong ?
>>>
>>> Thanks for your helping me.
>>> N.
>>>
>>>
>>>
>>> PS : Here is me TestDroolsDto :
>>> public class TestDroolsDto {
>>> private String myValue;
>>>
>>> public TestDroolsDto() {
>>> myValue="";
>>> }
>>>
>>> public String toString() {
>>> return " --> " + myValue;
>>> }
>>>
>>> /**
>>> * @return the myValue
>>> */
>>> public String getMyValue() {
>>> if ( myValue == null ) {
>>> myValue = "";
>>> }
>>> return myValue;
>>> }
>>>
>>> /**
>>> * @param myValue the myValue to set
>>> */
>>> public void setMyValue( String myValue ) {
>>> this.myValue = myValue;
>>> }
>>> }
>>>
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users(a)lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
14 years, 11 months
concatenate 2 dsl rules in dslr
by Saleem Lakhani
Hi,
How do I combine 2 different dsl statements in dslr.
Example in dsl I have;
1. Kid=Parson(age < 15)
2. Adult=Person(age > 21)
Can I write like this in dslr:
Kid or Adult
saleem
14 years, 11 months
Ruleflow exits before reaching END node?!
by jayadev
RULES:
--------
rule "11"
no-loop true
ruleflow-group "second-rulesgroup"
when
myObj: Test()
eval(true)
then
System.out.println(myObj.getIntField());
end
rule "12"
no-loop true
ruleflow-group "second-rulesgroup"
when
myObj: Test(intField==12345)
then
System.out.println(myObj.getIntField());
myObj.setStringField("rule_12");
end
rule "13"
no-loop true
ruleflow-group "first-rulesgroup"
when
myObj: Test(intField==0)
then
myObj.setIntField(12345);
update(myObj);
System.out.println("Done with rule 13 "+myObj.getIntField());
end
RULE_FLOW:
---------
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/process
drools-processes-5.0.xsd"
type="RuleFlow" name="TestFlow" id="TestFlow"
package-name="abc.def.xyz" >
<header>
</header>
<nodes>
<start id="1" name="Start" x="100" y="100" width="48" height="48" />
<ruleSet id="3" name="Second" x="402" y="102" width="118" height="40"
ruleFlowGroup="second-rulesgroup" />
<end id="4" name="End" x="584" y="98" width="80" height="40" />
<ruleSet id="5" name="First" x="227" y="174" width="121" height="40"
ruleFlowGroup="first-rulesgroup" />
<actionNode id="6" name="Action" x="431" y="217" width="80" height="40"
>
<action type="expression" dialect="mvel"
>System.out.println("here");</action>
</actionNode>
</nodes>
<connections>
<connection from="6" to="3" />
<connection from="3" to="4" />
<connection from="1" to="5" />
<connection from="5" to="6" />
</connections>
</process>
Test:
-----
public class Test {
private Integer intField;
private String stringField;
public Integer getIntField() {
return intField;
}
public void setIntField(Integer intField) {
this.intField = intField;
}
public String getStringField() {
return stringField;
}
public void setStringField(String stringField) {
this.stringField = stringField;
}
}
My input Fact:
--------------
Test myObj = new Test();
myObj.setIntField(0);
When I use the following things work fine. I can see all output messages in
order.
final StatefulKnowledgeSession ksession = kb.newStatefulKnowledgeSession();
//Where kb is the knowledgebase built using the above assets
Output Messages:
-----------------
Done with rule 13 12345
here
12345
12345
When I use the following it exits without any errors, but, output messages
are not as expected!
final StatefulKnowledgeSession ksession =
JPAKnowledgeService.newStatefulKnowledgeSession(kb, null, env);
Output Messages:
-------------------
Done with rule 13 12345
I am exhausted trying to figure out what is going wrong... Don't know where
to debug! Let me know if more information is needed. I am using Hibernate,
Spring, BTM transaction Manager.
I stumbled across "JBRULES-2718" and thought maybe this is something
similar? I am using 5.1.0
Thank you!
--
View this message in context: http://drools.46999.n3.nabble.com/Ruleflow-exits-before-reaching-END-node...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 11 months
Guvnor service to compile part of a package ?
by Vincent Legendre
Hi all,
I am looking for a clever way to compile only parts of a Guvnor package
according to some criteria on items (categories, metadata ...), but
outside Guvnor if possible.
The main idea starts by the fact that it is a little bit complex for a
business user to manage packages and compilations, and even more if he
has to manage conditional compilations (using selectors) of a single
package to produce multiple KB compiled according to business criterions.
I want to compile automatically some KB according to categories (more
generally asset's fields) with something external to Guvnor. Thus I need
a way to query Guvnor repository with criterion to get either :
- the corresponding ressources (DRL)
- the filtered compiled KB (PKG ressource)
Filtering with DRL (like custom selectors in Guvnor) will be perfect,
using a custom class too.
Is there such service ?
Does the KnowledgeAgent allow filtering (did not see anything in docs) ?
Or do I need to add a new service in Guvnor war directly ?
Thanks!
14 years, 11 months