Hi Charles,
Thanks for the response. In our situation, the users do use the same database.
Does doing a broker.clearCache() before every broker operation overcome the
stale data issue?
Also, we are running into some very strange errors on our non-clustered test
environment which we are seeing in our clustered QA environment too. Currently
we are using OJB 1.0.1 on WAS 5.0.2.6 using JDK1.3.1 on an AIX server. We have
data load and save operations that load and save our entire data from session
to database and vice versa. The entire load and save operations each are single
unit of work running in their own transaction. However, we noticed that very
randomly we get errors like "Borrow broker from pool failed, using PBKey
org.apache.ojb.broker.PBKey: jcdAlias=something, user=something,
password=*****" or "java.sql.SQLException: Connection is closed. [EMAIL
PROTECTED] wrapped [EMAIL PROTECTED] ]". Some times, even more bizarrely, it
says some of the data that we are trying to insert is not present while doing a
broker.store(), but I can very that the data is right there.
And very strangely, if we wait a minute or so and attempt to save again, it
all saves correctly without a hitch.
Are we running into connection pool issues where we are getting stale
connections? Our settings in OJB.properties file are like this:
#----------------------------------------------------------------------------------------
# PersistenceBrokerFactory / PersistenceBroker
#----------------------------------------------------------------------------------------
PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl
PersistenceBrokerClass=org.apache.ojb.broker.core.PersistenceBrokerImpl
#----------------------------------------------------------------------------------------
# PersistenceBroker pool
#----------------------------------------------------------------------------------------
maxActive=40
maxIdle=-1
maxWait=2000
timeBetweenEvictionRunsMillis=-1
minEvictableIdleTimeMillis=1000000
whenExhaustedAction=2
#----------------------------------------------------------------------------------------
# ConnectionFactory / Default ConnectionPool
#----------------------------------------------------------------------------------------
ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl
#----------------------------------------------------------------------------------------
# ConnectionManager
#----------------------------------------------------------------------------------------
ConnectionManagerClass=org.apache.ojb.broker.accesslayer.ConnectionManagerImpl
#----------------------------------------------------------------------------------------
# Object cache
#----------------------------------------------------------------------------------------
ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheDefaultImpl
descriptorBasedCaches=false
#----------------------------------------------------------------------------------------
# Transaction Management and assocation
#----------------------------------------------------------------------------------------
JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.WebSphereTransactionManagerFactory
Our jdbc connection descriptor is set like this:
<jdbc-connection-descriptor
jcd-alias="OJBDb"
default-connection="true"
platform="Db2"
jdbc-level="1.0"
jndi-datasource-name="jdbc/ojbDataSource"
username="username"
password="password"
batch-mode="false"
useAutoCommit="0"
ignoreAutoCommitExceptions="false">
<sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl">
<attribute attribute-name="grabSize" attribute-value="1"></attribute>
</sequence-manager>
</jdbc-connection-descriptor>
What frustrates me most is the randomness of the errors. The same logic
executes once and fails the next moment. Am I doing something wrong here? Also,
we have some circular references in our database setup. Given that, should I
move up to OJB 1.0.3 or so? What is the migration path for moving from OJB
1.0.1 to OJB 1.0.3? Do I have to re-write my repository.xml (which would be a
huge undertaking at this point for me)? Is it first of all supported on JDK
1.3.1 (I cannot upgrade to JDK 1.4.2 for a number of reasons beyond my
control)?
Any help is greatly appreciated. Thanks.
Regards,
-Vamsi
----- Original Message ----
From: Charles Anthony <[EMAIL PROTECTED]>
To: OJB Users List <[email protected]>
Sent: Thursday, May 18, 2006 2:10:26 AM
Subject: RE: Clustering for OJB
Hi Vamsi,
If the users are updating the same database and objects, then you will need
to deal with clustering
Lets say you have Machine 1 and Machine 2
1. Bob on Machine 1 retrieves object A which is stored in the cache.
2. Carol on Machine 2 retrieves Object A, and updates it
3. Bob on Machine 1 re-retrieves object, which comes from the cache. Bob
will not see Carols changes.
If you have two VM's updating the same objects, you need to implement some
kind of cluster aware cache, which would flush Machine 1's copy of Object A
when Machine 2 updates it.
I know the theory - I just haven't personally implemented any cluster-aware
caching yet. OJB supports pluggable caches. according to
http://db.apache.org/ojb/docu/guides/objectcache.html#ObjectCacheOSCacheImpl
there is a OSCache implementation - but in what OJB version it was
implemented, and what JVM it is compatible with, I am not sure. I do not
believe it would be difficult create wrapper around any distributed cache
for OJB.
Cheers,
Charles
-----Original Message-----
From: Vamsi Atluri [mailto:[EMAIL PROTECTED]
Sent: 17 May 2006 19:53
To: OJB Users List
Subject: Clustering for OJB
Hi all,
I am getting some errors when I move from a non-clustered environment in our
testbed to a clustered environment in QA. I have read the document about
setting up OJBs in a clustered environment, however, in our cluster, there
is no session sharing between various nodes in the cluster. And once a user
is assigned a session on a particular server in the cluster, he always goes
to the same machine till his session is terminated. So I was under the
impression that I do not have to do OJB clustering. Am I correct or wrong?
Also, is OSCache supported for jdk1.3.1 and OJB 1.0.1? As always, I really
appreciate any help.
Regards,
-Vamsi
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
___________________________________________________________
HPD Software Ltd. - Helping Business Finance Business
Email terms and conditions: www.hpdsoftware.com/disclaimer
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]