NPE occuring in OptimisticNodeInterceptor in 1.4.1SP3
bentemperton Apr 24, 2007 5:45 AMHi There,
I'm currently using JBossCache 1.4.1SP3, with Hibernate 3.2.2, using the following config files:
treecache.xml:
<server> <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/> <!-- ==================================================================== --> <!-- Defines TreeCache configuration --> <!-- ==================================================================== --> <mbean code="org.jboss.cache.TreeCache" name="jboss.cache:service=TreeCache"> <depends>jboss:service=Naming</depends> <depends>jboss:service=TransactionManager</depends> <!-- Configure the TransactionManager : no matter since Hibernate will plug in an "adapter" to its own TransactionManagerLookup strategy here --> <attribute name="TransactionManagerLookupClass">org.jboss.cache.GenericTransactionManagerLookup</attribute> <!-- Node locking scheme: OPTIMISTIC PESSIMISTIC (default) --> <attribute name="NodeLockingScheme">OPTIMISTIC</attribute> <!-- Note that this attribute is IGNORED if your NodeLockingScheme above is OPTIMISTIC. Isolation level : SERIALIZABLE REPEATABLE_READ (default) READ_COMMITTED READ_UNCOMMITTED NONE --> <attribute name="IsolationLevel">REPEATABLE_READ</attribute> <!-- Valid modes are LOCAL REPL_ASYNC REPL_SYNC INVALIDATION_ASYNC INVALIDATION_SYNC INVALIDATION_ASYNC is highly recommended as the mode for use with clustered second-level caches. --> <attribute name="CacheMode">REPL_ASYNC</attribute> <!-- Just used for async repl: use a replication queue --> <attribute name="UseReplQueue">false</attribute> <!-- Replication interval for replication queue (in ms) --> <attribute name="ReplQueueInterval">0</attribute> <!-- Max number of elements which trigger replication --> <attribute name="ReplQueueMaxElements">0</attribute> <!-- Name of cluster. Needs to be the same for all clusters, in order to find each other --> <attribute name="ClusterName">TreeCache-Cluster</attribute> <!-- JGroups protocol stack properties. Can also be a URL, e.g. file:/home/bela/default.xml <attribute name="ClusterProperties"></attribute> --> <attribute name="ClusterConfig"> <config> <!-- UDP: if you have a multihomed machine, set the bind_addr attribute to the appropriate NIC IP address --> <!-- UDP: On Windows machines, because of the media sense feature being broken with multicast (even after disabling media sense) set the loopback attribute to true --> <UDP mcast_addr="228.1.2.3" mcast_port="48866" ip_ttl="64" ip_mcast="true" mcast_send_buf_size="150000" mcast_recv_buf_size="80000" ucast_send_buf_size="150000" ucast_recv_buf_size="80000" loopback="false"/> <PING timeout="2000" num_initial_members="3" up_thread="false" down_thread="false"/> <MERGE2 min_interval="10000" max_interval="20000"/> <!-- <FD shun="true" up_thread="true" down_thread="true" />--> <FD_SOCK/> <VERIFY_SUSPECT timeout="1500" up_thread="false" down_thread="false"/> <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800" max_xmit_size="8192" up_thread="false" down_thread="false"/> <UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10" down_thread="false"/> <pbcast.STABLE desired_avg_gossip="20000" up_thread="false" down_thread="false"/> <FRAG frag_size="8192" down_thread="false" up_thread="false"/> <pbcast.GMS join_timeout="5000" join_retry_timeout="2000" shun="true" print_local_addr="true"/> <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/> </config> </attribute> <!-- Whether or not to fetch state on joining a cluster NOTE this used to be called FetchStateOnStartup and has been renamed to be more descriptive. --> <attribute name="FetchInMemoryState">false</attribute> <!-- Number of milliseconds to wait until all responses for a synchronous call have been received. --> <attribute name="SyncReplTimeout">20000</attribute> <!-- Max number of milliseconds to wait for a lock acquisition --> <attribute name="LockAcquisitionTimeout">15000</attribute> <!-- Name of the eviction policy class. --> <attribute name="EvictionPolicyClass"></attribute> <!-- Indicate whether to use marshalling or not. Set this to true if you are running under a scoped class loader, e.g., inside an application server. Default is "false". --> <attribute name="UseMarshalling">false</attribute> </mbean> </server>
hibernate.cfg.xml:
<hibernate-configuration> <session-factory> <property name="xconfigKey">LOAD_TEST_HIBERNATE_DB_KEY</property> <property name="dialect">org.hibernate.dialect.Oracle9Dialect</property> <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property> <property name="connection.url">jdbc:oracle:thin:@q-load-mgr.qxlva-dev.com:1521:LOADTEST</property> <property name="connection.username">loadtest</property> <property name="connection.password">password</property> <property name="hibernate.cache.use_query_cache">true</property> <!--JDBC connection pool (use the built-in) --> <!--<property name="connection.pool_size">1</property>--> <!-- configuration pool via c3p0--> <property name="c3p0.acquire_increment">1</property> <property name="c3p0.idle_test_period">100</property> <!-- seconds --> <property name="c3p0.max_size">10</property> <property name="c3p0.max_statements">200</property> <property name="c3p0.min_size">10</property> <property name="c3p0.timeout">1000</property> <!--property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property --> <property name="cache.provider_class">org.hibernate.cache.OptimisticTreeCacheProvider</property> <!-- JBoss Transactions Manager lookup class --> <property name="transaction.manager_lookup_class">com.qxlva.mm.dispensing.loadtest.transaction.JBossTSTransactionManagerLookup</property> <!-- Echo all executed SQL to stdout --> <property name="show_sql">false</property> <mapping resource="hbmfiles/ManagerDetails.hbm.xml"/> <mapping resource="hbmfiles/TestNugget.hbm.xml"/> <mapping resource="hbmfiles/Scenario.hbm.xml"/> <mapping resource="hbmfiles/PharmacyType.hbm.xml"/> <mapping resource="hbmfiles/ConnectedClient.hbm.xml"/> <mapping resource="hbmfiles/MessageTrace.hbm.xml"/> <mapping resource="hbmfiles/TimerCondition.hbm.xml"/> <mapping resource="hbmfiles/MessageCondition.hbm.xml"/> <mapping resource="hbmfiles/TestRun.hbm.xml"/> <mapping resource="hbmfiles/CertificateCredentials.hbm.xml"/> <mapping resource="hbmfiles/Pharmacy.hbm.xml"/> <mapping resource="hbmfiles/UserRegistration.hbm.xml"/> <mapping resource="hbmfiles/WorkUnit.hbm.xml"/> <mapping resource="hbmfiles/ScenarioInteraction.hbm.xml"/> <mapping resource="hbmfiles/Message.hbm.xml"/> <mapping resource="hbmfiles/Schedule.hbm.xml"/> <class-cache class="com.qxlva.mm.dispensing.loadtest.model.Pharmacy" usage="transactional"/> <class-cache class="com.qxlva.mm.dispensing.loadtest.model.PharmacyType" usage="transactional"/> <class-cache class="com.qxlva.mm.dispensing.loadtest.model.Scenario" usage="transactional"/> <class-cache class="com.qxlva.mm.dispensing.loadtest.model.ScenarioInteraction" usage="transactional"/> <class-cache class="com.qxlva.mm.dispensing.loadtest.model.CertificateCredentials" usage="transactional"/> <class-cache class="com.qxlva.mm.dispensing.loadtest.model.ManagerDetails" usage="transactional"/> <class-cache class="com.qxlva.mm.dispensing.loadtest.model.MessageTrace" usage="transactional"/> <class-cache class="com.qxlva.mm.dispensing.loadtest.model.MessageCondition" usage="transactional"/> <class-cache class="com.qxlva.mm.dispensing.loadtest.model.TimerCondition" usage="transactional"/> <class-cache class="com.qxlva.mm.dispensing.loadtest.model.TestNugget" usage="transactional"/> <class-cache class="com.qxlva.mm.dispensing.loadtest.model.Schedule" usage="transactional"/> <collection-cache collection="com.qxlva.mm.dispensing.loadtest.model.Pharmacy.messageMap" region="Pharmacy.messageMap" usage="transactional"/> <collection-cache collection="com.qxlva.mm.dispensing.loadtest.model.Pharmacy.completedMessageMap" region="Pharmacy.completedMessageMap" usage="transactional"/> <collection-cache collection="com.qxlva.mm.dispensing.loadtest.model.Pharmacy.scenarioInteractions" region="Pharmacy.scenarioInteractions" usage="transactional"/> <collection-cache collection="com.qxlva.mm.dispensing.loadtest.model.PharmacyType.messageLoadSchedule" region="PharmacyType.messageLoadSchedule" usage="transactional"/> <collection-cache collection="com.qxlva.mm.dispensing.loadtest.model.MessageTrace.conditions" region="MessageTrace.conditions" usage="transactional"/> <collection-cache collection="com.qxlva.mm.dispensing.loadtest.model.MessageTrace.messageTimings" region="MessageTrace.messageTimings" usage="transactional"/> <collection-cache collection="com.qxlva.mm.dispensing.loadtest.model.ScenarioInteraction.messageIds" region="ScenarioInteraction.messageIds" usage="transactional"/> <collection-cache collection="com.qxlva.mm.dispensing.loadtest.model.ManagerDetails.certificates" region="ManagerDetails.certificates" usage="transactional"/> <collection-cache collection="com.qxlva.mm.dispensing.loadtest.model.ManagerDetails.nuggets" region="ManagerDetails.nuggets" usage="transactional"/> <collection-cache collection="com.qxlva.mm.dispensing.loadtest.model.ManagerDetails.workUnits" region="ManagerDetails.workUnits" usage="transactional"/> <collection-cache collection="com.qxlva.mm.dispensing.loadtest.model.Schedule.scenarioList" region="Schedule.scenarioList" usage="transactional"/> <class-cache class="com.qxlva.mm.dispensing.loadtest.model.ConnectedClient" usage="transactional"/> <collection-cache collection="com.qxlva.mm.dispensing.loadtest.model.ManagerDetails.clientsConnected" region="ManagerDetails.clientsConnected" usage="transactional"/> </session-factory> </hibernate-configuration>
I am using the JBossTSTransactionManagerLookup from the hbcache demo, which looks like this:
public class JBossTSTransactionManagerLookup implements TransactionManagerLookup { public TransactionManager getTransactionManager(Properties properties) throws HibernateException { return com.arjuna.ats.jta.TransactionManager.transactionManager(); } public String getUserTransactionName() { throw new UnsupportedOperationException(); } }
When I try to query the database, I get the following exception:
------------------------------------------------------ GMS: address is 192.168.176.54:3315 ------------------------------------------------------- UpHandler (STATE_TRANSFER) 10:43:07,377 INFO TreeCache:4620 - viewAccepted(): [192.168.176.54:3315|0] [192.168.176.54:3315] main 10:43:07,392 INFO TreeCache:1325 - my local address is 192.168.176.54:3315 main 10:43:07,986 WARN SessionFactoryImpl:994 - JTASessionContext being used with JDBCTransactionFactory; auto-flush will not operate correctly with getCurrentSession() main 10:43:08,455 WARN arjLoggerI18N:206 - [com.arjuna.ats.arjuna.coordinator.TxControl_1] - Name of XA node not defined. Using -3f574fca:cf8:462dd12c:1 main 10:43:08,517 INFO arjLoggerI18N:185 - [com.arjuna.ats.arjuna.recovery.TransactionStatusManager_1] - Starting service com.arjuna.ats.arjuna.recovery.ActionStatusService on port 3320 main 10:43:08,517 INFO arjLogger:185 - TransactionStatusManagerItem - host: 192.168.176.54 port: 3320 main 10:43:08,533 INFO arjLoggerI18N:185 - [com.arjuna.ats.arjuna.recovery.TransactionStatusManager_3] - TransactionStatusManager started on port 3320 with service com.arjuna.ats.arjuna.recovery.ActionStatusService main 10:43:08,830 WARN TxInterceptor:332 - Rolling back, exception encountered java.lang.NullPointerException at org.jboss.cache.interceptors.OptimisticNodeInterceptor.invoke(OptimisticNodeInterceptor.java:68) at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67) at org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor.invoke(OptimisticCreateIfNotExistsInterceptor.java:68) at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67) at org.jboss.cache.interceptors.OptimisticValidatorInterceptor.invoke(OptimisticValidatorInterceptor.java:76) at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67) at org.jboss.cache.interceptors.OptimisticLockingInterceptor.invoke(OptimisticLockingInterceptor.java:116) at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67) at org.jboss.cache.interceptors.OptimisticReplicationInterceptor.invoke(OptimisticReplicationInterceptor.java:137) at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67) at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:321) at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:136) at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67) at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:181) at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:4786) at org.jboss.cache.TreeCache.remove(TreeCache.java:3299) at org.jboss.cache.TreeCache.remove(TreeCache.java:2851) at org.hibernate.cache.OptimisticTreeCache.writeLoad(OptimisticTreeCache.java:76) at org.hibernate.cache.TransactionalCache.put(TransactionalCache.java:55) at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:156) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:854) at org.hibernate.loader.Loader.doQuery(Loader.java:729) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236) at org.hibernate.loader.Loader.doList(Loader.java:2220) at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2136) at org.hibernate.loader.Loader.list(Loader.java:2096) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811) at com.qxlva.mm.dispensing.loadtest.dao.ManagerDetailsDao.getManagerDetails(ManagerDetailsDao.java:78) at TestJBossCache.main(TestJBossCache.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) main 10:43:08,861 WARN TxInterceptor:332 - Rolling back, exception encountered
Please advise as I can't find any reference to a similar problem in 1.4.1SP3 anywhere.
Thanks,
Ben