These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]

Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: JBoss,Hibernate and Caching Issue
PostPosted: Tue Apr 18, 2006 1:26 pm 

Joined: Tue Aug 09, 2005 1:34 am
Posts: 26
Location: Bangalore

I am using Hibernate 3.1 and JBoss 4.0.2.We have integrated caching, clustering in Jboss.
Now, I keep the instance of SessionFactory in our predefined Cache which implements JBoss supported Caching Framework.
I have written a test JSP which calls the SessionFactory instance from the caching and create a session object from it and does the CRUD functions.

The problem is for the 1st request the SessionFactory object which I placed in the Cache is null.
For the 2nd and consecutive requests the SessionFactory object is retrieved from the Cache and performs the CRUD functionality properly.

But when I run the same code in the standalone application with a test program, the Test executes without any issues. Why is the behavoiur difeerent in JBoss that to the standalone application.
I have enable the use_query_cahe to true in hibernate-cfg.xml.
My hibernate-cfg.xml is: -
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
       <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
       <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:test</property>
       <property name="hibernate.connection.username">test</property>
       <property name="hibernate.connection.password">test</property> 
          <property name="hibernate.cache.use_query_cache">true</property>   

And my treecache-service.xml is:


    <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>

    <mbean code="org.jboss.cache.TreeCache"


            Configure the TransactionManager
        <attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>

        <attribute name="IsolationLevel">SERIALIZABLE</attribute>
        <attribute name="CacheMode">LOCAL</attribute>
       <attribute name="UseReplQueue">false</attribute>

       <attribute name="ReplQueueInterval">20000</attribute>
       <attribute name="ReplQueueMaxElements">5</attribute>
        <attribute name="ClusterName">TreeCache-Cluster</attribute>

        <attribute name="ClusterConfig">
                <UDP mcast_addr="" mcast_port="45566"
                    ip_ttl="32" ip_mcast="true"
                    mcast_send_buf_size="80000" mcast_recv_buf_size="150000"
                    ucast_send_buf_size="80000" ucast_recv_buf_size="150000"
                <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"/>
                <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"
               <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="false" down_thread="false"/>

        <attribute name="InitialStateRetrievalTimeout">5000</attribute>

        <attribute name="SyncReplTimeout">10000</attribute>

        <!-- Max number of milliseconds to wait for a lock acquisition -->
        <attribute name="LockAcquisitionTimeout">15000</attribute>

        <!-- Name of the eviction policy class. Not supported now. -->
        <attribute name="EvictionPolicyClass"></attribute>

        <attribute name="FetchStateOnStartup">true</attribute>



Please, let me know If I need to add any other configuraton over here.

Thanks In Advace For the solution.


Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.