2 Replies Latest reply on Aug 23, 2006 8:34 AM by suppyam

    Standalone applications and JBoss Cache

    suppyam

      Here is my scenario:
      1. I have a standalone java application that uses weblogic-connection pooling and the JBoss Cache for my data.
      2. I therefore start my weblogic server (and therefore my connection pool is deployed). Please note that my application is not deployed - it is a standalone after all!
      3. My jbosscache-config.xml is in my classpath
      4. My application is started up.
      5. I can see that the application and JBoss Cache are able to connect to the connection pool (that JNDI lookup works fine), and retrieve the data necessary.
      The exception I get is that I am unable to bind 'appcache' - which is my TreeCache JNDI name... Help please!

      If I convert this into a servlet, and deploy it WITHIN weblogic, everything works fine.

      I have put all the necessary jar files in weblogic classpath (modified startweblogic.cmd to include these jars). The xml is definitely found since I put in statements around that - and its working fine. Why is it that I cannot bind it?

      Here are my xml parameters:


       <mbean code="org.jboss.cache.TreeCache"
       name="jboss.cache:service=TreeCache">
      
       <depends>jboss:service=Naming</depends>
       <depends>jboss:service=TransactionManager</depends>
       <attribute name="NodeLockingScheme">OPTIMISTIC</attribute>
      
       <attribute name="TransactionManagerLookupClass">com.hp.util.WebLogicTransactionManagerLookup</attribute>
      
       <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
      
       <attribute name="CacheMode">REPL_SYNC</attribute>
       <attribute name="UseReplQueue">false</attribute>
      
       <attribute name="ReplQueueInterval">0</attribute>
      
       <attribute name="ReplQueueMaxElements">0</attribute>
      
       <attribute name="ClusterName">TreeCache-Cluster</attribute>
      
       <attribute name="ClusterConfig">
       <config>
       <TCP start_port="10001" bind_addr="localhost" loopback="true"/>
       <TCPPING initial_hosts="localhost[9999]" port_range="1" timeout="3000" num_initial_members="2" up_thread="true" down_thread="true" />
       <FD shun="true" up_thread="true" down_thread="true" timeout="2500" max_tries="5" />
       <VERIFY_SUSPECT timeout="1500" up_thread="false" down_thread="false"/>
       <pbcast.NAKACK gc_lag="100" retransmit_timeout="3000" up_thread="true" down_thread="true"/>
       <pbcast.STABLE desired_avg_gossip="20000" up_thread="false" down_thread="false"/>
       <pbcast.GMS join_timeout="5000" join_retry_timeout="2000" shun="true" print_local_addr="true" up_thread="true" down_thread="true"/>
       <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
       </config>
       </attribute>
      
       <attribute name="FetchStateOnStartup">true</attribute>
      
       <attribute name="InitialStateRetrievalTimeout">5000</attribute>
      
       <attribute name="SyncReplTimeout">10000</attribute>
      
       <attribute name="LockAcquisitionTimeout">15000</attribute>
      
       <attribute name="EvictionPolicyClass"></attribute>
      


      The exception that I get is:
      - TreeCache local address is 127.0.0.1:10001
      - transferred state is null (may be first member in cluster)
      - viewAccepted(): [127.0.0.1:10001|0] [127.0.0.1:10001]
      - State could not be retrieved (we are the first member in group)
      [2006-08-21 19:17:54,560] [main] DEBUG [cache.CacheManager] Application cache service running
      [2006-08-21 19:17:54,560] [main] DEBUG [cache.CacheManager] TreeCache object [18865135]
      - input_cookie is bela
      - created socket to 127.0.0.1:10001
      [2006-08-21 19:18:29,904] [main] ERROR [cache.CacheManager] Problems Saving Cache In JNDI
      javax.naming.ConfigurationException [Root exception is java.rmi.MarshalException: failed to marshal rebind(Ljava.lang.String;Ljava.lang.Object;Ljava.util.Hashtable;); nested exception is:
       java.io.NotSerializableException: org.jboss.cache.TreeCache]
       at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:45)
       at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:77)
       at weblogic.jndi.internal.WLContextImpl.translateException(WLContextImpl.java:418)
       at weblogic.jndi.internal.WLContextImpl.rebind(WLContextImpl.java:143)
       at javax.naming.InitialContext.rebind(InitialContext.java:363)
       at com.hp.util.ServiceLocator.putInContext(ServiceLocator.java:141)
      


        • 1. Re: Standalone applications and JBoss Cache
          manik

          Perhaps something in your cache is not serializable?

          • 2. Re: Standalone applications and JBoss Cache
            suppyam

            I came to the conclusion that TreeCache is not serializable, which would be strange if true... Which is why I posted the other topic "is TreeCache serializable". When binding TreeCache, its an empty object. So the process is:

            1. In my weblogic startup class, I bind an EMPTY TreeCache object. Invoke createService() and startService()
            2. In my applicatoin code, I am simply looking up this TreeCache object - and it throws an exception.

            Caused by: javax.naming.ConfigurationException [Root exception is java.rmi.MarshalException: error marshalling return; nested exception is:
             java.io.NotSerializableException: org.jboss.cache.TreeCache]
             at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:45)
             at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:77)
             at weblogic.jndi.internal.WLContextImpl.translateException(WLContextImpl.java:418)
             at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:374)
             at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:359)
             at javax.naming.InitialContext.lookup(InitialContext.java:347)
            
            


            With the same code, if I bind a TreeMap object instead, I am able to do the lookup.

            Am I missing something?