1 2 Previous Next 16 Replies Latest reply on Nov 5, 2007 5:16 PM by epbernard

    NoSuchMethodFound createFullTextQuery()

    momochone11

      Hello,

      I am having some trouble integrating Hibernate Search into my app with Seam 2.0.

      I have this method, its just copy and paste and modified abit from a Hibnerate test:

      public void testSessionWrapper() throws Exception {
       FullTextSession s = Search.createFullTextSession((org.Hibernate.Session)getEntityManager().getDelegate());
       QueryParser parser = new QueryParser( "title", new StopAnalyzer() );
      
       Query query = parser.parse( "summary:noword" );
       Class[] abc = new Class[] {
       Location.class
       };
       FullTextQuery hibQuery = s.createFullTextQuery( query,abc);
       }


      Everything COMPILES fine, but I keep on getting this exception when I try to actually search:

      Caused by: java.lang.NoSuchMethodError: org.hibernate.search.FullTextSession.createFullTextQuery(Lorg/apache/lucene/search/Query;[Ljava/lang/Class;)Lorg/hibernate/Query;
       at com.mxnmedia.siteaudit.glue.SearchAction.getSearchResults(SearchAction.java:69)


      I am using Hibernate Search Beta 4, when I deploy my app it SAYS its using Hibernate Search Beta4 , so it's using the right jar (or not?). I tried other beta versions and the deploy message does change (instead of saying using beta 4, it says uses beta #), but yet the same exception message when I search.

      Can anyone help?

        • 1. Re: NoSuchMethodFound createFullTextQuery()
          momochone11

          I also have tried this method

          public void testSessionWrapper() throws Exception {
          FullTextSession s = Search.createFullTextSession((org.Hibernate.Session)getEntityManager().getDele
          gate());
          QueryParser parser = new QueryParser( "title", new StopAnalyzer() );

          Query query = parser.parse( "summary:noword" );

          FullTextQuery hibQuery = s.createFullTextQuery( query, Location.class);
          }


          and still say, no such method.

          • 2. Re: NoSuchMethodFound createFullTextQuery()
            momochone11

            Also, I also tried WITHOUT using Search.createFullTextSession() as suggested by documentation.. I have another method that looks like this and still end up with the same exception.

            public List getSearchResults()
             {
             if(searchPattern == null)
             return null;
             if("".equals(searchPattern))
             {
             searchPattern = null;
             return getEntityManager().createQuery("select be from Location be order by date desc").getResultList();
             }
             Map boostPerField = new HashMap();
             boostPerField.put("identifier", 4f);
             String productFields[] = {
             "identifier"
             };
             QueryParser parser = new MultiFieldQueryParser(productFields, new StandardAnalyzer(), boostPerField);
             parser.setAllowLeadingWildcard(true);
             org.apache.lucene.search.Query luceneQuery = null;
             try
             {
             luceneQuery = parser.parse(searchPattern);
             }
             catch(Exception e) { }
             FullTextSession session = (FullTextSession)getEntityManager().getDelegate();
             org.hibernate.Query query = session.createFullTextQuery(luceneQuery, Location.class);
             return query.list();
            }


            I am quite lost, I followed the example, and the jars are being loaded. I don't understand why it keeps on saying NoSuchMethodFound..

            any help is appreciated!

            • 3. Re: NoSuchMethodFound createFullTextQuery()
              momochone11

              did anyone run into the same problem?

              • 4. Re: NoSuchMethodFound createFullTextQuery()
                epbernard

                Without using the Search.createFullTextSession is the right way to do it, regardless of your problem.

                What is strange is that it seems FullTextSession.createFullTextQuery() expect to return o.h.Query where it should really return org.hibernate.search.FullTextQuery.

                Which version of Seam are you using? The latest 2.0 release?

                Can you give a try with the Hibernate Search version that is bundled with the Seam distribution.

                • 5. Re: NoSuchMethodFound createFullTextQuery()
                  momochone11

                  I am using the Seam 2.0 beta that resides on CVS repositoriy, ie. not the 2.0 beta that is on the homepage, and yes I did try using Hibernate Search that comes with Seam 2.0.

                  The weird problem is that it works in the seam examples but not on my own app. That's why I am wondering if anyone else has the same problem

                  • 6. Re: NoSuchMethodFound createFullTextQuery()
                    momochone11

                    I copied the dvd example's FullSearchAction class to my project and there is indeed a warning message for the createFullTextQuery() line, I have captured a screen shot and here it is:

                    [img]http://img169.imageshack.us/img169/3862/idecf1.gif[/img]

                    strangely enough though, I open the very same class in the dvdexample project and it doesn't have that error on that line... anyone has any ideas?

                    • 7. Re: NoSuchMethodFound createFullTextQuery()
                      srpantano

                      Please momochone11, you resolved the "createFullTextQuery()" problem, because I am with the same problem and I can´t fix it.

                      thanks.

                      • 8. Re: NoSuchMethodFound createFullTextQuery()
                        momochone11

                        I have not found a solution yet, but I am working on other parts of my app right now.

                        • 9. Re: NoSuchMethodFound createFullTextQuery()
                          mrmimo

                          This problem is related to hibernate-search dependencies. For me it works when I took the libraries from it's lib dir, and replaced apropriate jboss libraries with those from hibernate-search. I had to upgrade hibernate3.jar to resolve introduced dependencies.

                          The bottom line is - current hibernate search is not compatible with current JBoss AS.

                          • 10. Re: NoSuchMethodFound createFullTextQuery()
                            momochone11

                            Thanks for your reply mrmimo, I will give that a try

                            • 11. Re: NoSuchMethodFound createFullTextQuery()
                              epbernard

                               

                              "mrmimo" wrote:
                              This problem is related to hibernate-search dependencies. For me it works when I took the libraries from it's lib dir, and replaced apropriate jboss libraries with those from hibernate-search. I had to upgrade hibernate3.jar to resolve introduced dependencies.

                              The bottom line is - current hibernate search is not compatible with current JBoss AS.


                              I beg to differ, I would like to reproduce the issue you guys are having but I have not been able to do it so far.
                              Hibernate Search is compatible with JBoss Seam 2.0 and JBoss AS 4.2 (vanilla), the DVDStore demo run in this configuration.
                              If you upgrade Hibernate Annotations / EntityManager to 3.3.x, then you no longer need to define the events,

                              • 12. Re: NoSuchMethodFound createFullTextQuery()
                                chrisky

                                I have the same problem
                                JBoss 4.2.1 with Hibernate 3.0.0 without using SEAM(in EJB)

                                 org.hibernate.Session origSession = (org.hibernate.Session)em.getDelegate();
                                 FullTextSession session = Search.createFullTextSession(origSession);
                                
                                
                                 org.hibernate.Query query;
                                 if(searchString.length() > 0) {
                                 try {
                                 MultiFieldQueryParser parser = new MultiFieldQueryParser(new String[] {"name", "note"},
                                 new StandardAnalyzer());
                                
                                 query = session.createFullTextQuery(parser.parse(searchString), Task.class);
                                 tasks = query.list();
                                 } catch (ParseException e) {
                                 log.error(e.getLocalizedMessage(), e);
                                 tasks = null;
                                 }
                                 }
                                 else {
                                 tasks = executeQuery(Task.class, "from Task");
                                 }
                                


                                javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoSuchMethodError: org.hibernate.search.FullTextSession.createFullTextQuery(Lorg/apache/lucene/search/Query;[Ljava/lang/Class;)Lorg/hibernate/Query;
                                 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.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
                                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                 at org.jboss.aspects.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:166)
                                 at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:108)
                                 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.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
                                 at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
                                 at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
                                 at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734)
                                 at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560)
                                 at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369)
                                 at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
                                


                                • 13. Re: NoSuchMethodFound createFullTextQuery()
                                  chrisky

                                  Ok I got it working...
                                  It happens that you have to copy the hiberaten-search.jar and the dependency jars to the jboss lib folder. it wont work if you got it in EAR (even i have include the jar in the application.xml)


                                  "chrisky" wrote:
                                  I have the same problem
                                  JBoss 4.2.1 with Hibernate 3.0.0 without using SEAM(in EJB)

                                   org.hibernate.Session origSession = (org.hibernate.Session)em.getDelegate();
                                   FullTextSession session = Search.createFullTextSession(origSession);
                                  
                                  
                                   org.hibernate.Query query;
                                   if(searchString.length() > 0) {
                                   try {
                                   MultiFieldQueryParser parser = new MultiFieldQueryParser(new String[] {"name", "note"},
                                   new StandardAnalyzer());
                                  
                                   query = session.createFullTextQuery(parser.parse(searchString), Task.class);
                                   tasks = query.list();
                                   } catch (ParseException e) {
                                   log.error(e.getLocalizedMessage(), e);
                                   tasks = null;
                                   }
                                   }
                                   else {
                                   tasks = executeQuery(Task.class, "from Task");
                                   }
                                  


                                  javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoSuchMethodError: org.hibernate.search.FullTextSession.createFullTextQuery(Lorg/apache/lucene/search/Query;[Ljava/lang/Class;)Lorg/hibernate/Query;
                                   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.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
                                   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                   at org.jboss.aspects.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:166)
                                   at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:108)
                                   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.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
                                   at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
                                   at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
                                   at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734)
                                   at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560)
                                   at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369)
                                   at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
                                  


                                  • 14. Re: NoSuchMethodFound createFullTextQuery()
                                    chrisky

                                    Well, it does not work... Although it fixed the search by copy the jar to jboss lib folder, it break the adding index part...

                                    javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoSuchMethodError: org.apache.lucene.document.Document.add(Lorg/apache/lucene/document/Field;)V
                                     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.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
                                     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                     at org.jboss.aspects.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:166)
                                     at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:108)
                                     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.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
                                     at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
                                     at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
                                     at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734)
                                     at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560)
                                     at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369)
                                     at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
                                    


                                    1 2 Previous Next