1 Reply Latest reply on Nov 13, 2006 6:29 PM by Christian Gitte

    hotdeployment error (org.hibernate.cache.CacheException)

    Christian Gitte Newbie

      Hi all,

      my ejb3-application is running at
      JBoss AS 4.0.4 GA,
      TreeCache 1.2.4.SP2 in LOCAL mode,
      Hibernate Core CR5,
      Hibernate EM CR3 und
      Hibernate Annotation CR3.
      Database: Postgres 8.1.4
      I know there newer releases available, but I dont't think it's a bug.

      Problem description:
      - start JBoss AS and deploying my ear-file
      - get some information stored in db (ejb3 entity) using the web interface
      Here's everything fine.

      Now, starting a hotdeployment of my ear file
      and get the same entity like above. (exactly the same entity with the same primary key)

      The server throws an org.hibernate.cache.CacheException. I think there is an invalidation problem,
      but I didn't found a way to handle this.

      I read nearly all jboss pdf-files and forum entries (maybe I oversight something). I appreciate for every kind of help / ideas.

      greetings christian

      Stacktrace:
      2006-11-02 13:47:07,406 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/aepWeb].[action]] Servlet.service() for servlet action threw exception
       javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.cache.CacheException: org.jboss.util.NestedRuntimeException: could not get a field value by reflection getter of de.aep.inventory.db.StockPK.stockId; - nested throwable: (org.hibernate.PropertyAccessException: could not get a field value by reflection getter of de.aep.inventory.db.StockPK.stockId)
       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:78)
       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.dynamicInvoke(StatelessContainer.java:225)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:55)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
       at $Proxy103.getStockById(Unknown Source)
       at de.aep.inventory.ui.InventoryAction.stockEdit(InventoryAction.java:127)
       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:585)
       at org.apache.struts.actions.ActionDispatcher.dispatchMethod(ActionDispatcher.java:359)
       at org.apache.struts.actions.ActionDispatcher.dispatchMethod(ActionDispatcher.java:333)
       at org.apache.struts.actions.ActionDispatcher.execute(ActionDispatcher.java:220)
       at de.aep.inventory.ui.InventoryAction.execute(InventoryAction.java:47)
       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.doPost(ActionServlet.java:459)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       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.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(Thread.java:595)
      Caused by: javax.persistence.PersistenceException: org.hibernate.cache.CacheException: org.jboss.util.NestedRuntimeException: could not get a field value by reflection getter of de.aep.inventory.db.StockPK.stockId; - nested throwable: (org.hibernate.PropertyAccessException: could not get a field value by reflection getter of de.aep.inventory.db.StockPK.stockId)
       at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:647)
       at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:194)
       at org.jboss.ejb3.entity.TransactionScopedEntityManager.find(TransactionScopedEntityManager.java:164)
       at de.aep.inventory.db.InventoryDAO.getStockById(InventoryDAO.java:39)
       at de.aep.inventory.InventoryBean.getStockById(InventoryBean.java:58)
       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:585)
       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)
       ... 55 more
      Caused by: org.hibernate.cache.CacheException: org.jboss.util.NestedRuntimeException: could not get a field value by reflection getter of de.aep.inventory.db.StockPK.stockId; - nested throwable: (org.hibernate.PropertyAccessException: could not get a field value by reflection getter of de.aep.inventory.db.StockPK.stockId)
       at org.hibernate.cache.TreeCache.read(TreeCache.java:57)
       at org.hibernate.cache.TransactionalCache.get(TransactionalCache.java:31)
       at org.hibernate.event.def.DefaultLoadEventListener.loadFromSecondLevelCache(DefaultLoadEventListener.java:472)
       at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:356)
       at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:137)
       at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:193)
       at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:101)
       at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
       at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
       at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
       at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:174)
       ... 71 more
      Caused by: org.jboss.util.NestedRuntimeException: could not get a field value by reflection getter of de.aep.inventory.db.StockPK.stockId; - nested throwable: (org.hibernate.PropertyAccessException: could not get a field value by reflection getter of de.aep.inventory.db.StockPK.stockId)
       at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:4177)
       at org.jboss.cache.TreeCache.get(TreeCache.java:2728)
       at org.jboss.cache.TreeCache.get(TreeCache.java:2711)
       at org.hibernate.cache.TreeCache.read(TreeCache.java:54)
       ... 81 more
      Caused by: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of de.aep.inventory.db.StockPK.stockId
       at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:35)
       at org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValue(AbstractComponentTuplizer.java:64)
       at org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValues(AbstractComponentTuplizer.java:70)
       at org.hibernate.tuple.component.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:83)
       at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:353)
       at org.hibernate.type.ComponentType.isEqual(ComponentType.java:123)
       at org.hibernate.cache.CacheKey.equals(CacheKey.java:51)
       at EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap.eq(ConcurrentReaderHashMap.java:309)
       at EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap.get(ConcurrentReaderHashMap.java:443)
       at org.jboss.cache.Node.getOrCreateChild(Node.java:271)
       at org.jboss.cache.interceptors.PessimisticLockInterceptor.lock(PessimisticLockInterceptor.java:214)
       at org.jboss.cache.interceptors.PessimisticLockInterceptor.invoke(PessimisticLockInterceptor.java:168)
       at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:41)
       at org.jboss.cache.interceptors.UnlockInterceptor.invoke(UnlockInterceptor.java:35)
       at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:4172)
       ... 84 more
      Caused by: java.lang.IllegalArgumentException
       at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37)
       at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:18)
       at java.lang.reflect.Field.get(Field.java:357)
       at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:32)
       ... 98 more
      
      


      Entity Class:
      
      
      @Entity
      @Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
      @Table(name="stock")
      public class Stock implements Serializable {
       private static final long serialVersionUID = 5210755493607362380L;
      
       @Version
       private int version = 0;
      
       @EmbeddedId
       @AttributeOverrides(
       {
       @AttributeOverride ( name="stockid",
       column=@Column(name="stockid", unique=false, nullable=false,
       insertable=true, updatable=true, length=7)
       ),
       @AttributeOverride ( name="stockpos",
       column=@Column(name="stockpos", unique=false, nullable=false,
       insertable=true, updatable=true)
       )
       }
       )
       private StockPK pk = new StockPK();
      
       @Column(name="geometricbool", unique=false, nullable=false, insertable=true, updatable=true)
       private boolean geometricBool = false;
      
       @Column(name="contractid", unique=false, nullable=true, insertable=true, updatable=true)
       private long contractId = 0;;
      
       @Column(name="qty", unique=false, nullable=false, insertable=true, updatable=true, precision=9)
       private double qty = 0.0;
      
       @ManyToOne(cascade={}, fetch=FetchType.EAGER)
       @JoinColumn(name="unitid", unique=false, nullable=false, insertable=true, updatable=true)
       private StockUnit unitId;
      
       @ManyToOne(cascade={}, fetch=FetchType.EAGER)
       @JoinColumn(name="matid", unique=false, nullable=false, insertable=true, updatable=true)
       private Mat matId = new Mat();
      
       @ManyToOne(cascade={}, fetch=FetchType.EAGER)
       @JoinColumn(name="areaid", unique=false, nullable=false, insertable=true, updatable=true)
       private StockArea areaId = new StockArea();
      
       @Column(name="inventorylock", unique=false, nullable=false, insertable=true, updatable=true)
       private boolean inventoryLock = false;
      
       @ManyToOne(cascade={}, fetch=FetchType.LAZY)
       @JoinColumn(name="inventoryid", unique=false, nullable=true, insertable=true, updatable=true)
       private StockInventory inventoryId = new StockInventory();
      
       @OneToMany(cascade={}, fetch=FetchType.EAGER, mappedBy="stock")
       private List<StockGeometric> stockGeometric = new ArrayList<StockGeometric>();
      
      [...] getters and setters [...]
      


        • 1. Re: hotdeployment error (org.hibernate.cache.CacheException)
          Christian Gitte Newbie

          OMG

          Just a little workarround: Write a struts action or something with following code

          MBeanServer server=MBeanServerLocator.locateJBoss();
          TreeCacheMBean cache;
          cache=(TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class, "jboss.cache:service=EJB3EntityTreeCache", server);
          if (DEBUG) LOG.debug("CacheMode: " + cache.getCacheMode());
          if (DEBUG) LOG.debug("CachedEntries: \n" + cache.printDetails());
          if (DEBUG) LOG.debug("my entities in cache: " + cache.exists("/my/package"));
          
          cache.remove("/my/package");
          
          if (DEBUG) LOG.debug("my entities in cache after reset: " + cache.exists("/my/package"));


          Now, you're able to clear the second level cache manually.

          If somebody knows a possibility to do this automatically at redeploy - please reply.

          cya chris