-->
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.  [ 13 posts ] 
Author Message
 Post subject: Hibernate search incomptibility of jars
PostPosted: Mon Mar 29, 2010 9:26 am 
Newbie

Joined: Mon Mar 29, 2010 9:15 am
Posts: 14
Hi All,


[application] javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoSuchMethodError: org.hibernate.search.Search.getFullTextSession(Lorg/hibernate/Session;)Lorg/hibernate/search/FullTextSession;
javax.faces.el.EvaluationException: javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoSuchMethodError: org.hibernate.search.Search.getFullTextSession(Lorg/hibernate/Session;)Lorg/hibernate/search/FullTextSession;
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
at javax.faces.component.UICommand.broadcast(UICommand.java:383)
at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
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:532)
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:178)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
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.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
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:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoSuchMethodError: org.hibernate.search.Search.getFullTextSession(Lorg/hibernate/Session;)Lorg/hibernate/search/FullTextSession;
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:95)
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:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
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.localInvoke(StatelessContainer.java:240)
at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:210)
at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:84)
at $Proxy659.testHiberSearch(Unknown Source)
at com.sirahu.apptivo.view.hr.backing.TeamsDashboard.testHiberSearch(TeamsDashboard.java:81)
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:597)
at org.apache.el.parser.AstValue.invoke(AstValue.java:131)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
... 38 more





I am getting this exception while trying with hibernate search.

I am using the following jars:
hibernate-annotations-3.4.0.GA.jar
hibernate-commons-annotations-3.1.0.GA.jar
hibernate-core-3.3.1.GA.jar
hibernate-search-3.1.1.GA.jar
lucene-core-2.9.1.jar

Any incompatibility in jar files versions?


Pls can anyone help me?

Thanks in Advance,
Sorna.K


Top
 Profile  
 
 Post subject: Re: Hibernate search incomptibility of jars
PostPosted: Tue Mar 30, 2010 3:28 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
hello,
these dependencies are almost fine (Lucene 2.9 was unsupported on version 3.1 of Hibernate Search, you better stick to Lucene 2.4.1)

The error you see makes me thing you're having a very old version of hibernate-annotations on your classpath: some years ago there was a proof of concept of org.hibernate.search.Search in that package, they where later split.
I guess this is JBoss 4.2 ? that's containing such a version of hibernate annotations in lib, so you'll have to isolate the classloader of your ear or upgrade the hibernate jars in the application server.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Hibernate search incomptibility of jars
PostPosted: Tue Mar 30, 2010 4:45 am 
Newbie

Joined: Mon Mar 29, 2010 9:15 am
Posts: 14
Thanks much for your suggestion...

Let me proceed with the new version and reply you with the positive answer!!


Regards,
Sorna Sundari.K


Top
 Profile  
 
 Post subject: Re: Hibernate search incomptibility of jars
PostPosted: Tue Mar 30, 2010 5:29 am 
Newbie

Joined: Mon Mar 29, 2010 9:15 am
Posts: 14
And also can u please tell me which version of hibernate-search.jar I have to use, if I use lucene2.9.1.jar.

Because I cant revert this jar as most of the implementations are done with this lucene2.9.1.jar.

Please let me know the things I need to do in this regard.

Thanks much,
Sorna.K


Top
 Profile  
 
 Post subject: Re: Hibernate search incomptibility of jars
PostPosted: Tue Mar 30, 2010 6:21 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
And also can u please tell me which version of hibernate-search.jar I have to use, if I use lucene2.9.1.jar.

Unfortunately that's in the works; if you download current trunk you can build it but it's not released software - some risks apply.

Current trunk is fully compatible with Lucene 2.9.x and Solr 1.4
You can still use Search 3.1.x with Lucene 2.9.x, provided you don't apply two filters at once - many changes where applied on filter; it might work but you definitely need to test your filter scenarios - we had to change some things to have our testsuite pass.

Also some analyzers need Solr, and when working with Lucene 2.9 you would need to upgrade to Solr 1.4 - this should work,
was also upgraded in trunk recently and we didn't have to change anything in the codebase, but I would assume it to be of beta quality.

If you're doing some development yet, I'd suggest to migrate to newest 3.2 builds as it contains many nice improvements and some bugfixes too.
If you need to release at production quality very soon, then either avoid using filters and the optional Solr dependency just to make sure, or change your code to Lucene 2.4

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Hibernate search incomptibility of jars
PostPosted: Tue Mar 30, 2010 7:27 am 
Newbie

Joined: Mon Mar 29, 2010 9:15 am
Posts: 14
Yeah...

Thanks much for your valid information.
Let me try the new versions...

Regards,
Sorna.K


Top
 Profile  
 
 Post subject: Re: Hibernate search incomptibility of jars
PostPosted: Wed Mar 31, 2010 2:15 am 
Newbie

Joined: Mon Mar 29, 2010 9:15 am
Posts: 14
Hi,

Now I am getting different Exception.. :(

javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
javax.faces.el.EvaluationException: javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory


I have included:
slf4j-log4j12-1.5.6.jar in my classpath and jboss default lib folder also..

Do I need to use different version of sl4j?

Please tell me the solution to solve this..

Thanks in Advance,
Sorna.K


Top
 Profile  
 
 Post subject: Re: Hibernate search incomptibility of jars
PostPosted: Wed Mar 31, 2010 2:31 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
hello,
slf4j is made of two jars, an api and an impl, you're having the impl but missing the api;

in maven terms, you need:
Quote:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.6</version>
</dependency>


you can search for any version and download the jar in any public Nexus, like:
http://repository.sourcesense.com/nexus/index.html#nexus-search;gav~org.slf4j~slf4j-api~~~

The api is a dependency of Hibernate, there are several impls which wrap the logging you really want; slf4j-log4j12 is the one which binds and delegates logging to Log4j (so that's what you need on JBoss)

version 1.5.6 should be fine, latest build of hibernate is using 1.5.9 but I think any 1.5.x will do.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Hibernate search incomptibility of jars
PostPosted: Wed Mar 31, 2010 3:09 am 
Newbie

Joined: Mon Mar 29, 2010 9:15 am
Posts: 14
Hi,

Now I used
slf4j-log4j12-1.5.2.jar
slf4j-api-1.5.2.jar

Now it throws..

javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/hibernate/event/PostCollectionRecreateEventListener
javax.faces.el.EvaluationException: javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/hibernate/event/PostCollectionRecreateEventListener

This exception.

As said earlier I use,

hibernate-search-3.1.1.GA.jar

But nowhere I found PostCollectionRecreateEventListener class.



Which combination of jar files I need to use..? Else one more jar file is needed to include?


Please help me..

Thanks in advance,
Sorna.K


Top
 Profile  
 
 Post subject: Re: Hibernate search incomptibility of jars
PostPosted: Wed Mar 31, 2010 4:39 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
that eventlistener is in hibernate core since version 3.2.6, you're not using the new version you mentioned in first post (still having classloading problems).

I'd delete all old hibernate packages in {jboss_profile}/lib, stuff like hibernate3.jar hibernate-annotations.jar hibernate-entitymanager.jar and insert the new versions and dependencies.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Hibernate search incomptibility of jars
PostPosted: Wed Mar 31, 2010 8:55 am 
Newbie

Joined: Mon Mar 29, 2010 9:15 am
Posts: 14
Well,

I tried something different now.. As a stand alone program I tried to execute hibernate search.

Which throws..

org.hibernate.HibernateException: Lucene event listener not initialized
at org.hibernate.search.util.ContextHelper.getLuceneEventListener(ContextHelper.java:24)
at org.hibernate.search.query.FullTextQueryImpl.list(FullTextQueryImpl.java:137)
at com.sirahu.apptivo.model.test.HibAccountTest.main(HibAccountTest.java:86)
java.lang.NullPointerException
at com.sirahu.apptivo.model.test.HibAccountTest.main(HibAccountTest.java:92)


This exception..

I included the following props in hibernate.cfg.xml

<event type="post-update">
<listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
</event>
<event type="post-insert">
<listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
</event>
<event type="post-delete">
<listener class="org.hibernate.search.event.FullTextIndexEventListener"/>

My piece of code goes like this:
Under main method:

----------------------------------------------------------------------------------------
Session session = HibernateUtil.getSession();

org.apache.lucene.search.Query query = null;
List<AppHrTeam> hrTeamsList = null;
try
{
System.out.println("1");



org.hibernate.search.FullTextSession fsession=org.hibernate.search.Search.createFullTextSession(session);
System.out.println("2");
QueryParser parser = new QueryParser("teamName_tokenized", new StandardAnalyzer());
try
{
System.out.println("3");
query = parser.parse("teams");
System.out.println("Query:::"+query.toString());
}
catch (ParseException e)
{
e.printStackTrace();
}
if(query == null)
{
throw new RuntimeException("Query is null");
}
System.out.println("4");


try
{

FullTextQueryImpl hibQuery = (FullTextQueryImpl) fsession.createFullTextQuery(query, AppHrTeam.class);
System.out.println("5");
hrTeamsList = hibQuery.list(); // Exception in this line
}
catch (Exception e)
{
e.printStackTrace();
}
for(AppHrTeam hrTeam : hrTeamsList)
{
fsession.index(hrTeam);
}
}
catch(Exception e)
{
e.printStackTrace();
}

-------------------------------------------------------------------------------

My Entity:
-----------------------------------------------------------
@Entity
@Table(name = "HR_TEAMS")
@Indexed
public class AppHrTeam extends AppBaseEntity implements Serializable
{
@TableGenerator(name = "TeamIdGen", table = "COM_SEQUENCE_GENERATORS", pkColumnName = "GEN_KEY", valueColumnName = "GEN_VALUE", pkColumnValue = "HR_TEAM_ID", allocationSize = 1)
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator = "TeamIdGen")
@DocumentId
@Column(name = "TEAM_ID", nullable = false)
private Long teamId;

@Column(name = "FIRM_ID", nullable = false)
private Long firmId;

@Field(index=Index.TOKENIZED ,name="teamName_tokenized")
@Column(name = "Name", nullable = false)
private String name;
....
}
------------------------------
What I have to do in this case?

Please help me..
Thanks in Advance,
Sorna.K


Top
 Profile  
 
 Post subject: Re: Hibernate search incomptibility of jars
PostPosted: Wed Mar 31, 2010 11:28 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
I think you're still using old versions of hibernate, as the listeners are registered automatically with the proper dependencies of Hibernate Search 3.1.1.GA

Quote:
org.hibernate.HibernateException: Lucene event listener not initialized
at org.hibernate.search.util.ContextHelper.getLuceneEventListener(ContextHelper.java:24)

This error above is proofing my assumption: no exceptions are thrown in ContextHelper at line 24, you're using something which is much older.

can I suggest you to try the Hibernate Search maven archetype? Using maven it will care about setting up a proper classpath, it appears you're having a lot of trouble in selecting the jars.

If you don't want to learn maven, throw out all hibernate jars which are not strictly required.
There's a nice command-line tool called JBoss Tattletale http://jboss.org/tattletale which can scan the classpath and produce a report to see what shouldn't be there, you're clearly having old stuff which needs to be removed.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Hibernate search incomptibility of jars
PostPosted: Thu Apr 01, 2010 8:40 am 
Newbie

Joined: Mon Mar 29, 2010 9:15 am
Posts: 14
Yeah...

Thank u very much for your informations...

Now without exceptions I made it work.

QueryParser parser = new QueryParser("teamName_tokenized", new StandardAnalyzer());
try
{
System.out.println("3");
query = parser.parse(SearchString);
System.out.println("Query:::"+query.toString());
}

I used this piece of code to achieve Full Text search.. It works fine...
Where the entity was like...

@Field(index=Index.TOKENIZED ,name="teamName_tokenized")
@Column(name = "Name", nullable = false)
private String name;

But I need to use WildCard search..

So I changed the code to..

public List<AppHrTeam> testHiberSearch(Long firmId, String SearchString)
{
EntityManager em = null;
org.apache.lucene.search.WildcardQuery query = null;
List<AppHrTeam> hrTeamsList = null;
try
{

em=entityManagerEJB.getEntityManager(firmId);
FullTextEntityManager ftem = org.hibernate.search.jpa.Search.getFullTextEntityManager(em);



try
{
System.out.println("3");

query = new WildcardQuery(new Term("teamName_untokenized", SearchString));
System.out.println("Query:::"+query.toString());
}
catch (Exception e)
{
e.printStackTrace();
}
if(query == null)
{
throw new RuntimeException("Query is null");
}



try
{

FullTextQuery hibQuery = ftem.createFullTextQuery(query, AppHrTeam.class);


hrTeamsList = hibQuery.getResultList();
System.out.println("Teams List:::::"+hrTeamsList);
System.out.println("Hibernate query::::::"+hibQuery.toString());
}
catch (Exception e)
{
e.printStackTrace();
}
if(hrTeamsList!=null)
{
for(AppHrTeam hrTeam : hrTeamsList)
{
ftem.index(hrTeam);
}
}
else
{
hrTeamsList=new ArrayList<AppHrTeam>();
}
}
catch(Exception e)
{
e.printStackTrace();
}
return hrTeamsList;
}

Where I am not getting any relevant results using this...

Also I changed my entity as,

@Field(index=Index.UN_TOKENIZED ,name="teamName_untokenized")
@Column(name = "Name", nullable = false)
private String name;


to get all resuts wat i need to do...

can u please help me...


Thanks in advance,
Sorna.K


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 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.