views:

297

answers:

2

Hi, I am using hibernate search for my application. It is well configured and running perfectly till some time back, when it stopped working suddenly. The reason according to me being the number of my model (bean) classes. I have some 90 classes, which I add to my configuration, while building my Hibernate Configuration.

When, I disable hibernate search (remove the search annotations and use Configuration instead of AnnotationsConfiguration), I try to start my application, it Works fine.

But,the same app when I enable search, it just hangs up. I tried debugging and found the exact place where it hangs.

After adding all the class to my AnnotationsConfiguration object, when I say cfg.buildSessionfactory(), It never comes out of that statement. (I have waited for hours!!!)

Also when I decrease the number of my model classes (like say to half i.e. 50) it comes out of that statement and the application works fine..

Can Someone tell why is this happening?? My versions of hibernate are: hibernate-core-3.3.1.GA.jar hibernate-annotations-3.4.0.GA.jar hibernate-commons-annotations-3.1.0.GA.jar hibernate-search-3.1.0.GA.jar

Also if need to avoid using AnnotationsConfiguration, I read that I need to configure the search event listeners explicitly.. can anyone list all the neccessary listeners and their respective classes? (I tried the standard ones given in Hibernate Search books, but they give me ClassNotFound exception and I have all the neccesarty libs in classpath)

Here are the last few lines of hibernate trace I managed to pull :

16:09:32,814  INFO AnnotationConfiguration:369 - Hibernate Validator not found: ignoring
16:09:32,892  INFO ConnectionProviderFactory:95 - Initializing connection provider: org.hibernate.connection.C3P0ConnectionProvider
16:09:32,895  INFO C3P0ConnectionProvider:103 - C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/autolinkcrmcom_data
16:09:32,898  INFO C3P0ConnectionProvider:104 - Connection properties: {user=root, password=****}
16:09:32,900  INFO C3P0ConnectionProvider:107 - autocommit mode: false
16:09:33,694  INFO SettingsFactory:116 - RDBMS: MySQL, version: 5.1.37-1ubuntu5.1
16:09:33,696  INFO SettingsFactory:117 - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.10 ( $Date: 2005/05/19 15:52:23 $, $Revision: 1.1.2.2 $ )
16:09:33,701  INFO Dialect:175 - Using dialect: org.hibernate.dialect.MySQLDialect
16:09:33,707  INFO TransactionFactoryFactory:59 - Using default transaction strategy (direct JDBC transactions)
16:09:33,709  INFO TransactionManagerLookupFactory:80 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
16:09:33,711  INFO SettingsFactory:170 - Automatic flush during beforeCompletion(): disabled
16:09:33,714  INFO SettingsFactory:174 - Automatic session close at end of transaction: disabled    16:09:32,814  INFO AnnotationConfiguration:369 - Hibernate Validator not found: ignoring
16:09:32,892  INFO ConnectionProviderFactory:95 - Initializing connection provider: org.hibernate.connection.C3P0ConnectionProvider
16:09:32,895  INFO C3P0ConnectionProvider:103 - C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/autolinkcrmcom_data
16:09:32,898  INFO C3P0ConnectionProvider:104 - Connection properties: {user=root, password=****}
16:09:32,900  INFO C3P0ConnectionProvider:107 - autocommit mode: false
16:09:33,694  INFO SettingsFactory:116 - RDBMS: MySQL, version: 5.1.37-1ubuntu5.1
16:09:33,696  INFO SettingsFactory:117 - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.10 ( $Date: 2005/05/19 15:52:23 $, $Revision: 1.1.2.2 $ )
16:09:33,701  INFO Dialect:175 - Using dialect: org.hibernate.dialect.MySQLDialect
16:09:33,707  INFO TransactionFactoryFactory:59 - Using default transaction strategy (direct JDBC transactions)
16:09:33,709  INFO TransactionManagerLookupFactory:80 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
16:09:33,711  INFO SettingsFactory:170 - Automatic flush during beforeCompletion(): disabled
16:09:33,714  INFO SettingsFactory:174 - Automatic session close at end of transaction: disabled
16:09:33,716  INFO SettingsFactory:181 - JDBC batch size: 15
16:09:33,719  INFO SettingsFactory:184 - JDBC batch updates for versioned data: disabled
16:09:33,721  INFO SettingsFactory:189 - Scrollable result sets: enabled
16:09:33,723 DEBUG SettingsFactory:193 - Wrap result sets: disabled
16:09:33,725  INFO SettingsFactory:197 - JDBC3 getGeneratedKeys(): enabled
16:09:33,727  INFO SettingsFactory:205 - Connection release mode: auto
16:09:33,730  INFO SettingsFactory:229 - Maximum outer join fetch depth: 2
16:09:33,732  INFO SettingsFactory:232 - Default batch fetch size: 1000
16:09:33,735  INFO SettingsFactory:236 - Generate SQL with comments: disabled
16:09:33,737  INFO SettingsFactory:240 - Order SQL updates by primary key: disabled
16:09:33,740  INFO SettingsFactory:244 - Order SQL inserts for batching: disabled
16:09:33,742  INFO SettingsFactory:420 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
16:09:33,744  INFO ASTQueryTranslatorFactory:47 - Using ASTQueryTranslatorFactory
16:09:33,747  INFO SettingsFactory:252 - Query language substitutions: {}
16:09:33,750  INFO SettingsFactory:257 - JPA-QL strict compliance: disabled
16:09:33,752  INFO SettingsFactory:262 - Second-level cache: enabled
16:09:33,754  INFO SettingsFactory:266 - Query cache: disabled
16:09:33,757  INFO SettingsFactory:405 - Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
16:09:33,759  INFO RegionFactoryCacheProviderBridge:61 - Cache provider: net.sf.ehcache.hibernate.EhCacheProvider
16:09:33,762  INFO SettingsFactory:276 - Optimize cache for minimal puts: disabled
16:09:33,764  INFO SettingsFactory:285 - Structured second-level cache entries: disabled
16:09:33,766  INFO SettingsFactory:314 - Statistics: disabled
16:09:33,769  INFO SettingsFactory:318 - Deleted entity synthetic identifier rollback: disabled
16:09:33,771  INFO SettingsFactory:333 - Default entity-mode: pojo
16:09:33,774  INFO SettingsFactory:337 - Named query checking : enabled
16:09:33,869  INFO Version:20 - Hibernate Search 3.1.0.GA
16:09:35,134 DEBUG DocumentBuilderIndexedEntity:157 - Field selection in projections is set to false for entity **com.xyz.abc**.
recognized hibernaterecognized hibernaterecognized hibernaterecognized hibernaterecognized hibernaterecognized hibernaterecognized hibernaterecognized hibernaterecognized hibernaterecognized hibernateDocumentBuilderIndexedEntity

Donno what the last line indicates ??? (hibernaterecognized....) After the last line it doesnt do anything (no trace too ) and just hangs....

A: 

You will need to give us more information. Can you take a thread dump and show the last few lines of your logs?

It's possible that either: - one of your entity is posing problem - some lock or file is hanging (which OS are you using? some limit the number of files open in parallel)

For the later, if on linux or unix, you can try to play with

ulimit -n <number>

Also make sure you run the index optimizer from time to time (check the Hibernate Search ref doc).

Emmanuel Bernard
I have updated my question. Please find a hbernate log trace
KCore
And the thread dump? Looks like your VM might be going wacko.
Emmanuel Bernard
For sure hibernaterecognized is not a log coming from any Hibernate piece
Emmanuel Bernard
A: 

I found out the problem. I had not annotated my super class.I have a single class which is the base class for almost all my other model classes. But it is strange that hibernate search did not give any errors nor warnings... I tried a trick to find where actually it was hanging. I built the sessionfactory in a separate thread and printed the Thread's trace every 10 odd secs. To my surprise it actually did not hang, but the stacktrace was changing, and it always was in annotaion reflection package classes.

Just to check ,I saw my super class and annotated it, and voila......it worked......

@Emmanuel Bernard: Can you just confirm why did hibernate search not give any trace or error before and just hanged??

KCore