6 Replies Latest reply on Aug 26, 2007 8:08 AM by Christian Pietsch

    ClassCastException - FullTextHibernateSessionProxy

    Fumihiko Sugiyama Newbie

      Hi,

      my enviroments:
      JBoss AS 4.2.0.GA
      Seam 2.0.0.BETA1(CVS)
      Seam gen-generated project

      When DetachedCriteria#getExecutableCriteria in the following code is invoked,
      "java.lang.ClassCastException: org.jboss.seam.persistence.FullTextHibernateSessionProxy" is thrown.
      This code worked with Seam1.3.0.ALPHA.

      @Name("criteriaTesting")
      @Scope(ScopeType.CONVERSATION)
      public class CriteriaTestingBean implements Serializable {
       @In
       private EntityManager entityManager;
      
       private Integer minAge;
       private Integer maxAge;
      
       @Out(required=false)
       private List<Member> members;
      
      
       public void setMinAge(Integer minAge) {
       this.minAge = minAge;
       }
      
       public void setMaxAge(Integer maxAge) {
       this.maxAge = maxAge;
       }
      
       public void search() {
       Session session = (Session) entityManager.getDelegate();
      
       DetachedCriteria crit = DetachedCriteria.forClass(Member.class);
      
       if (minAge != null) {
       crit.add( ge("age", minAge) );
       }
       if (maxAge != null) {
       crit.add( le("age", maxAge) );
       }
      
       members = crit.getExecutableCriteria(session).list();
       }
      }
      


      The following: stack trace
       [testng] java.lang.ClassCastException: org.jboss.seam.persistence.FullTextHib
      ernateSessionProxy
       [testng] at org.hibernate.criterion.DetachedCriteria.getExecutableCriteri
      a(DetachedCriteria.java:52)
       [testng] at seam.study.criteria.CriteriaTestingBean.search(CriteriaTestin
      gBean.java:66)
       [testng] at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
       [testng] at org.jboss.seam.intercept.RootInvocationContext.proceed(RootIn
      vocationContext.java:31)
       [testng] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamIn
      vocationContext.java:56)
       [testng] at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(Bijecti
      onInterceptor.java:46)
       [testng] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamIn
      vocationContext.java:68)
       [testng] at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.a
      roundInvoke(ManagedEntityIdentityInterceptor.java:43)
       [testng] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamIn
      vocationContext.java:68)
       [testng] at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(R
      ollbackInterceptor.java:31)
       [testng] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamIn
      vocationContext.java:68)
       [testng] at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(Met
      hodContextInterceptor.java:42)
       [testng] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamIn
      vocationContext.java:68)
       [testng] at org.jboss.seam.intercept.RootInterceptor.invoke(RootIntercept
      or.java:106)
       [testng] at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocat
      ion(JavaBeanInterceptor.java:151)
       [testng] at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanI
      nterceptor.java:87)
       [testng] at seam.study.criteria.CriteriaTestingBean_$$_javassist_2.search
      (CriteriaTestingBean_$$_javassist_2.java)
       [testng] at seam.study.test.criteria.CriteriaTest$1.invokeApplication(Cri
      teriaTest.java:30)
       [testng] at org.jboss.seam.mock.BaseSeamTest$Request.invokeApplicationPha
      se(BaseSeamTest.java:604)
       [testng] at org.jboss.seam.mock.BaseSeamTest$Request.emulateJsfLifecycle(
      BaseSeamTest.java:556)
       [testng] at org.jboss.seam.mock.BaseSeamTest$Request.run(BaseSeamTest.jav
      a:487)
       [testng] at seam.study.test.criteria.CriteriaTest.testSearch(CriteriaTest
      .java:18)
       [testng] ... Removed 26 stack frames
      


      The following(not DetachedCriteria version) works fine with Seam 2.0.0.BETA1.
       public void search() {
       Session session = (Session) entityManager.getDelegate();
      
       Criteria crit = session.createCriteria(Member.class);
      
       if (minAge != null) {
       crit.add( ge("age", minAge) );
       }
       if (maxAge != null) {
       crit.add( le("age", maxAge) );
       }
      
       members = crit.list();
       }
      


      Do I make a mistake in how to use DetachedCriteria in Seam app?
      Thanks in advance.



        • 1. Re: ClassCastException - FullTextHibernateSessionProxy
          Gavin King Master

          Ah, thanks, please report this in Seam JIRA, I did not think of this.

          • 4. Re: ClassCastException - FullTextHibernateSessionProxy
            Fumihiko Sugiyama Newbie

            Hi,

            I tested with new Seam CVS.
            The previous code worked well in integrating testing environment(ant test),
            but the diffrent ClassCastException was thrown in JBoss AS 4.2.0.

            Caused by java.lang.ClassCastException with message: "org.hibernate.search.impl.FullTextSessionImpl"
            
            org.jboss.seam.persistence.HibernateSessionProxy.getDelegateSessionImplementor(HibernateSessionProxy.java:401)
            org.jboss.seam.persistence.HibernateSessionProxy.list(HibernateSessionProxy.java:566)
            org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
            seam.study.criteria.CriteriaTestingBean.search(CriteriaTestingBean.java:74)
            


            The following: all stack trace
            Exception during request processing:
            Caused by javax.el.ELException with message: "java.lang.ClassCastException: org.hibernate.search.impl.FullTextSessionImpl"
            
            org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
            org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:338)
            org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
            org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
            org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
            org.jboss.seam.core.Expressions$2.invoke(Expressions.java:174)
            org.jboss.seam.navigation.Pages.callAction(Pages.java:595)
            org.jboss.seam.navigation.Pages.preRender(Pages.java:297)
            org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:541)
            org.jboss.seam.jsf.SeamPhaseListener.beforeRender(SeamPhaseListener.java:473)
            org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:146)
            org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116)
            com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
            com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
            javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
            org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:70)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:87)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:63)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:46)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
            org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
            org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:40)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:140)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
            org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
            org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
            org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
            org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
            org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
            org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
            org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
            org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
            org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
            java.lang.Thread.run(Thread.java:595)
            
            Caused by java.lang.ClassCastException with message: "org.hibernate.search.impl.FullTextSessionImpl"
            
            org.jboss.seam.persistence.HibernateSessionProxy.getDelegateSessionImplementor(HibernateSessionProxy.java:401)
            org.jboss.seam.persistence.HibernateSessionProxy.list(HibernateSessionProxy.java:566)
            org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
            seam.study.criteria.CriteriaTestingBean.search(CriteriaTestingBean.java:74)
            sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            java.lang.reflect.Method.invoke(Method.java:585)
            org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
            org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
            org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
            org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
            org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:43)
            org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
            org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
            org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
            org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
            org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
            seam.study.criteria.CriteriaTestingBean_$$_javassist_2.search(CriteriaTestingBean_$$_javassist_2.java)
            sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            java.lang.reflect.Method.invoke(Method.java:585)
            org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:325)
            org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:338)
            org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
            org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
            org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
            org.jboss.seam.core.Expressions$2.invoke(Expressions.java:174)
            org.jboss.seam.navigation.Pages.callAction(Pages.java:595)
            org.jboss.seam.navigation.Pages.preRender(Pages.java:297)
            org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:541)
            org.jboss.seam.jsf.SeamPhaseListener.beforeRender(SeamPhaseListener.java:473)
            org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:146)
            org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116)
            com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
            com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
            javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
            org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:70)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:87)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:63)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:46)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
            org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
            org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:40)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:140)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
            org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
            org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
            org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
            org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
            org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
            org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
            org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
            org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
            org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
            java.lang.Thread.run(Thread.java:595)
            


            Should I open a new JIRA report?
            Thanks.


            • 5. Re: ClassCastException - FullTextHibernateSessionProxy
              Fumihiko Sugiyama Newbie

              Hi,

              I added hibernate-search.jar in my ear.
              Now my seam app works well :)

              Thanks a lot.

              • 6. Re: ClassCastException - FullTextHibernateSessionProxy
                Christian Pietsch Newbie

                I'm getting the following error (Seam CVS (082507), Jboss 4.2.1GA):


                javax.ejb.EJBTransactionRolledbackException: org.hibernate.search.impl.FullTextSessionImpl
                at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)

                ...

                Caused by: java.lang.ClassCastException: org.hibernate.search.impl.FullTextSessionImpl
                at org.jboss.seam.persistence.HibernateSessionProxy.getDelegateSessionImplementor(HibernateSessionProxy.java:401)
                at org.jboss.seam.persistence.HibernateSessionProxy.list(HibernateSessionProxy.java:566)
                at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
                at de.dvdb.generic.search.AbstractSearch.retrieveItems(AbstractSearch.java:152)


                I'm using DetachedCriteria. Adding hibernate-search.jar to my ear or jboss-libs doesn't help in this case. JIRA or me?

                - Chris