[jboss-user] [JBossCache] - Re: JBossCache on JBoss Application Server

alohamojo do-not-reply at jboss.com
Fri May 18 05:28:10 EDT 2007


Thanks for your reply.
Now i have another problem:
Here is the configuration:

  | <server>
  |     <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
  | 
  |     <mbean code="org.jboss.cache.aop.PojoCache"
  |         name="jboss.cache:service=PojoCache">
  | 
  |         <depends>jboss:service=Naming</depends>
  |         <depends>jboss:service=TransactionManager</depends>
  |         <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>
  |                 <UDP mcast_addr="228.1.2.3" mcast_port="48866" bind_addr="192.168.1.12"
  |                     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_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>
  |         <attribute name="FetchInMemoryState">true</attribute>
  |         <attribute name="InitialStateRetrievalTimeout">15000</attribute>
  |         <attribute name="SyncReplTimeout">15000</attribute>
  |         <attribute name="LockAcquisitionTimeout">10000</attribute>
  |         <attribute name="EvictionPolicyClass"></attribute>
  |         <attribute name="UseRegionBasedMarshalling">true</attribute>
  |     </mbean>
  | 
  |    <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
  |          name="jboss.jmx:service=proxyFactory,type=jrmp,target=factory">         
  |          <attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute>         
  |          <attribute name="TargetName">jboss.cache:service=PojoCache</attribute>         
  |          <attribute name="JndiName">MyCache</attribute>          
  |          <attribute name="InvokeTargetMethod">true</attribute>          
  |          <attribute name="ExportedInterface">org.jboss.cache.aop.PojoCacheMBean</attribute>         
  |          <attribute name="ClientInterceptors">          
  |          	<iterceptors>
  |          		<interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>         		
  |          		<interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>         		
  |          		<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>         		
  |          	</iterceptors>          	
  |          </attribute>                  
  |          <depends>jboss:service=invoker,type=jrmp</depends>
  |          <depends>jboss.cache:service=PojoCache</depends>         
  |    </mbean> 
  | </server>
And here is an object i want to put in cache:

  | @org.jboss.cache.aop.annotation.InstanceOfPojoCacheable
  | public class Person {
  |    protected String name;
  |    protected Address address;
  | 
  |    public void setName(String name)   {
  |       this.name = name;
  |    }
  |    public String getName()   {
  |       return this.name;
  |    }
  |    public void setAddress(Address address)   {
  |       this.address = address;
  |    }
  |    public Address getAddress()   {
  |       return this.address;
  |    }

When i try to put object to cache like this:

  | Context jndiContext = new InitialContext();
  | PojoCacheMBean cache = (PojoCacheMBean) jndiContext.lookup("MyCache");
  | Person p = new Person();
  | p.setName("p");
  | cache.putObject("/a/b/c", p);
  | 

below error reported:

  | [java] java.lang.reflect.UndeclaredThrowableException
  |      [java] at $Proxy0.putObject(Unknown Source)
  |      [java] at test.examples.TestAS.main(TestAS.java:21)
  |      [java] Caused by: java.rmi.MarshalException: error marshalling arguments; nested exception is:
  |      [java] java.io.NotSerializableException: examples.Person
  |      [java] at sun.rmi.server.UnicastRef.invoke(Unknown Source)
  |      [java] at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
  |      [java] at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:133)
  |      [java] at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365)
  |      [java] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:197)
  |      [java] at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
  |      [java] at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:74)
  |      [java] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
  |      [java] ... 2 more
  |      [java] Caused by: java.io.NotSerializableException: examples.Person
  |      [java] at java.io.ObjectOutputStream.writeObject0(Unknown Source)
  |      [java] at java.io.ObjectOutputStream.writeArray(Unknown Source)
  |      [java] at java.io.ObjectOutputStream.writeObject0(Unknown Source)
  |      [java] at java.io.ObjectOutputStream.writeObject(Unknown Source)
  |      [java] at org.jboss.invocation.MarshalledValue.<init>(MarshalledValue.java:70)
  |      [java] at org.jboss.invocation.MarshalledInvocation.createMarshalledValue(MarshalledInvocation.java:632)
  |      [java] at org.jboss.invocation.MarshalledInvocation.writeExternal(MarshalledInvocation.java:570)
  |      [java] at java.io.ObjectOutputStream.writeExternalData(Unknown Source)
  |      [java] at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
  |      [java] at java.io.ObjectOutputStream.writeObject0(Unknown Source)
  |      [java] at java.io.ObjectOutputStream.writeObject(Unknown Source)
  |      [java] at sun.rmi.server.UnicastRef.marshalValue(Unknown Source)
  |      [java] ... 10 more
  | 

Please let me know what's wrong with my configuration.
Thanks

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

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



More information about the jboss-user mailing list