Re: ObjectCacheOSCacheImpl issue.
OK, that was the problem. Thanks. M. On Thu, 10 Feb 2005 07:53:27 +0100, Armin Waibel <[EMAIL PROTECTED]> wrote: > > > > So what's going on here? > > are you sure that "OSCache" is really used by OJB? You set the OSCache > in OJB.properties, but is a cache in repository_database.xml file > (object-cache element in in the jdbc-connection-descriptor) set too? Are > specific caches set for classes (object-cache element in class-descriptor)? > > regards, > Armin > > Michael Newton wrote: > > I wrote a test as you suggested and it actually passed for both > > ObjectCacheOSCacheImpl and for the ObjectCacheDefaultImpl > > > > I have print statements in the constructor, lookup, and cache methods > > in ObjectCacheOSCacheImpl. > > > > Here is my test: > > public void testCache () throws Exception { > > PersistenceBroker broker = > > PersistenceBrokerFactory.defaultPersistenceBroker(); > > Attribute a = new Attribute(); > > Identity oid = broker.serviceIdentity().buildIdentity(a); > > broker.serviceObjectCache().cache(oid, a); > > Attribute b = (Attribute) broker.serviceObjectCache().lookup(oid); > > assertNotNull(b); > > } > > > > > > and here is the output (running with ObjectCacheOSCacheImpl ) > > > > [junit] Testsuite: legion.service.CacheTest > > [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 1.472 sec > > [junit] - Standard Output --- > > [junit] OSCache constructor > > [junit] - > > > > No "OSCache lookup" or "OSCache cache" messages are printed, and > > OSCache does not write it's disk cache (although it creates the > > directory) > > > > So what's going on here? > > > > M. > > > > On Thu, 10 Feb 2005 02:32:42 +0100, Armin Waibel <[EMAIL PROTECTED]> wrote: > > > >>Hi Michael, > >> > >>Michael Newton wrote: > >> > >>>I'm trying to use OSCache with OJB as I need disk persistence. > >>> > >>>My setup is working great with the other cache implementations. > >>> > >>>I got ObjectCacheOSCacheImpl.java from the db-obj-1.0.1-contrib > >>>package, set up oscache-2.1, and set ObjectCacheClass to > >>>ObjectCacheOSCacheImpl in my config. > >>> > >>>When I run it I get the following error, where OJB appears to be > >>>trying to pass a Properties object to ObjectCacheOSCacheImpl's > >>>constuctor: > >>> > >>>java.lang.NoSuchMethodException: > >>>ObjectCacheOSCacheImpl.(org.apache.ojb.broker.PersistenceBroker, > >>>java.util.Properties) > >>> > >>>I see that the constructors that ObjectCacheOSCacheImpl does have are > >>>all empty, so just for fun I added an empty constructor with the > >>>profile that OJB was looking for. The Properties object that is passed > >>>is null, by the way. > >>> > >>>Once I added this constructor, OJB ran and was fetching data from the > >>>database. > >> > >>all ObjectCache implementations need a specific constructor expect an PB > >>and Properties type. Thus you be right. > >> > >> > >> > >>>I could also see log output from OSCache itself like > >>>"Creating cache". Also it created a disk cache directory on the > >>>system, but doesn't write any files there. > >>> > >>>OJB does not seem to be calling cache() or lookup() on > >>>ObjectCacheOSCacheImpl ( I put some logging in it to see if it was). > >>> > >> > >>hmm, if OJB never calls cache or lookup in ObjectCacheOSCacheImpl it > >>will never call these methods on all ObjectCache implementations, > >>because they are all handled in the same way. > >>Did you write a test case to check the cache? Something like > >> > >>Article a = new Article(); > >>Identity oid = broker.serviceIdentity().buildIdentity(a); > >>broker.serviceObjectCache().cache(oid, a); > >> > >>Article b = broker.serviceObjectCache().lookup(oid); > >>assertNotNull(b); > >> > >>This test should pass with ObjectCacheDefaultImpl and your > >>ObjectCacheOSCacheImpl too. > >> > >>regards, > >>Armin > >> > >> > >> > >>>Here are my ojb properties in case there is anything relevant there: > >>>repositoryFile=ojb_repository.xml > >>>useSerializedRepository=false > >>>serializedRepositoryPath=. > >>>PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl > >>>PersistenceBrokerClass=org.apache.ojb.broker.core.PersistenceBrokerImpl > >>>maxActive=100 > >>>maxIdle=-1 > >>>maxWait=2000 > >>>timeBetweenEvictionRunsMillis=-1 > >>>minEvictableIdleTimeMillis=100 > >>>whenExhaustedAction=0 > >>>ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl > >>>ConnectionManagerClass=org.apache.ojb.broker.accesslayer.ConnectionManagerImpl > >>>SqlGeneratorClass=org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl > >>>IndirectionHandlerClass=org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl > >>>ListProxyClass=org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl > >>>SetProxyClass=org.apache.ojb.broker.core.proxy.SetProxyDefaultImpl > >>>CollectionProxyClass=org.apache.ojb
Re: ObjectCacheOSCacheImpl issue.
> > So what's going on here? are you sure that "OSCache" is really used by OJB? You set the OSCache in OJB.properties, but is a cache in repository_database.xml file (object-cache element in in the jdbc-connection-descriptor) set too? Are specific caches set for classes (object-cache element in class-descriptor)? regards, Armin Michael Newton wrote: I wrote a test as you suggested and it actually passed for both ObjectCacheOSCacheImpl and for the ObjectCacheDefaultImpl I have print statements in the constructor, lookup, and cache methods in ObjectCacheOSCacheImpl. Here is my test: public void testCache () throws Exception { PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker(); Attribute a = new Attribute(); Identity oid = broker.serviceIdentity().buildIdentity(a); broker.serviceObjectCache().cache(oid, a); Attribute b = (Attribute) broker.serviceObjectCache().lookup(oid); assertNotNull(b); } and here is the output (running with ObjectCacheOSCacheImpl ) [junit] Testsuite: legion.service.CacheTest [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 1.472 sec [junit] - Standard Output --- [junit] OSCache constructor [junit] - No "OSCache lookup" or "OSCache cache" messages are printed, and OSCache does not write it's disk cache (although it creates the directory) So what's going on here? M. On Thu, 10 Feb 2005 02:32:42 +0100, Armin Waibel <[EMAIL PROTECTED]> wrote: Hi Michael, Michael Newton wrote: I'm trying to use OSCache with OJB as I need disk persistence. My setup is working great with the other cache implementations. I got ObjectCacheOSCacheImpl.java from the db-obj-1.0.1-contrib package, set up oscache-2.1, and set ObjectCacheClass to ObjectCacheOSCacheImpl in my config. When I run it I get the following error, where OJB appears to be trying to pass a Properties object to ObjectCacheOSCacheImpl's constuctor: java.lang.NoSuchMethodException: ObjectCacheOSCacheImpl.(org.apache.ojb.broker.PersistenceBroker, java.util.Properties) I see that the constructors that ObjectCacheOSCacheImpl does have are all empty, so just for fun I added an empty constructor with the profile that OJB was looking for. The Properties object that is passed is null, by the way. Once I added this constructor, OJB ran and was fetching data from the database. all ObjectCache implementations need a specific constructor expect an PB and Properties type. Thus you be right. I could also see log output from OSCache itself like "Creating cache". Also it created a disk cache directory on the system, but doesn't write any files there. OJB does not seem to be calling cache() or lookup() on ObjectCacheOSCacheImpl ( I put some logging in it to see if it was). hmm, if OJB never calls cache or lookup in ObjectCacheOSCacheImpl it will never call these methods on all ObjectCache implementations, because they are all handled in the same way. Did you write a test case to check the cache? Something like Article a = new Article(); Identity oid = broker.serviceIdentity().buildIdentity(a); broker.serviceObjectCache().cache(oid, a); Article b = broker.serviceObjectCache().lookup(oid); assertNotNull(b); This test should pass with ObjectCacheDefaultImpl and your ObjectCacheOSCacheImpl too. regards, Armin Here are my ojb properties in case there is anything relevant there: repositoryFile=ojb_repository.xml useSerializedRepository=false serializedRepositoryPath=. PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl PersistenceBrokerClass=org.apache.ojb.broker.core.PersistenceBrokerImpl maxActive=100 maxIdle=-1 maxWait=2000 timeBetweenEvictionRunsMillis=-1 minEvictableIdleTimeMillis=100 whenExhaustedAction=0 ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl ConnectionManagerClass=org.apache.ojb.broker.accesslayer.ConnectionManagerImpl SqlGeneratorClass=org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl IndirectionHandlerClass=org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl ListProxyClass=org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl SetProxyClass=org.apache.ojb.broker.core.proxy.SetProxyDefaultImpl CollectionProxyClass=org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl StatementManagerClass=org.apache.ojb.broker.accesslayer.StatementManager StatementsForClassClass=org.apache.ojb.broker.accesslayer.StatementsForClassImpl JdbcAccessClass=org.apache.ojb.broker.accesslayer.JdbcAccessImpl RowReaderDefaultClass=org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl ObjectCacheClass=ObjectCacheOSCacheImpl descriptorBasedCaches=false LockManagerClass=org.apache.ojb.odmg.locking.LockManagerDefaultImpl LockMapClass=org.apache.ojb.odmg.locking.InMemoryLockMapImpl LockTimeout=6 ImplicitLocking=true LockServletUrl=http://127.0.0.1:8080/ojb-lockserver LockAssociations=WRITE OqlCollectionCla
Re: ObjectCacheOSCacheImpl issue.
I wrote a test as you suggested and it actually passed for both ObjectCacheOSCacheImpl and for the ObjectCacheDefaultImpl I have print statements in the constructor, lookup, and cache methods in ObjectCacheOSCacheImpl. Here is my test: public void testCache () throws Exception { PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker(); Attribute a = new Attribute(); Identity oid = broker.serviceIdentity().buildIdentity(a); broker.serviceObjectCache().cache(oid, a); Attribute b = (Attribute) broker.serviceObjectCache().lookup(oid); assertNotNull(b); } and here is the output (running with ObjectCacheOSCacheImpl ) [junit] Testsuite: legion.service.CacheTest [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 1.472 sec [junit] - Standard Output --- [junit] OSCache constructor [junit] - No "OSCache lookup" or "OSCache cache" messages are printed, and OSCache does not write it's disk cache (although it creates the directory) So what's going on here? M. On Thu, 10 Feb 2005 02:32:42 +0100, Armin Waibel <[EMAIL PROTECTED]> wrote: > Hi Michael, > > Michael Newton wrote: > > I'm trying to use OSCache with OJB as I need disk persistence. > > > > My setup is working great with the other cache implementations. > > > > I got ObjectCacheOSCacheImpl.java from the db-obj-1.0.1-contrib > > package, set up oscache-2.1, and set ObjectCacheClass to > > ObjectCacheOSCacheImpl in my config. > > > > When I run it I get the following error, where OJB appears to be > > trying to pass a Properties object to ObjectCacheOSCacheImpl's > > constuctor: > > > > java.lang.NoSuchMethodException: > > ObjectCacheOSCacheImpl.(org.apache.ojb.broker.PersistenceBroker, > > java.util.Properties) > > > > I see that the constructors that ObjectCacheOSCacheImpl does have are > > all empty, so just for fun I added an empty constructor with the > > profile that OJB was looking for. The Properties object that is passed > > is null, by the way. > > > > Once I added this constructor, OJB ran and was fetching data from the > > database. > > all ObjectCache implementations need a specific constructor expect an PB > and Properties type. Thus you be right. > > > > I could also see log output from OSCache itself like > > "Creating cache". Also it created a disk cache directory on the > > system, but doesn't write any files there. > > > > OJB does not seem to be calling cache() or lookup() on > > ObjectCacheOSCacheImpl ( I put some logging in it to see if it was). > > > > hmm, if OJB never calls cache or lookup in ObjectCacheOSCacheImpl it > will never call these methods on all ObjectCache implementations, > because they are all handled in the same way. > Did you write a test case to check the cache? Something like > > Article a = new Article(); > Identity oid = broker.serviceIdentity().buildIdentity(a); > broker.serviceObjectCache().cache(oid, a); > > Article b = broker.serviceObjectCache().lookup(oid); > assertNotNull(b); > > This test should pass with ObjectCacheDefaultImpl and your > ObjectCacheOSCacheImpl too. > > regards, > Armin > > > > Here are my ojb properties in case there is anything relevant there: > > repositoryFile=ojb_repository.xml > > useSerializedRepository=false > > serializedRepositoryPath=. > > PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl > > PersistenceBrokerClass=org.apache.ojb.broker.core.PersistenceBrokerImpl > > maxActive=100 > > maxIdle=-1 > > maxWait=2000 > > timeBetweenEvictionRunsMillis=-1 > > minEvictableIdleTimeMillis=100 > > whenExhaustedAction=0 > > ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl > > ConnectionManagerClass=org.apache.ojb.broker.accesslayer.ConnectionManagerImpl > > SqlGeneratorClass=org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl > > IndirectionHandlerClass=org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl > > ListProxyClass=org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl > > SetProxyClass=org.apache.ojb.broker.core.proxy.SetProxyDefaultImpl > > CollectionProxyClass=org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl > > StatementManagerClass=org.apache.ojb.broker.accesslayer.StatementManager > > StatementsForClassClass=org.apache.ojb.broker.accesslayer.StatementsForClassImpl > > JdbcAccessClass=org.apache.ojb.broker.accesslayer.JdbcAccessImpl > > RowReaderDefaultClass=org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl > > ObjectCacheClass=ObjectCacheOSCacheImpl > > descriptorBasedCaches=false > > LockManagerClass=org.apache.ojb.odmg.locking.LockManagerDefaultImpl > > LockMapClass=org.apache.ojb.odmg.locking.InMemoryLockMapImpl > > LockTimeout=6 > > ImplicitLocking=true > > LockServletUrl=http://127.0.0.1:8080/ojb-lockserver > > LockAssociations=WRITE > > OqlCollectionClass=org.apache.ojb.odmg.collections.
Re: ObjectCacheOSCacheImpl issue.
Hi Michael, Michael Newton wrote: I'm trying to use OSCache with OJB as I need disk persistence. My setup is working great with the other cache implementations. I got ObjectCacheOSCacheImpl.java from the db-obj-1.0.1-contrib package, set up oscache-2.1, and set ObjectCacheClass to ObjectCacheOSCacheImpl in my config. When I run it I get the following error, where OJB appears to be trying to pass a Properties object to ObjectCacheOSCacheImpl's constuctor: java.lang.NoSuchMethodException: ObjectCacheOSCacheImpl.(org.apache.ojb.broker.PersistenceBroker, java.util.Properties) I see that the constructors that ObjectCacheOSCacheImpl does have are all empty, so just for fun I added an empty constructor with the profile that OJB was looking for. The Properties object that is passed is null, by the way. Once I added this constructor, OJB ran and was fetching data from the database. all ObjectCache implementations need a specific constructor expect an PB and Properties type. Thus you be right. I could also see log output from OSCache itself like "Creating cache". Also it created a disk cache directory on the system, but doesn't write any files there. OJB does not seem to be calling cache() or lookup() on ObjectCacheOSCacheImpl ( I put some logging in it to see if it was). hmm, if OJB never calls cache or lookup in ObjectCacheOSCacheImpl it will never call these methods on all ObjectCache implementations, because they are all handled in the same way. Did you write a test case to check the cache? Something like Article a = new Article(); Identity oid = broker.serviceIdentity().buildIdentity(a); broker.serviceObjectCache().cache(oid, a); Article b = broker.serviceObjectCache().lookup(oid); assertNotNull(b); This test should pass with ObjectCacheDefaultImpl and your ObjectCacheOSCacheImpl too. regards, Armin Here are my ojb properties in case there is anything relevant there: repositoryFile=ojb_repository.xml useSerializedRepository=false serializedRepositoryPath=. PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl PersistenceBrokerClass=org.apache.ojb.broker.core.PersistenceBrokerImpl maxActive=100 maxIdle=-1 maxWait=2000 timeBetweenEvictionRunsMillis=-1 minEvictableIdleTimeMillis=100 whenExhaustedAction=0 ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl ConnectionManagerClass=org.apache.ojb.broker.accesslayer.ConnectionManagerImpl SqlGeneratorClass=org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl IndirectionHandlerClass=org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl ListProxyClass=org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl SetProxyClass=org.apache.ojb.broker.core.proxy.SetProxyDefaultImpl CollectionProxyClass=org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl StatementManagerClass=org.apache.ojb.broker.accesslayer.StatementManager StatementsForClassClass=org.apache.ojb.broker.accesslayer.StatementsForClassImpl JdbcAccessClass=org.apache.ojb.broker.accesslayer.JdbcAccessImpl RowReaderDefaultClass=org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl ObjectCacheClass=ObjectCacheOSCacheImpl descriptorBasedCaches=false LockManagerClass=org.apache.ojb.odmg.locking.LockManagerDefaultImpl LockMapClass=org.apache.ojb.odmg.locking.InMemoryLockMapImpl LockTimeout=6 ImplicitLocking=true LockServletUrl=http://127.0.0.1:8080/ojb-lockserver LockAssociations=WRITE OqlCollectionClass=org.apache.ojb.odmg.collections.DListImpl_2 SqlInLimit=200 ImplementationClass=org.apache.ojb.odmg.ImplementationImpl OJBTxManagerClass=org.apache.ojb.odmg.LocalTxManager DListClass=org.apache.ojb.odmg.collections.DListImpl_2 DArrayClass=org.apache.ojb.odmg.collections.DListImpl_2 DMapClass=org.apache.ojb.odmg.collections.DMapImpl DBagClass=org.apache.ojb.odmg.collections.DBagImpl DSetClass=org.apache.ojb.odmg.collections.DSetImpl PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImplNew JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.JBossTransactionManagerFactory - 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]
ObjectCacheOSCacheImpl issue.
I'm trying to use OSCache with OJB as I need disk persistence. My setup is working great with the other cache implementations. I got ObjectCacheOSCacheImpl.java from the db-obj-1.0.1-contrib package, set up oscache-2.1, and set ObjectCacheClass to ObjectCacheOSCacheImpl in my config. When I run it I get the following error, where OJB appears to be trying to pass a Properties object to ObjectCacheOSCacheImpl's constuctor: java.lang.NoSuchMethodException: ObjectCacheOSCacheImpl.(org.apache.ojb.broker.PersistenceBroker, java.util.Properties) I see that the constructors that ObjectCacheOSCacheImpl does have are all empty, so just for fun I added an empty constructor with the profile that OJB was looking for. The Properties object that is passed is null, by the way. Once I added this constructor, OJB ran and was fetching data from the database. I could also see log output from OSCache itself like "Creating cache". Also it created a disk cache directory on the system, but doesn't write any files there. OJB does not seem to be calling cache() or lookup() on ObjectCacheOSCacheImpl ( I put some logging in it to see if it was). Here are my ojb properties in case there is anything relevant there: repositoryFile=ojb_repository.xml useSerializedRepository=false serializedRepositoryPath=. PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl PersistenceBrokerClass=org.apache.ojb.broker.core.PersistenceBrokerImpl maxActive=100 maxIdle=-1 maxWait=2000 timeBetweenEvictionRunsMillis=-1 minEvictableIdleTimeMillis=100 whenExhaustedAction=0 ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl ConnectionManagerClass=org.apache.ojb.broker.accesslayer.ConnectionManagerImpl SqlGeneratorClass=org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl IndirectionHandlerClass=org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl ListProxyClass=org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl SetProxyClass=org.apache.ojb.broker.core.proxy.SetProxyDefaultImpl CollectionProxyClass=org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl StatementManagerClass=org.apache.ojb.broker.accesslayer.StatementManager StatementsForClassClass=org.apache.ojb.broker.accesslayer.StatementsForClassImpl JdbcAccessClass=org.apache.ojb.broker.accesslayer.JdbcAccessImpl RowReaderDefaultClass=org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl ObjectCacheClass=ObjectCacheOSCacheImpl descriptorBasedCaches=false LockManagerClass=org.apache.ojb.odmg.locking.LockManagerDefaultImpl LockMapClass=org.apache.ojb.odmg.locking.InMemoryLockMapImpl LockTimeout=6 ImplicitLocking=true LockServletUrl=http://127.0.0.1:8080/ojb-lockserver LockAssociations=WRITE OqlCollectionClass=org.apache.ojb.odmg.collections.DListImpl_2 SqlInLimit=200 ImplementationClass=org.apache.ojb.odmg.ImplementationImpl OJBTxManagerClass=org.apache.ojb.odmg.LocalTxManager DListClass=org.apache.ojb.odmg.collections.DListImpl_2 DArrayClass=org.apache.ojb.odmg.collections.DListImpl_2 DMapClass=org.apache.ojb.odmg.collections.DMapImpl DBagClass=org.apache.ojb.odmg.collections.DBagImpl DSetClass=org.apache.ojb.odmg.collections.DSetImpl PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImplNew JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.JBossTransactionManagerFactory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]