I'm trying to use hibernate search. Following this guide http://hibernate.org/search/documentation/getting-started/ I've added this two lines to hibernate.cfg.xml
Code:
<property name="hibernate.search.default.directory_provider">filesystem</property>
<property name="hibernate.search.default.indexBase">/var/lucene/indexes</property>
And in the method where will start hibernate session I've put code to sync the search index (as written into the guide).
Code:
// Hibernate starting
    Configuration configuration = new Configuration();
    configuration.configure();
    ServiceRegistry serviceRegistry =
            new StandardServiceRegistryBuilder()
                    .applySettings(
                            configuration.getProperties()
                    ).build();
    // ~Hibernate starting
    SessionFactory sessionFactory = configuration.buildSessionFactory(serviceRegistry);
    Session session = sessionFactory.getCurrentSession();
    FullTextSession fullTextSession = Search.getFullTextSession(session);
    // Close Hibernate session
    try{
        fullTextSession.createIndexer().startAndWait();
        log.info("Hibernate search index created.");
    }catch(InterruptedException e ){
        log.error( "Error during the Sync of Hibernate search on startup.", e );
    }
    try{
        session.getTransaction().commit();
    }catch( Exception ex ){
        try{
            session.getTransaction().rollback();
        }catch( Exception ex2 ){}
        log.error( ex  );
    }finally{
        if( session.isOpen() ){
            session.close();
        }
    }
The problem is that when I start the web-app I receive this error: 
Code:
org.apache.catalina.LifecycleException: org.hibernate.search.exception.SearchException: HSEARCH000222: The SearchFactory was not initialized
Please, help me to resolve out this problem, thanks in advance Andrea.