[jboss-user] [JBossCache] - Configuration problems For PojoCache under JBoss AS

Naxo do-not-reply at jboss.com
Wed Jan 24 07:59:36 EST 2007


Hello,

I am a newbie in JBoss Cache, and in J2EE in general. I am trying to configure JBoss Cache as a MBean under JBoss AS. This are the products versions that i am using:

  | *  Jboss 4.0.5. GA (EJB3)
  | *  JBossCache 1.4.1. GA
  | 
I have looked all the available documentation that i know, which are:

  | *  PojoCache User Documentation: http://labs.jboss.com/file-access/default/members/jbosscache/freezone/docs/1.4.1/PojoCache/en/html/index.html
  | *  JBoss Cache Tutorial: http://labs.jboss.com/file-access/default/members/jbosscache/freezone/docs/1.4.1/tutorial/en/html_single/index.html
  | *  JBoss Cache FAQ: http://labs.jboss.com/file-access/default/members/jbosscache/freezone/docs/1.4.1/faq/en/html/index.html
  | 
I have also studied the examples available in the JBossCache 1.4.1 GA example directory.

I want to have the PojoCache running as a MBean under JBoss AS. So this is my xxx-service.xml content:

  | <?xml version="1.0" encoding="UTF-8"?>
  | 
  | <!-- ===================================================================== -->
  | <!--                                                                       -->
  | <!--  PojoCache Service Configuration                                      -->
  | <!--                                                                       -->
  | <!-- ===================================================================== -->
  | 
  | <server>
  | 
  |     <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
  | 
  | 
  |     <!-- ==================================================================== -->
  |     <!-- Defines PojoCache configuration                                      -->
  |     <!-- ==================================================================== -->
  | 
  |     <mbean code="org.jboss.cache.aop.PojoCache" name="jboss.cache:service=DesaladoraPojoCache">
  |       <!-- Used inside JBoss AS -->
  |       <depends>jboss:service=Naming</depends>
  |       <depends>jboss:service=TransactionManager</depends>
  | 
  |       <!--
  |         Configure the TransactionManager
  |       -->      
  |       <attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
  | 
  |       <!--
  | 			Node locking scheme:
  | 			    OPTIMISTIC
  | 			    PESSIMISTIC (default)
  |       -->
  |       <attribute name="NodeLockingScheme">PESSIMISTIC</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
  |       -->
  |       <attribute name="CacheMode">LOCAL</attribute>
  | 
  |       <!-- 
  | 			Name of cluster. Needs to be the same for all clusters, in order
  | 			to find each other
  |       -->
  |       <attribute name="ClusterName">Sample-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.5" mcast_port="45577"
  |                  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"/>
  |             <VERIFY_SUSPECT timeout="1500"
  |                             up_thread="false" down_thread="false"/>
  |             <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
  |                            up_thread="false" down_thread="false"/>
  |             <pbcast.STABLE desired_avg_gossip="20000"
  |                            up_thread="false" down_thread="false"/>
  |             <UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10"
  |                      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"/>
  |          </config>
  |       </attribute>
  | 
  |    </mbean>
  | 
  | </server>
  | 
I think that the instalation is correct, cause a see through the JMX Agent View the "service=DesaladoraPojoCache" (jboss.cache). This is the message that i get when i started the server:

  | 10:41:31,015 INFO  [InterceptorChainFactory] interceptor chain is:
  | class org.jboss.cache.interceptors.CallInterceptor
  | class org.jboss.cache.interceptors.PessimisticLockInterceptor
  | class org.jboss.cache.interceptors.UnlockInterceptor
  | class org.jboss.cache.interceptors.TxInterceptor
  | class org.jboss.cache.interceptors.CacheMgmtInterceptor
  | 10:41:31,156 INFO  [TreeCache] parseConfig(): PojoCacheConfig is empty
  | 

These are my questions:

  | *  Is this xxx-cache-service.xml correct for a PojoCache under Jboss AS?
  | *  I want to use the PojoCache locally in a single JVM as a shared memory between EJB. Do I need to specify the "ClusterConfig" attribute? <attribute name="ClusterConfig">
  | *  Is there any problem with this line in the server start up?:
  | 
  |   | 10:41:31,156 INFO  [TreeCache] parseConfig(): PojoCacheConfig is empty
  |   | 
  | *  I don't see any example in the "example" directory (jboss-cache-dist-1.4.1.GA.zip) for a PojoCahe running as a MBean under JBoss AS. All examples (even in the documentation examples), correct me if I am wrong, are for a Standalone environment for a PojoCache. So I don't know exactly how to access the MBean and how to work with the cache. This is what i am trying:
  | 
  |   | 		MBeanServer	  server;
  |   | 		PojoCacheMBean	cache;
  |   | 		SensorRead test = new SensorRead(new Double("2.2"), "TestSensor", "Configuration details");
  |   | 
  |   | 		server = MBeanServerLocator.locateJBoss();
  |   | 
  |   | 		try {
  |   | 			cache = (PojoCacheMBean) MBeanProxyExt.create(PojoCacheMBean.class, 
  |   | 			                                              "jboss.cache:service=DesaladoraPojoCache", 
  |   | 			                                              server);
  |   | 			cache.putObject("/aop/sensor", test);
  |   | 		}
  |   | 		catch (MalformedObjectNameException e) {
  |   | 			// TODO Auto-generated catch block
  |   | 			e.printStackTrace();
  |   | 		}
  |   | 		catch (CacheException e) {
  |   | 			// TODO Auto-generated catch block
  |   | 			e.printStackTrace();
  |   | 		}
  |   | 
  | This is the code for SensorRead bean:
  | 
  |   | package stpd.component.sensors.reads;
  |   | 
  |   | import org.jboss.cache.aop.annotation.InstanceOfPojoCacheable;
  |   | 
  |   | /**
  |   |  * @author Nacho
  |   |  * 
  |   |  */
  |   | @SuppressWarnings("serial")
  |   | @InstanceOfPojoCacheable
  |   | public class SensorRead {
  |   | 
  |   | 	private Double	value;
  |   | 	private String	sensorName;	// Tupla type-plantLocalization
  |   | 	private String	ConfigDetails;
  |   | 
  |   | 	public SensorRead() {
  |   | 		super();
  |   | 		// TODO Auto-generated constructor stub
  |   | 	}
  |   | 
  |   | 	public SensorRead(Double value, String name, String configDetails) {
  |   | 		super();
  |   | 		this.value = value;
  |   | 		this.sensorName = name;
  |   | 		ConfigDetails = configDetails;
  |   | 	}
  |   | 
  |   | 	public String getConfigDetails() {
  |   | 		return ConfigDetails;
  |   | 	}
  |   | 
  |   | 	public void setConfigDetails(String configDetails) {
  |   | 		ConfigDetails = configDetails;
  |   | 	}
  |   | 
  |   | 	public String getSensorName() {
  |   | 		return sensorName;
  |   | 	}
  |   | 
  |   | 	public void setSensorName(String name) {
  |   | 		this.sensorName = name;
  |   | 	}
  |   | 
  |   | 	public Double getValue() {
  |   | 		return value;
  |   | 	}
  |   | 
  |   | 	public void setValue(Double value) {
  |   | 		this.value = value;
  |   | 	}
  |   | }
  |   | 
  | And this is the exception that I am getting:
  | 
  |   | 12:32:08,203 WARN  [AbstractExceptionHandler] Unhandled exception
  |   | javax.ejb.EJBException: java.lang.RuntimeException: PojoCache.putObject(): fqn: /aop/sensor
  |   |         at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
  |   |         at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
  |   |         at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
  |   |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |   |         at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
  |   |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |   |         at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
  |   |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |   |         at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
  |   |         at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:131)
  |   |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |   |         at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
  |   |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |   |         at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  |   |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |   |         at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:211)
  |   |         at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79)
  |   | ...
  |   | 
  | If you need i can put all the stack message, but is too long... and this post is getting to long already.
  | 

Thanks you in advance. JBoss Cache is a great idea and product, but i am only having problems to use it. You are doing a great job and I hope that I can resolve my actual problems, cause I am kind of stock here...

Thx again and sorry for this long post... but I am trying to put all the important and needed information.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005770#4005770

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4005770



More information about the jboss-user mailing list