Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-5201

EJB2 Entity with cache invalidation fails to deploy with NPE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • JBossAS-5.0.0.CR1
    • JBossAS-5.0.0.Beta3
    • EJB2
    • None

      An entity with cache invalidation configured will fail to deploy. This is the cause of the failing o.j.t.cluster.multicfg.ejb2.test.CacheInvalidationUnitTestCase.

      Example bean config:

      <entity>
      <ejb-name>cif_CachedEntityPK</ejb-name>
      <configuration-name>Standard CMP 2.x EntityBean with cache invalidation</configuration-name>
      <cache-invalidation>true</cache-invalidation>
      </entity>

      Failure:

      2008-02-01 23:32:04,875 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] Starting InvalidableEntityInstanceCache...
      2008-02-01 23:32:04,878 DEBUG [org.jboss.ejb.EntityContainer] Starting failed jboss.j2ee:jndiName=local/cif_CachedEntityPK@8115601,service=EJB
      java.lang.NullPointerException
      at org.jboss.ejb.plugins.InvalidableEntityInstanceCache.start(InvalidableEntityInstanceCache.java:123)
      at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:352)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:299)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
      at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:167)
      at $Proxy5.start(Unknown Source)
      at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
      at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
      at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
      at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
      at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327)
      at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:255)
      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)
      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:622)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:411)
      at org.jboss.system.ServiceController.doChange(ServiceController.java:659)
      at org.jboss.system.ServiceController.start(ServiceController.java:431)
      .....

      Problem is JBossEntityMetaData.getCacheInvalidationConfig() can return null if jobss.xml doesn't include a cache-invalidation-config element; in 4.x it wouldn't because a default value would be set.

      Likely solution is either 1) to add a JBossEntityMetaData.determineCacheInvalidationConfig() method or 2) just lazy create a default config in JBossEntityMetaData.getCacheInvalidationConfig(). The latter is a simpler solution; the former is used elsewhere when there is a need to merge metadata from a <container-configuration/>, but there is no cache invalidation configuration in <container-configuration/>.

      Either way, this will require a new jboss-metadata release.

              bstansbe@redhat.com Brian Stansberry
              bstansbe@redhat.com Brian Stansberry
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: