Re: Re: Closing connections with BRMS\JackRabbit Repository
by mmquelo massi
Thank You Jeffrey, but I did as u told me but anything changed....
Here is the DS definition:
*<local-tx-datasource>
<jndi-name>jdbc_XA/Drools_Rep</jndi-name>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<connection-url>jdbc:oracle:thin:@localhost:1521:xe</connection-url>
<user-name>...</user-name>
<password>...</password>
<exception-sorter-class-name>
org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
</exception-sorter-class-name>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
<use-java-context>false</use-java-context>
</local-tx-datasource>*
... I got back the same exception even with the local-tx Datasource!!
*17:35:33,430 INFO [STDOUT] PackageName: com.spyd.rules.Scoring*
*17:35:33,430 INFO [STDOUT] PackageVersion: Scoring*
*17:35:33,430 INFO [STDOUT] PackageIsLatest: false*
*----*
*(I THINK THIS ONE DOES NOT REALLY MATTER)*
*17:35:43,559 INFO [STDOUT] ERROR 22-02 17:35:43,558 (**
Contexts.java:flushAndDestroyContexts:335**) could not discover transaction
status*
*----*
*17:35:43,560 INFO [CachedConnectionManager] Closing a connection for you.
Please close them yourself:
org.jboss.resource.adapter.jdbc.WrappedConnection@ccc4e9*
*java.lang.Throwable: STACKTRACE*
*at
org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection
(**CachedConnectionManager.java:290**)*
*at
org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection
(**BaseConnectionManager2.java:417**)*
*at
org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection
(**BaseConnectionManager2.java:842**)*
*at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(**
WrapperDataSource.java:88**)*
*at
org.apache.jackrabbit.core.persistence.db.JNDIDatabasePersistenceManager.getConnection
(**JNDIDatabasePersistenceManager.java:77**)*
*at
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.initConnection
(**DatabasePersistenceManager.java:730**)*
*at
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.reestablishConnection
(**DatabasePersistenceManager.java:806**)*
*at
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.executeStmt
(**DatabasePersistenceManager.java:852**)*
*at
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.exists(
**DatabasePersistenceManager.java:673**)*
*at
org.apache.jackrabbit.core.state.SharedItemStateManager.hasNonVirtualItemState
(**SharedItemStateManager.java:1104**)*
*at org.apache.jackrabbit.core.state.SharedItemStateManager.hasItemState(**
SharedItemStateManager.java:289**)*
*at org.apache.jackrabbit.core.state.LocalItemStateManager.hasItemState(**
LocalItemStateManager.java:180**)*
*at org.apache.jackrabbit.core.state.XAItemStateManager.hasItemState(**
XAItemStateManager.java:252**)*
*at org.apache.jackrabbit.core.state.SessionItemStateManager.hasItemState(**
SessionItemStateManager.java:199**)*
*at org.apache.jackrabbit.core.ItemManager.itemExists(**ItemManager.java:258
**)*
*at org.apache.jackrabbit.core.NodeImpl.hasProperty(**NodeImpl.java:2708**)*
*at org.drools.repository.PackageItem.getCompiledPackageBytes(**
PackageItem.java:666**)*
*at org.drools.brms.server.files.FileManagerUtils.loadBinaryPackage(**
FileManagerUtils.java:146**)*
*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.jboss.seam.util.Reflections.invoke(**Reflections.java:21**)*
*at org.jboss.seam.intercept.RootInvocationContext.proceed(**
RootInvocationContext.java:31**)*
I am quite annoyed with this, cause when I define a direct
JDBC connection to the Oracle Drools Repository everything
works as expected and it is really Fast as well!
So... Why do I get this kind of issues once I use the Datasource????
Can You advise me any way to (at least) reduce the exception
waiting time?
Let me know.
Thank again
Massi
16 years, 7 months
Closing connections with BRMS\JackRabbit Repository
by mmquelo massi
Hi guys!
I have got JBoss 4.2.2, DROOLS BRMS 4.0.4 and Oracle 10g XE as RDBMS.
I defined an Oracle XA Datasource Drools Repository as follows:
*<xa-datasource>
<jndi-name>jdbc_XA/Drools_Rep</jndi-name>
<track-connection-by-tx/>
<isSameRM-override-value>false</isSameRM-override-value>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource
</xa-datasource-class>
<xa-datasource-property
name="URL">jdbc:oracle:thin:@//localhost:1521/xe</xa-datasource-property>
<xa-datasource-property name="User">...</xa-datasource-property>
<xa-datasource-property name="Password">...</xa-datasource-property>
<exception-sorter-class-name>
org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
</exception-sorter-class-name>
<!-- <prepared-statement-cache-size>0</prepared-statement-cache-size> -->
<!-- <blocking-timeout-millis>100</blocking-timeout-millis> -->
<!-- <min-pool-size>2</min-pool-size> -->
<!-- <max-pool-size>30</max-pool-size> -->*
*
<valid-connection-checker-class-name>
org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker
</valid-connection-checker-class-name>*
* <no-tx-separate-pools/>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
<use-java-context>false</use-java-context>
</xa-datasource>*
This repository is managed with JackRabbit.
So i defined the "repository.xml" telling jackrabbit that I want
to persist the rules into the Oracle XA Datasource I previously defined:
* <PersistenceManager class="
org.apache.jackrabbit.core.persistence.db.JNDIDatabasePersistenceManager">
<param name="dataSourceLocation" value="jdbc_XA/Drools_Rep"/>
<param name="schema" value="oracle"/>
<param name="schemaObjectPrefix" value="${wsp.name}_"/>
<param name="externalBLOBs" value="false" />
</PersistenceManager>*
The problem comes out each time I reload the rulebase from
the BRMS....each time the RuleAgent wants to load
a rulebase (from the XA datasource ) the following exception is
thrown and the execution stops for 4-5 seconds:
*12:29:36,170 INFO [CachedConnectionManager] Closing a connection for you.
Please close them yourself:
org.jboss.resource.adapter.jdbc.WrappedConnection@d74f7d*
*java.lang.Throwable: STACKTRACE*
*at
org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection
(**CachedConnectionManager.java:290**)*
*at
org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection
(**BaseConnectionManager2.java:417**)*
*at
org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection
(**BaseConnectionManager2.java:842**)*
*at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(**
WrapperDataSource.java:88**)*
*at
org.apache.jackrabbit.core.persistence.db.JNDIDatabasePersistenceManager.getConnection
(**JNDIDatabasePersistenceManager.java:77**)*
*at
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.initConnection
(**DatabasePersistenceManager.java:730**)*
*at
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.reestablishConnection
(**DatabasePersistenceManager.java:806**)*
*at
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.executeStmt
(**DatabasePersistenceManager.java:852**)*
*at
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.exists(
**DatabasePersistenceManager.java:673**)*
*at
org.apache.jackrabbit.core.state.SharedItemStateManager.hasNonVirtualItemState
(**SharedItemStateManager.java:1104**)*
*at org.apache.jackrabbit.core.state.SharedItemStateManager.hasItemState(**
SharedItemStateManager.java:289**)*
*at org.apache.jackrabbit.core.state.LocalItemStateManager.hasItemState(**
LocalItemStateManager.java:180**)*
*at org.apache.jackrabbit.core.state.XAItemStateManager.hasItemState(**
XAItemStateManager.java:252**)*
*at org.apache.jackrabbit.core.state.SessionItemStateManager.hasItemState(**
SessionItemStateManager.java:199**)*
*at org.apache.jackrabbit.core.ItemManager.itemExists(**ItemManager.java:258
**)*
*at org.apache.jackrabbit.core.NodeImpl.hasProperty(**NodeImpl.java:2708**)*
*at org.drools.repository.PackageItem.getCompiledPackageBytes(**
PackageItem.java:666**)*
*at org.drools.brms.server.files.FileManagerUtils.loadBinaryPackage(**
FileManagerUtils.java:146**)*
*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.jboss.seam.util.Reflections.invoke(**Reflections.java:21**)*
*at org.jboss.seam.intercept.RootInvocationContext.proceed(**
RootInvocationContext.java:31**)*
*at org.jboss.seam.intercept.SeamInvocationContext.proceed(**
SeamInvocationContext.java:56**)*
*at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(**
RollbackInterceptor.java:31**)*
*at org.jboss.seam.intercept.SeamInvocationContext.proceed(**
SeamInvocationContext.java:68**)*
*at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(**
BijectionInterceptor.java:46**)*
*at org.jboss.seam.intercept.SeamInvocationContext.proceed(**
SeamInvocationContext.java:68**)*
*at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(**
MethodContextInterceptor.java:42**)*
*at org.jboss.seam.intercept.SeamInvocationContext.proceed(**
SeamInvocationContext.java:68**)*
*at org.jboss.seam.security.SecurityInterceptor.aroundInvoke(**
SecurityInterceptor.java:40**)*
*at org.jboss.seam.intercept.SeamInvocationContext.proceed(**
SeamInvocationContext.java:68**)*
*at org.jboss.seam.intercept.RootInterceptor.invoke(**RootInterceptor.java
:106**)*
*at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(**
JavaBeanInterceptor.java:155**)*
*at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(**
JavaBeanInterceptor.java:91**)*
*at
org.drools.brms.server.files.FileManagerUtils_$$_javassist_1.loadBinaryPackage
(FileManagerUtils_$$_javassist_1.java)*
*at org.drools.brms.server.files.PackageDeploymentServlet.doGet(**
PackageDeploymentServlet.java:99**)*
*at javax.servlet.http.HttpServlet.service(**HttpServlet.java:690**)*
*at javax.servlet.http.HttpServlet.service(**HttpServlet.java:803**)*
*at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(**
ApplicationFilterChain.java:290**)*
*at org.apache.catalina.core.ApplicationFilterChain.doFilter(**
ApplicationFilterChain.java:206**)*
*at org.jboss.seam.web.ContextFilter$1.process(**ContextFilter.java:42**)*
*at org.jboss.seam.servlet.ContextualHttpServletRequest.run(**
ContextualHttpServletRequest.java:46**)*
*at org.jboss.seam.web.ContextFilter.doFilter(**ContextFilter.java:37**)*
*at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(**
ApplicationFilterChain.java:235**)*
*at org.apache.catalina.core.ApplicationFilterChain.doFilter(**
ApplicationFilterChain.java:206**)*
*at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(**
ReplyHeaderFilter.java:96**)*
*at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(**
ApplicationFilterChain.java:235**)*
*at org.apache.catalina.core.ApplicationFilterChain.doFilter(**
ApplicationFilterChain.java:206**)*
*at org.apache.catalina.core.StandardWrapperValve.invoke(**
StandardWrapperValve.java:230**)*
*at org.apache.catalina.core.StandardContextValve.invoke(**
StandardContextValve.java:175**)*
*at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(**
SecurityAssociationValve.java:179**)*
*at org.jboss.web.tomcat.security.JaccContextValve.invoke(**
JaccContextValve.java:84**)*
*at org.apache.catalina.core.StandardHostValve.invoke(**
StandardHostValve.java:127**)*
*at org.apache.catalina.valves.ErrorReportValve.invoke(**
ErrorReportValve.java:102**)*
*at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(**
CachedConnectionValve.java:157**)*
*at org.apache.catalina.core.StandardEngineValve.invoke(**
StandardEngineValve.java:109**)*
*at org.apache.catalina.connector.CoyoteAdapter.service(**CoyoteAdapter.java
:262**)*
*at org.apache.coyote.http11.Http11Processor.process(**Http11Processor.java
:844**)*
*at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
**Http11Protocol.java:583**)*
*at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(**JIoEndpoint.java:446
**)*
*at java.lang.Thread.run(Unknown Source)*
*As u can see, each time jboss tries to access the drools DS, it finds*
*a previous connection opened, so Jboss HAS TO close it by itself!*
As far as U know, Is there any way to tell JackRabbit that he has to close
connections?
Hibernate has something like that so I expect that JackRabbit does the
same...
I already tried to redefine the XA datasource setting some tags related to
the
"connection\connection pools" but it did not work...that's why I am quite
sure
the problem has to be focused on jackrabbit!
Thank you anyway.
If u want you can answer me to m.magistri(a)reply.it as well.
Bye.
Massi
16 years, 7 months
referencing two or more classes with the same name but in different packages
by ST
Hi,
Is it possible to reference two or more classes with the same name but in
different packages in a DRL file? For example if I have a class named Order
but the class exists in two different packages. One is
customer.invoicing.Order the other is client.service.productcatalog.Order.
I tried something like the following but got an error when the DRL file is
parsed.
rule "Customer Rule"
when
o: customer.invoicing.Order()
then
System.out.println("customer invoice order exists.");
rule "Client Rule"
when
o: client.service.productcatalog.Order()
then
System.out.println("client order exists.");
Thanks,
ST
16 years, 7 months
Re: Working with Hibernate objects
by Małecki
>I don't see your test class as a peristent class. Unless you add
>hibernate annotations it won't become as such.
That's strange behaviour. I got working application - hibernate
objects with hbm configuration files. All run's except rule.
Getters and setters in hibernate objects are public so the main
problem is in Rule compiler. Is any workaround? Users may not wish to
regenerate hbm files to annotations.
org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule
name=Init message, agendaGroup=MAIN, salience=0, no-loop=true]
com/sample/Rule_Init_message_0.java (9:430) : The field testTable.id
is not visible
at org.drools.rule.Package.checkValidity(Package.java:424)
----------------------------------------------------
Ciało kobiety dojrzałej wg. Tomasz Sobieraja.
Zobacz galerię fotografii.
Kliknij: http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Fkobieta-dojrza...
16 years, 7 months
IllegalAccessError in shadow classes
by Godmar Back
Hi,
usings Drools 4.0.4 and MVEL 1.4, this simple rule:
---
package test;
import java.util.Collections;
dialect "mvel"
rule "Rule #1"
when
then
insert(Collections.singletonMap("content", "hello"));
end
--
produces:
java.lang.IllegalAccessError: class
org.drools.shadow.java.util.Collections$SingletonMapShadowProxy cannot
access its superclass java.util.Collections$SingletonMap
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at org.drools.rule.MapBackedClassLoader.fastFindClass(MapBackedClassLoader.java:60)
at org.drools.rule.MapBackedClassLoader.loadClass(MapBackedClassLoader.java:79)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.drools.reteoo.Rete$ClassObjectTypeConf.loadOrGenerateProxy(Rete.java:547)
at org.drools.reteoo.Rete$ClassObjectTypeConf.defineShadowProxyData(Rete.java:494)
at org.drools.reteoo.Rete$ClassObjectTypeConf.<init>(Rete.java:461)
at org.drools.reteoo.Rete.assertObject(Rete.java:152)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:909)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:881)
at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:67)
at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:61)
It's not clear to me why Drools creates Proxies for such classes as
java.util.Collections, or does MVEL do it?
- Godmar
16 years, 7 months
Working witj Hibernate objects
by Małecki
Hi
I'm testing rules with Hibernate objects (classes generated by Eclipse
JBoss plugin). Do I need any additional annotations in Hibernate class?
My simply test fails with "The field testTable.id is not visible" error
my rule:
rule "Init message"
when
m : TestTable(id <100)
(..)
my test class :
public class TestTable implements java.io.Serializable {
private int id;
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}(..)
----------------------------------------------------
Mucha zaręczyła się z Wojewódzkim?
http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Fzareczyny.html...
16 years, 7 months
Running Rules on Form fields
by Christie, Blair
I want to be able to validate the fields on a form using the same rules
that are used to validate the domain object that represents those
Rules ..without having to check each single field that is input with
the idea to be able to validate a single field without having to create
the whole domain
Object.
Example:
If we have a domain object say
Patron
String Name
String phoneNumber
And you have a form with the fields represented as Strings in a request.
Name
PhoneNumber
And if the user enters his phone number I just want to run the rule
about phonenumber without firing the rule for name.
The first idea was to create a class for each form field which would
leverage the power of the rule engine for example:
When
Patron(phoneNumber not matches " \(?\d{3}\)?
?\d{3}[-.]\d{4}")
||
PhoneNumber(value not matches " \(?\d{3}\)? ?\d{3}[-.]\d{4}"
Then
InsertLogical(Message("Bad Phone")
But that would mean creating a class for each field, which just seems
wrong.
Is there a better design?
Blair Christie
16 years, 7 months
Plz reply : Descending order rule
by barath gunasagaran
Hi,
Can u explain me the rule flow for the below rule ?.
This will help me to get some clear idea about rules.
rule "Descending order"
when
$a : Order( $value : value )
not Order( value > $value)
then
System.out.println("value :"+$value);
retract($a);
end
I am having the following ,
1. Order value=1
2. Order value=2
3. Order value=3
4. Order value=4
5. Order value=5
Can u explain the flow(when part) for this 5 object ?
Note my understanding(in when) : 1st line take one order object
2nd line check for
any other object with grater 'value'
But i dont know
sequence in which the objects are taken.
Plz do reply......
Thanks in advance,
Barath.
16 years, 7 months