I've checked my version and I even downloaded it again. I'm using JBossCache 1.2.4 version released on 20 October, so it is the final version.
Is it possible that the bug wasn't completely solved or am I doing something wrong? The error I'm having is exactely the same reported in http://jira.jboss.com/jira/browse/JBCACHE-303.
<p>How were you specifying the cache dependency? With 4.0.3SP1, adding this to a treecache's -service.xml file worked. <br/> <br/>[<depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends> | <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>]</p>
Sorry, forgot the forum hates xml :-)
Imagine it was surrounded by a "depends" tag
I have my problem solved with this include as the lookup() of my DataSource works fine now thaks to the include you recommended.
But I find curious the fact that I have a Oracle datasource defined by my self and if I try to stablish the dependency on that DataSource on the -service.xml file that datasource isn't bound before the TreeCache setCache() method in the CacheLoader, as it should be.
My DataSource is defined this way
<datasources> <local-tx-datasource> <jndi-name>agorang/alarmMonitorDB</jndi-name> <connection-url>jdbc:oracle:thin:@localhost_IP:PORT:SEQ9i</connection-url> <driver-class>oracle.jdbc.driver.OracleDriver</driver-class> <user-name>123</user-name> <password>xxx</password> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name> <blocking-timeout-millis>0</blocking-timeout-millis> <idle-timeout-minutes>1</idle-timeout-minutes> <max-pool-size>100</max-pool-size> <min-pool-size>10</min-pool-size> </local-tx-datasource> </datasources>
The "debug", when I include the dependency on my datasource looks like this:
14:25:57,546 INFO [STDOUT] super setCache 14:25:57,546 INFO [STDOUT] init() 14:25:57,562 ERROR [main][agorang.helpers.MyCacheLoader] - javax.naming.NameNotFoundException: agorang not bound 14:25:57,562 ERROR [MyCacheLoader] javax.naming.NameNotFoundException: agorang not bound 14:25:57,562 ERROR [main][agorang.helpers.MyCacheLoader] - java.lang.NullPointerException 14:25:57,562 ERROR [MyCacheLoader] java.lang.NullPointerException 14:25:57,562 INFO [STDOUT] cacheAllOperators(/pt/ptinovacao/agorang/catOperadores/) 14:25:57,562 ERROR [main][agorang.helpers.MyCacheLoader] - java.lang.NullPointerException 14:25:57,562 ERROR [MyCacheLoader] java.lang.NullPointerException 14:25:57,562 INFO [STDOUT] setCache method succeeded. 14:25:57,593 INFO [TreeCache] interceptor chain is: class org.jboss.cache.interceptors.CallInterceptor class org.jboss.cache.interceptors.PessimisticLockInterceptor class org.jboss.cache.interceptors.CacheLoaderInterceptor class org.jboss.cache.interceptors.UnlockInterceptor class org.jboss.cache.interceptors.ReplicationInterceptor class org.jboss.cache.interceptors.CacheStoreInterceptor 14:25:57,593 INFO [TreeCache] cache mode is REPL_SYNC 14:25:57,703 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=a gorang/alarmMonitorDB' to JNDI name 'java:agorang/alarmMonitorDB'
Note that the binding of the DataSource is done after is has been looked up wich causes the ERROR.
I would like to be sure thad including the dependency on the DefaultDatasource all other DataSources are bound in time to be used by methods in CacheLoader classes.
Thanks for your attention.
I don't understand -- did you make your depends on "'jboss.jca:service=DataSourceBinding,name=agorang/alarmMonitorDB"?? If not, that's what you need to do.
Sorry if I didn't make myself clear.
When I include the dependency on agorang/alarmMonitorDB it doesn't work!
When I include the dependency on DefaultDS JBoss binds the DefaultDS and the agorang/alarmMonitorDB DataSources.
So I can use my DataSource to preload TreeCache with MyCacheLoader class.