6 Replies Latest reply on May 6, 2003 5:47 PM by chubinator

    InvalidationManager Exception

    chubinator

      Hello,

      I am trying to use the JBoss InvalidationManager and I am having problems. I've made the following calls from within my setSessionContext method:

      this.invalMgr = (org.jboss.cache.invalidation.InvalidationManagerMBean)org.jboss.system.Registry.lookup ("jboss.cache:service=InvalidationManager");
      this.ig = this.invalMgr.getInvalidationGroup ("TestInvalidator");

      The "getInvalidationGroup" call produces the following error, apparently related to a call to log.debug() in the addReference() method:

      10:18:26,083 ERROR [LogInterceptor] Unexpected Error:
      java.lang.NoSuchMethodError: org.jboss.system.ServiceMBeanSupport.access$001(Lorg/jboss/cache/invalidation/InvalidationManager;)Lorg/jboss/logging/Logger;
      at org.jboss.cache.invalidation.InvalidationManager$InvalidationGroupImpl.addReference(InvalidationManager.java:387)
      at org.jboss.cache.invalidation.InvalidationManager.getInvalidationGroup(InvalidationManager.java:89)
      at com.lcs.test.ejb.beans.MyBean.setSessionContext(MyBean.java:82)
      at com.lcs.test.ejb.impl.MyBeanSession.setSessionContext(Unknown Source)
      at org.jboss.ejb.StatelessSessionEnterpriseContext.(StatelessSessionEnterpriseContext.java:47)
      at org.jboss.ejb.plugins.StatelessSessionInstancePool.create(StatelessSessionInstancePool.java:35)
      at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:146)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:58)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:117)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:322)
      at org.jboss.ejb.Container.invoke(Container.java:674)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:88)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
      at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:109)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:82)
      at $Proxy36.getCacheValue(Unknown Source)
      at com.lcs.test.web.servlets.MyServlet.doGet(MyServlet.java:39)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:509)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)

      I initially had these calls in ejbCreate, but thinking it might have something to do with context, I moved them.

      Also of interest is that the newly created group shows up in the jmx-console.

      Any suggestions would be greatly appreciated. I'm trying to create Stateless Session Bean caches so that I don't have to rely on CMP. I'm preferring to abstract the persistence using the DAO pattern, under which I may still choose to use CMP, but prefer not to lock the developer into that.

      Thanks,
      Mark

        • 1. Re: InvalidationManager Exception

          You are doing it wrong.

          You should be accessing it through the MBeanServer

          Regards,
          Adrian

          • 2. Re: InvalidationManager Exception
            chubinator

            Thank you for the reply.

            I grabbed the sample code from existing JBoss code as I could not find an example in all my searchs and reading.

            I will look again, but in the meantime, is there a place I can find sample code? I purchased the documentation and was not able to find sample code in any of it. (I might have missed something).

            Thanks,
            Mark

            • 3. Re: InvalidationManager Exception
              chubinator

              Update:

              Well, I looked into invoking the method via the MBeanServer as you suggested using the following code:

              public void setSessionContext(SessionContext ctx)
              throws EJBException, RemoteException
              {
              System.out.println("setSessionContext() called.");
              sessionContext = ctx;
              try {
              ArrayList list = MBeanServerFactory.findMBeanServer(null);
              if (list.isEmpty())
              System.err.println("findMBeanServer returned an empty list.");
              else {
              MBeanServer server = (MBeanServer)list.get(0);
              ObjectInstance object = server.getObjectInstance(new ObjectName("jboss.cache:service=InvalidationManager"));
              // Invoke Get Invalidation Group
              Object[] parms = new Object[1];
              String[] sig = new String[1];
              parms[0] = "TestInvalidator";
              sig[0] = "java.lang.String";
              this.ig = (org.jboss.cache.invalidation.InvalidationGroup)
              server.invoke(object.getObjectName(), "getInvalidationGroup", parms, sig);
              } // else
              } catch (Exception ex) {
              throw new EJBException(ex);
              } // try/catch
              }

              It appears to produce the same error:

              19:34:44,108 ERROR [LogInterceptor] EJBException, causedBy:
              RuntimeErrorException: Error in MBean operation 'getInvalidationGroup(,java.lang.String)'
              Cause: java.lang.NoSuchMethodError: org.jboss.system.ServiceMBeanSupport.access$001(Lorg/jboss/cache/invalidation/InvalidationManager;)Lorg/jboss/logging/Logger;
              at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:307)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
              at com.lcs.test.ejb.beans.MyBean.setSessionContext(MyBean.java:97)
              ...

              What am I doing wrong? I've search the internet and documentation for insight on how to use the invalidation framework without any luck. The JBoss Clustering document explains it's use for Entity Cache Beans and suggests that the framework can be used for other invalidation schemes, but doesn't elaborate.

              Any help is greatly appreciated.

              Thanks,
              Mark

              • 4. Re: InvalidationManager Exception
                chubinator

                BTW: Would it make sense to cross-post this to either clustering or JMX?

                Thanks,
                Mark

                • 5. Re: InvalidationManager Exception

                  Actually this looks like the following bug
                  that was fixed last week.

                  http://sourceforge.net/tracker/index.php?func=detail&aid=727426&group_id=22866&atid=376685

                  The fix is in the 3.2.1 release and will be in 3.0.8

                  Regards,
                  Adrian

                  • 6. Re: InvalidationManager Exception
                    chubinator

                    Adrian, you rock! Thank you very much, that fixed it!

                    Whehew!