1 Reply Latest reply on Dec 26, 2007 6:14 PM by Pete Muir

    HibernateException: Javassist Enhancement failed ... with li

    Vincent LAUGIER Newbie

      Hello,

      we have a problem that occurs randomly depending on the hour

      the user gets to a page on which he can view a list of cheques generated with the following command :

      @Factory("cheques")
      public void loadCheques() {
      
       Employee employ = entityManager.find(Employee.class,user.getEmployee().getId());
      
       List<PaymentChequeDetails> chqs = new LinkedList<PaymentChequeDetails>();
      
       this.addCheques(employ,chqs);
      }
      
      
      public void addCheques (Employee mgr, List<PaymentChequeDetails> chqs) {
      
      
       String queryString = "SELECT pcd FROM PaymentChequeDetails pcd WHERE pcd.payment.consolidationTime is null AND pcd.employee = " + mgr.getId();
       Query query = entityManager.createQuery(queryString);
       chqs.addAll(query.getResultList());
      
       for (Employee emp : mgr.getEmployees()) {
       addCheques(emp,chqs);
       }
      
       this.cheques = chqs;
      }
      


      The class PaymentChequeDetails is linked to Payment in a oneToOne fashion
      and Payment to ServiceOrder in a ManyToOne fashion :

      @OneToOne(cascade = CascadeType.ALL)
      @JoinColumn(name="PAYMENT_ID", nullable=false)
      public Payment getPayment() {
      
       if(logger.isDebugEnabled()) {
       if (this.chequeDeposit == null) logger.trace("in PaymentChequeDetails.getPayment with chequeDeposit_id = not defined " + "and " +
       "payment_id = " + this.payment.getId());
       else logger.trace("in PaymentChequeDetails.getPayment with chequeDeposit_id = " + this.chequeDeposit.getCheckdepositId() + " and " +
       "payment_id = " + this.payment.getId());
       }
      
       return this.payment;
      }
      


      @ManyToOne(fetch = FetchType.LAZY, cascade=CascadeType.ALL)
       @JoinColumn(name = "SERVICE_ORDER_ID", nullable=false)
       public ServiceOrder getServiceOrder() {
      
       if(logger.isDebugEnabled()) {
       logger.trace("IN Payment.getServiceOrder with serviceOrder_id = " + serviceOrder.getId() + " and "
       + " payment_id = " + this.getId());
       }
      
       return this.serviceOrder;
       }
      



      Several times per day we get the following error :


      2007-12-04 09:43:30,843 ERROR [org.jboss.seam.web.ExceptionFilter] exception root cause
      javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.HibernateException: Javassist Enhancement failed: fr.helmet.portal.entity.ServiceOrder
       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       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.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
       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:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       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.stateful.StatefulContainer.localInvoke(StatefulContainer.java:204)
       at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:100)
       at $Proxy145.loadCheques(Unknown Source)
       at sun.reflect.GeneratedMethodAccessor1495.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
       at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:72)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
       at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
       at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
       at org.javassist.tmp.java.lang.Object_$$_javassist_22.loadCheques(Object_$$_javassist_22.java)
       at sun.reflect.GeneratedMethodAccessor1532.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
       at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
       at org.jboss.seam.Component.callComponentMethod(Component.java:1834)
       at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1696)
       at org.jboss.seam.Component.getInstance(Component.java:1633)
       at org.jboss.seam.Component.getInstance(Component.java:1610)
       at org.jboss.seam.Component.getInstance(Component.java:1604)
       at org.jboss.seam.jsf.SeamELResolver.getValue(SeamELResolver.java:49)
       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
       at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
       at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:45)
       at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
       at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
       at javax.faces.component.UISelectItems.getValue(UISelectItems.java:130)
       at org.jboss.seam.ui.UISelectItems.getValue(UISelectItems.java:166)
       at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:136)
       at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:49)
       at javax.faces.component.UISelectMany.matchValue(UISelectMany.java:485)
       at javax.faces.component.UISelectMany.validateValue(UISelectMany.java:454)
       at javax.faces.component.UIInput.validate(UIInput.java:867)
       at javax.faces.component.UIInput.executeValidate(UIInput.java:1065)
       at javax.faces.component.UIInput.processValidators(UIInput.java:666)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
       at javax.faces.component.UIForm.processValidators(UIForm.java:229)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
       at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:662)
       at org.ajax4jsf.component.AjaxViewRoot.access$201(AjaxViewRoot.java:59)
       at org.ajax4jsf.component.AjaxViewRoot$3.invokeRoot(AjaxViewRoot.java:321)
       at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:56)
       at org.ajax4jsf.context.AjaxContextImpl.invokeOnRegionOrRoot(AjaxContextImpl.java:173)
       at org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:335)
       at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:543)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: Javassist Enhancement failed: fr.helmet.portal.entity.ServiceOrder
       at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
       at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:73)
       at fr.helmet.portal.manager.ChequeDepositManagerBean.addCheques(ChequeDepositManagerBean.java:150)
       at fr.helmet.portal.manager.ChequeDepositManagerBean.addCheques(ChequeDepositManagerBean.java:153)
       at fr.helmet.portal.manager.ChequeDepositManagerBean.loadCheques(ChequeDepositManagerBean.java:185)
      
       at sun.reflect.GeneratedMethodAccessor1496.invoke(Unknown Source)
       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.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:37)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
       at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:37)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:63)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:51)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
       at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
       at sun.reflect.GeneratedMethodAccessor177.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
       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.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
       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)
       ... 101 more
      Caused by: org.hibernate.HibernateException: Javassist Enhancement failed: fr.helmet.portal.entity.ServiceOrder
       at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxy(JavassistLazyInitializer.java:118)
       at org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.getProxy(JavassistProxyFactory.java:48)
       at org.hibernate.tuple.entity.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:379)
       at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3455)
       at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:257)
       at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:191)
       at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
       at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
       at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:846)
       at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:557)
       at org.hibernate.type.EntityType.resolve(EntityType.java:379)
       at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116)
       at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:854)
       at org.hibernate.loader.Loader.doQuery(Loader.java:729)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
       at org.hibernate.loader.Loader.loadEntity(Loader.java:1860)
       at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
       at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
       at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3044)
       at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:395)
       at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)
       at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
       at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)
       at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
       at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
       at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:846)
       at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:557)
       at org.hibernate.type.EntityType.resolve(EntityType.java:379)
       at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116)
       at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:854)
       at org.hibernate.loader.Loader.doQuery(Loader.java:729)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
       at org.hibernate.loader.Loader.doList(Loader.java:2220)
       at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
       at org.hibernate.loader.Loader.list(Loader.java:2099)
       at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
       at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
       at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
       at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
       at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
       at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
       ... 136 more
      Caused by: java.lang.RuntimeException: Error while parsing oa.properties
       at fr.helmet.portal.oa.OAConfig.init(OAConfig.java:155)
       at fr.helmet.portal.oa.OAConfig.getInstance(OAConfig.java:176)
       at fr.helmet.portal.entity.ServiceOrder.<init>(ServiceOrder.java:72)
       at fr.helmet.portal.entity.ServiceOrder_$$_javassist_5.<init>(ServiceOrder_$$_javassist_5.java)
       at sun.reflect.GeneratedConstructorAccessor134.newInstance(Unknown Source)
       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
       at java.lang.Class.newInstance0(Class.java:350)
       at java.lang.Class.newInstance(Class.java:303)
       at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxy(JavassistLazyInitializer.java:115)
       ... 176 more
      Caused by: java.lang.Exception: Unable to find file: oa.properties
       at fr.helmet.portal.oa.OAConfig.init(OAConfig.java:66)
       ... 185 more
      Caused by: java.lang.NullPointerException
       at java.util.Properties$LineReader.readLine(Properties.java:365)
       at java.util.Properties.load(Properties.java:293)
       at fr.helmet.portal.oa.OAConfig.init(OAConfig.java:64)
       ... 185 more
      2007-12-04 09:43:30,850 ERROR [org.jboss.seam.exceptions.DebugPageHandler] redirecting to debug page
      java.lang.NullPointerException
       at java.util.Properties$LineReader.readLine(Properties.java:365)
       at java.util.Properties.load(Properties.java:293)
       at fr.helmet.portal.oa.OAConfig.init(OAConfig.java:64)
       at fr.helmet.portal.oa.OAConfig.getInstance(OAConfig.java:176)
       at fr.helmet.portal.entity.ServiceOrder.<init>(ServiceOrder.java:72)
       at fr.helmet.portal.entity.ServiceOrder_$$_javassist_5.<init>(ServiceOrder_$$_javassist_5.java)
       at sun.reflect.GeneratedConstructorAccessor134.newInstance(Unknown Source)
       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
       at java.lang.Class.newInstance0(Class.java:350)
       at java.lang.Class.newInstance(Class.java:303)
       at org.hibernate.prox
      


      where line 150 is the following in addCheques :

      chqs.addAll(query.getResultList());


      When the problem occurs, there is nothing to do except wait for a few minutes an try to display the page again

      I have put the source code of the bean as attachment as well as the log file

      thank you for your help

      Vincent