9 Replies Latest reply on Feb 6, 2007 6:42 AM by naxo

    Configuration problems For PojoCache under JBoss AS

    naxo

      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:


      1. Jboss 4.0.5. GA (EJB3)
      2. JBossCache 1.4.1. GA

        I have looked all the available documentation that i know, which are:

        1. PojoCache User Documentation: http://labs.jboss.com/file-access/default/members/jbosscache/freezone/docs/1.4.1/PojoCache/en/html/index.html
        2. JBoss Cache Tutorial: http://labs.jboss.com/file-access/default/members/jbosscache/freezone/docs/1.4.1/tutorial/en/html_single/index.html
        3. 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:

          1. Is this xxx-cache-service.xml correct for a PojoCache under Jboss AS?
          2. 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">

          3. Is there any problem with this line in the server start up?:
            10:41:31,156 INFO [TreeCache] parseConfig(): PojoCacheConfig is empty
            

          4. 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.


        • 1. Re: Configuration problems For PojoCache under JBoss AS
          naxo

          Hello again,

          I just wonder if this is the right place for my post, Should I go to the "Beginners Corner" instead? Am I asking too much in my post? As I have told you i am a Newbie.

          Thx again at least to the people who is reading it.

          • 2. Re: Configuration problems For PojoCache under JBoss AS
            manik

            Could you pls post the full stack trace?

            • 3. Re: Configuration problems For PojoCache under JBoss AS
              naxo

              Hello, thx for your answer ;)

              Oka, this is the complete stack trace. Its a bit long. As you can see there is Warning about the cacheable object. I am using right now the class "Person" from the examples. I have used the same code, so I don't understand the warning message.

              /**
               * @author Ben Wang
               */
              @org.jboss.cache.aop.annotation.InstanceOfPojoCacheable
              public class Person {
               protected String name;
               protected Address address;
              
               ...
              
              


              This is what I am trying to do:

              1. A PojoCache running as a MBean under JBoss AS "desaladora-cache-service.xml" (the code is in the original post)

              2. This is the code that I am using (I am using EJB3 specs, and this code is inside a function of a Stateless Session Bean "DataReadingsTimerBean.class"). I am calling that function form inside a STRUTS ACTION called "ReadingSensorTimerAction.class":
               // JBoss CACHE functionality
               server = MBeanServerLocator.locateJBoss();
              
               try {
               cache = (PojoCacheMBean) MBeanProxyExt.create(PojoCacheMBean.class,
               "jboss.cache:service=DesaladoraPojoCache",
               server);
               }
               catch (MalformedObjectNameException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
               }
              
               Person joe = new Person(); // instantiate a Person object named joe
               joe.setName("Joe Black");
               Address addr = new Address(); // instantiate a Address object named addr
               addr.setCity("Sunnyvale");
               addr.setStreet("123 Albert Ave");
               addr.setZip(94086);
               joe.setAddress(addr); // set the address reference
              
               try {
              //This is line 97 from "DataReadingsTimerBean"
               cache.putObject("/aop/joe", joe);
               }
               catch (CacheException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
               } // add aop sanctioned object (and sub-objects) into cache.
              
              


              3. This is the complete stack trace:

              12:45:28,093 WARN [TreeCache] putObject(): exception occurred: java.lang.IllegalArgumentException: PojoCache.putObject(): Object type is neither aspectized nor Serializable nor an array of pri
              mitives. Object class name is stpd.component.sensors.reads.Person
              12:45:28,093 INFO [TreeCache] PojoCache.endTransaction(): rolling back tx for fqn: /aop/joe
              12:45:28,093 INFO [STDOUT] PREDESTROY ***DataReadingsTimerBean
              12:45:28,093 WARN [AbstractExceptionHandler] Unhandled exception
              javax.ejb.EJBException: java.lang.RuntimeException: PojoCache.putObject(): fqn: /aop/joe
               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)
               at $Proxy160.scheduleDataAdquisitionTimer(Unknown Source)
               at
              //This is the STRUTS ACTION
              stpd.web.struts.sensors.action.ReadingSensorTimerAction.execute(ReadingSensorTimerAction.java:70)
               at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:53)
               at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:64)
               at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
               at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
               at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
               at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
               at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
               at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
               at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:446)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
               at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
               at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
               at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
               at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
               at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
               at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
               at java.lang.Thread.run(Unknown Source)
              Caused by: java.lang.RuntimeException: PojoCache.putObject(): fqn: /aop/joe
               at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:481)
               at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:426)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
               at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
               at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
               at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
               at $Proxy167.putObject(Unknown Source)
               at
              //This is the Stateless Session Bean (EJB3)
              stpd.component.adquisition.DataReadingsTimerBean.scheduleDataAdquisitionTimer(DataReadingsTimerBean.java:97)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
               at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
               at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
               ... 47 more
              Caused by: java.lang.IllegalArgumentException: PojoCache.putObject(): Object type is neither aspectized nor Serializable nor an array of primitives. Object class name is stpd.component.sensors.
              reads.Person
               at org.jboss.cache.aop.util.AopUtil.checkObjectType(AopUtil.java:112)
               at org.jboss.cache.aop.TreeCacheAopDelegate._putObject(TreeCacheAopDelegate.java:169)
               at org.jboss.cache.aop.PojoCache._putObject(PojoCache.java:734)
               at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:465)
               ... 73 more
              12:45:28,406 WARN [ExceptionCatcher] Exception from exceptionCommand 'servlet-exception'
              javax.ejb.EJBException: java.lang.RuntimeException: PojoCache.putObject(): fqn: /aop/joe
               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)
               at $Proxy160.scheduleDataAdquisitionTimer(Unknown Source)
               at stpd.web.struts.sensors.action.ReadingSensorTimerAction.execute(ReadingSensorTimerAction.java:70)
               at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:53)
               at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:64)
               at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
               at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
               at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
               at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
               at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
               at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
               at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:446)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
               at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
               at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
               at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
               at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
               at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
               at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
               at java.lang.Thread.run(Unknown Source)
              Caused by: java.lang.RuntimeException: PojoCache.putObject(): fqn: /aop/joe
               at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:481)
               at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:426)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
               at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
               at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
               at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
               at $Proxy167.putObject(Unknown Source)
               at stpd.component.adquisition.DataReadingsTimerBean.scheduleDataAdquisitionTimer(DataReadingsTimerBean.java:97)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
               at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
               at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
               ... 47 more
              Caused by: java.lang.IllegalArgumentException: PojoCache.putObject(): Object type is neither aspectized nor Serializable nor an array of primitives. Object class name is stpd.component.sensors.
              reads.Person
               at org.jboss.cache.aop.util.AopUtil.checkObjectType(AopUtil.java:112)
               at org.jboss.cache.aop.TreeCacheAopDelegate._putObject(TreeCacheAopDelegate.java:169)
               at org.jboss.cache.aop.PojoCache._putObject(PojoCache.java:734)
               at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:465)
               ... 73 more
              12:45:28,859 ERROR [[action]] Servlet.service() for servlet action threw exception
              javax.ejb.EJBException: java.lang.RuntimeException: PojoCache.putObject(): fqn: /aop/joe
               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)
               at $Proxy160.scheduleDataAdquisitionTimer(Unknown Source)
               at stpd.web.struts.sensors.action.ReadingSensorTimerAction.execute(ReadingSensorTimerAction.java:70)
               at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:53)
               at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:64)
               at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
               at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
               at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
               at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
               at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
               at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
               at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:446)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
               at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
               at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
               at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
               at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
               at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
               at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
               at java.lang.Thread.run(Unknown Source)
              Caused by: java.lang.RuntimeException: PojoCache.putObject(): fqn: /aop/joe
               at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:481)
               at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:426)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
               at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
               at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
               at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
               at $Proxy167.putObject(Unknown Source)
               at stpd.component.adquisition.DataReadingsTimerBean.scheduleDataAdquisitionTimer(DataReadingsTimerBean.java:97)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
               at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
               at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
               ... 47 more
              Caused by: java.lang.IllegalArgumentException: PojoCache.putObject(): Object type is neither aspectized nor Serializable nor an array of primitives. Object class name is stpd.component.sensors.
              reads.Person
               at org.jboss.cache.aop.util.AopUtil.checkObjectType(AopUtil.java:112)
               at org.jboss.cache.aop.TreeCacheAopDelegate._putObject(TreeCacheAopDelegate.java:169)
               at org.jboss.cache.aop.PojoCache._putObject(PojoCache.java:734)
               at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:465)
               ... 73 more
              


              Thx again for your time, and I hope you can help me (or anybody else). I am a newbie, so I know that I am doing something wrong, but right now I don't know what... This is the first time that I use a MBean, and the first time that I use JBoss Cache. There are some additional questions that i put in my original post, so if you could try to answer it I would be greatful... ;)

              • 4. Re: Configuration problems For PojoCache under JBoss AS
                manik

                This is a simple issue. Make sure you have aspectised the objects you want to cache. See PojoCache tutorials and examples for details.

                • 5. Re: Configuration problems For PojoCache under JBoss AS
                  naxo

                  Ok, thx. I will take a look again to the documentation, and as supposed its an easy issue, but I couldn't see it.

                  • 6. Re: Configuration problems For PojoCache under JBoss AS
                    naxo

                    Hello again,

                    I really don?t know how to aspectize the objects I want to cache. As I said in my first post, all the examples that I have found are standalone. I want to use it in the Jboss AS, so I am having problems to understand exactly what to do. Please remember that I am newbie in Jboss and JbossCache. I have read all the documentation, and examples and I am quite lost right now, so I hope you can help me.

                    According to the documentation, there are two steps needed to instrument or aspectize the POJOs via JBossAop:

                    1. Prepare POJO. Via annotation or xml declaration. For annotation either JDK 1.4 or JDK 5.0.
                    2. Instrumentation. Instrument the POJO either at compile-time or load-time. Compile-time => use the so-called aop pro-compiler to do bytecode manipulation. Load-time => you need either a special system class loader or in JDK 5.0 you use the javaagent option.

                    I want to use JDK 5.0 via annotation and also I want to use the load-time mode (I don?t want to do any pre-compilation at all). I think that this way is easy for a beginner like me in JbossCache. No xml files, no pre-compilation? just annotation

                    I am using JBossCache 1.4.1. GA under Jboss 4.0.5. GA (EJB3).

                    -- POJO declaration --

                    For the first step, I am using two classes from example directory (JBossCache-1.4.1.GA\examples\PojoCache\annotated50), Person.java and Address.java. So this is the POJO declaration:

                    package stpd.component.sensors.reads;
                    
                    /**
                     * @author Ben Wang
                     */
                    @org.jboss.cache.aop.annotation.InstanceOfPojoCacheable
                    public class Person {
                     protected String name;
                     protected Address address;
                    
                     ...
                    
                    package stpd.component.sensors.reads;
                    
                    /**
                     * @author Ben Wang
                     */
                    @org.jboss.cache.aop.annotation.PojoCacheable
                    public class Address {
                     protected String city;
                     protected int zip;
                     protected String street;
                    
                     ...
                    

                    -- Instrumentation ?

                    For the second step I am using file \META-INF\jboss-aop.xml:
                    <?xml version="1.0" encoding="UTF-8"?>
                    
                    <!--
                     This is the meta file to declare user's POJO as "aspectized" under
                     JBossCacheAop. User will need this file when:
                     1. Run off-line precompier, aopc, to generate the "aspectized" class
                     2. Run on-line with a special aop class loader.
                    -->
                    <aop>
                     <prepare expr="field(* @org.jboss.cache.aop.annotation.PojoCacheable->*)" />
                     <prepare expr="field(* $instanceof{@org.jboss.cache.aop.annotation.InstanceOfPojoCacheable}->*)" />
                    </aop>
                    


                    There is an example called ?annotated50? that uses JDK50 POJO Cache annotation and that can be run in load-time mode. It uses ant to build and run the example. This is how you run the example in Load-time mode:
                     <target name="run.loadtime.example" depends="compile" description="run standalone server replicator.">
                     <java classname="test.examples.StudentMaintTest" fork="yes">
                     <jvmarg value="-Djboss.aop.path=${cache_resources}/jboss-aop.xml"/>
                     <jvmarg value="-javaagent:${cache_lib-50}/jboss-aop-jdk50.jar"/>
                     <classpath refid="lib.classpath"/>
                     <classpath path="${output}/etc"/>
                     <classpath path="${build}"/>
                     </java>
                     </target>
                    

                    I am not using ant to build my project, and I don?t know how to use javaagent option for JDK 5.0.

                    Sorry and thank you agian.


                    • 7. Re: Configuration problems For PojoCache under JBoss AS

                      What is the reason that you can't use compile-time weaving inside JBoss AS? Load-time weaving is disabled by default in JBoss AS because Javassist will have a tough time to inspect all the classes during startup. As a result, we don't recommend to use load-time option while running inside JBoss AS.

                      • 8. Re: Configuration problems For PojoCache under JBoss AS

                        Please also see this jira:
                        http://jira.jboss.com/jira/browse/JBCACHE-946
                        for the how to rin PojoCache inside AS4.0.5.

                        This was contributed by a user previously so if you find anything that needs modified, please go ahead.

                        • 9. Re: Configuration problems For PojoCache under JBoss AS
                          naxo

                          Thanks Ben for your replies,

                          The document written by Jamie Reifsnyder is just what i was looking for. I didn't know exactly how to use and installed JBoss Cache inside JBoss AS. And I think you should do something like that in the documentation, cause there are lots of examples about Standalone JBoss Cache but none about the use and instalation inside JBoss AS.

                          I did more o less what Jamie Reifsnyder suggest, but at least I have a confirmation that what I did is right. There a few things that I didn't do... Any way my actual problem doesn't have nothing to do with JBoss Cache. I am not using Ant to build my application, I am using Eclipse packaging tool. As I have told you several times I am kind of newbie in J2EE and JBossCache, so I will need to study how to "Include a call to aopc (precompiler) in my build.xml script to precompile the classes for caching" But this not a problem to solve in this forum so I really thank you for your help.

                          There is something confusing for me in the documentation. Here is the exact paragraph from chapter 2.2 "Features of POJOCache":
                          http://labs.jboss.com/file-access/default/members/jbosscache/freezone/docs/1.4.1/PojoCache/en/html/intro.html#2


                          Support annotation usage. Starting from release 1.2.3, PojoCache also supports declaration of POJO through annotation under JDK1.4. JBossAop provides an annotation precompiler that a user can use to pre-process the annotation. As a result, there will be no need for jboss-aop.xml file declaration for POJOs, if annotation is preferred. The JDK5.0 annotation will be supported in the next release.


                          The JDK5.0 annotation will be supported in the next release.
                          I understand by this line that there is not an actual support for JDK 5.0 in JBossCache 1.4.1. GA. But I understand that this is a mistake, right?

                          I want to use Annotation to get rid of any xml file, and more precisely JDK 5.0. (I hope so solve my problem soon with Ant, so I can try and test JBoss Cache, I think that it's I great product and very useful)

                          Thank you again,