-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: hibernate-search and seam again
PostPosted: Tue Feb 12, 2008 8:38 am 
Newbie

Joined: Tue Feb 12, 2008 3:51 am
Posts: 6
Hello, everybody.
I'm using hibernate-search in my Seam web application. And i have the same trouble as guy from topic http://forum.hibernate.org/viewtopic.php?t=982853&postdays=0&postorder=asc&start=0.

I'm using JBoss 4.2.1.ga, seam 2.0.0.ga, hibernate-commons-annotations 3.0.0.ga, hibernate-search 3.0.0.ga, oracle 10g.

Here is my persistence.xml
Code:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
             version="1.0">
   <persistence-unit name="srachPersistenceUnit">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>java:/sracherDS</jta-data-source>
      <properties>
         <property name="hibernate.hbm2ddl.auto" value="update"/>
         <property name="hibernate.show_sql" value="true"/>
         <!-- These are the default for JBoss EJB3, but not for HEM: -->
         <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
         <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>

         <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />

         <property name="jboss.entity.manager.factory.jndi.name"
                   value="java:/myEntityManagerFactory" />
      </properties>
   </persistence-unit>
</persistence>


components.xml
Code:
...
<persistence:managed-persistence-context name="entityManager"
                                      auto-create="true"
                       persistence-unit-jndi-name="java:/myEntityManagerFactory" />
...


code :
Code:
...
@In
private EntityManager entityManager;
...
System.out.println("entityManager = " + entityManager);

FullTextEntityManager fullTextManager = Search.createFullTextEntityManager(entityManager);
System.out.println("fullTextManager = " + fullTextManager);

MultiFieldQueryParser parser = new MultiFieldQueryParser( new String[]{"title", "description"},
                  new StandardAnalyzer());
System.out.println("parser = " + parser);

Query query = parser.parse(searchQuery);
System.out.println("query = " + query);

FullTextQuery fullTextQuery = fullTextManager.createFullTextQuery(query, Discussion.class);
                System.out.println("fullTextQuery = " + fullTextQuery);
...


console output:
Code:
14:57:03,902 INFO  [STDOUT] entityManager = org.jboss.seam.persistence.FullTextEntityManagerProxy@3c6b88                   
14:57:03,902 INFO  [STDOUT] fullTextManager = org.hibernate.search.jpa.impl.FullTextEntityManagerImpl@b7ea5c               
14:57:03,902 INFO  [STDOUT] parser = org.apache.lucene.queryParser.MultiFieldQueryParser@7b7bee                           
14:57:03,902 INFO  [STDOUT] query = title:3 description:3                                                                 



If i change:
@In
private EntityManager entityManager;

to
@In
private FullTextEntityManager entityManager;

...nothing happens:) I get the same exception.

If i use session instead of entity manager - i get the same.

If i update Seam from 2.0.0.ga to 2.0.1.ga (in which this problem must be fixed), then i get following message :

Code:
14:57:03,902 WARN  [HibernatePersistenceProvider] Unable to wrap into a FullTextSessionProxy, regular SessionProxy returned


and then:

Code:
java.lang.reflect.InvocationTargetException                                                                               
        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.seam.persistence.HibernatePersistenceProvider.proxySession(HibernatePersistenceProvider.java:97)     
        at org.jboss.seam.persistence.HibernatePersistenceProvider.proxyDelegate(HibernatePersistenceProvider.java:116)   
        at org.jboss.seam.persistence.EntityManagerProxy.getDelegate(EntityManagerProxy.java:95)                         
        at org.hibernate.search.jpa.impl.FullTextEntityManagerImpl.getFullTextSession(FullTextEntityManagerImpl.java:32) 
        at org.hibernate.search.jpa.impl.FullTextEntityManagerImpl.createFullTextQuery(FullTextEntityManagerImpl.java:60)
        at ru.alanpoint.sracher.util.helper.SearchHelper.search(SearchHelper.java:155)                                   
        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.seam.util.Reflections.invoke(Reflections.java:21)                                                   
        at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)                         
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)                         
        at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)                       
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)                         
        at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)                           
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)                         
        at org.jboss.seam.core.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:56)                     
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)                         
        at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)                   
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)                         
        at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)                                     
        at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)                 
        at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)                             
        at ru.alanpoint.sracher.util.helper.SearchHelper_$$_javassist_3.search(SearchHelper_$$_javassist_3.java)         
        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.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328)                                         
        at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:273)                                         
        at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)                                         
        at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65)                                           
        at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)                                                         
        at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)                                       
        at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)                                   
        at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
        at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)                         
        at javax.faces.component.UICommand.broadcast(UICommand.java:383)                                                 
        at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)                                       
        at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)                                     
        at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)                                 
        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)                         
        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.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:307)                                       
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)   
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)           
        at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:307)                                       
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)   
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)           
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)                     
        at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)                               
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)                     
        at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)                               
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)                     
        at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)                                 
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)                     
        at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)                               
        at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)                                       
        at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)                                 
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)                     
        at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)                                   
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)                     
        at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)                                     
        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.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)       
        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: java.lang.ClassCastException: org.jboss.seam.persistence.FullTextHibernateSessionProxy             
        at org.hibernate.search.impl.FullTextSessionImpl.<init>(FullTextSessionImpl.java:54)                   
        at org.hibernate.search.Search.createFullTextSession(Search.java:17)                                   
        ... 91 more                                                                                           
14:57:03,964 FATAL [application] java.lang.ClassCastException: org.jboss.seam.persistence.HibernateSessionProxy


Can someone tells me what's going on?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 12, 2008 5:59 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Besides the workaround described in the original forum post, I fixed the bug.
http://jira.jboss.org/jira/browse/JBSEAM-2243

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 13, 2008 2:49 am 
Newbie

Joined: Tue Feb 12, 2008 3:51 am
Posts: 6
emmanuel wrote:
Besides the workaround described in the original forum post, I fixed the bug.
http://jira.jboss.org/jira/browse/JBSEAM-2243


Quote from http://jira.jboss.org/jira/browse/JBSEAM-2243:
"Fix Version/s: 2.1.0.A1 , 2.0.1.GA"

But as I mentioned previously, when i change Seam version to 2.0.1.ga - i get the same exception.

About workaround: do you mean inject FTEM directly ? I tried this but, as i said in my post, nothing good happens.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 19, 2008 8:04 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
TurkishPirate wrote:
But as I mentioned previously, when i change Seam version to 2.0.1.ga - i get the same exception.


I find it hard to believe, are you sure you use Seam 2.0.1? If you can reproduce, please attach a test case to a Seam JIRA ticket and assign it to me, I will need to have a second look.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.