Deal of the Day

Home » Main » Manning Forums » 2008 » Hibernate Search in Action

Thread: @Field issues

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 6 - Pages: 1 - Last Post: Dec 30, 2009 3:08 PM by: s.grinovero
KDash

Posts: 5
From: Colombia
Registered: 12/29/09
@Field issues
Posted: Dec 29, 2009 3:15 PM
  Click to reply to this thread Reply

Hello there:

When i'm using the Field annotation properties, e.g:

@Field(index=Index.TOKENIZED)

the compilation fails and sends this message:

warning: Cannot find annotation method 'index()' in type 'org.hibernate.search.annotations.Field': class file for org.hibernate.search.annotations.Field not found

However, when i don't use those properties. e.g:
@Field

it compiles with no problem.

Any help??

I really appreciate the help.

KDash

Posts: 5
From: Colombia
Registered: 12/29/09
Re: @Field issues
Posted: Dec 29, 2009 3:17 PM   in response to: KDash in response to: KDash
  Click to reply to this thread Reply

Oh:

Im using glassfish 2.1 , hibernate search 3.1.1, hibernate-core 3.3.2 and hibernate annotation 3.4

s.grinovero

Posts: 26
Registered: 4/24/08
Re: @Field issues
Posted: Dec 30, 2009 5:11 AM   in response to: KDash in response to: KDash
  Click to reply to this thread Reply

Hello KDash,
annotation without any element (like @Field with no index strategy specified) will be lazily-loaded by the classloader of your entity, so it's not trying to load the Search classes yet.
When you specify any optional element on the annotation, the annotation will be initialized.

So your problem boils down to the fact that the classloader can't find Hibernate Search when the SessionFactory is created. Using JPA? you might have to move the hibernate jars to a different library location; I've not much experience with glassfish configuration.

KDash

Posts: 5
From: Colombia
Registered: 12/29/09
Re: @Field issues
Posted: Dec 30, 2009 9:01 AM   in response to: KDash in response to: KDash
  Click to reply to this thread Reply

Hello:

I put the hibernate-search.jar in different places like: Inside Glassfish libraries, in the server domain libraries and in the project build path, but it keeps sending the same message:

warning: Cannot find annotation method 'index()' in type 'org.hibernate.search.annotations.Field': class file for org.hibernate.search.annotations.Field not found
An exception has occurred in the compiler (1.6.0_17).

should i update glassfish to 6.8 (I'm using 6.7)

john.griffin


Posts: 38
From: Layton, Utah
Registered: 11/22/07
Re: @Field issues
Posted: Dec 30, 2009 11:47 AM   in response to: KDash in response to: KDash
  Click to reply to this thread Reply

That wouldn't hurt. :>)

KDash

Posts: 5
From: Colombia
Registered: 12/29/09
Re: @Field issues
Posted: Dec 30, 2009 2:40 PM   in response to: KDash in response to: KDash
  Click to reply to this thread Reply

I meant the netbeans from 6.7 to 6.8

s.grinovero

Posts: 26
Registered: 4/24/08
Re: @Field issues
Posted: Dec 30, 2009 3:08 PM   in response to: KDash in response to: KDash
  Click to reply to this thread Reply

Please don't cross-post. Shall we continue the discussion at hibernate's forums: https://forum.hibernate.org/viewtopic.php?f=9&t=1001763

Legend
Gold: 300 + pts
Silver: 100 - 299 pts
Bronze: 25 - 99 pts
Manning Author
Manning Staff
Manning Developmental Editor