-->
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.  [ 9 posts ] 
Author Message
 Post subject: Hibernate search configuration
PostPosted: Mon May 31, 2010 7:49 am 
Newbie

Joined: Mon Apr 19, 2010 12:02 pm
Posts: 6
I am having difficulty getting the configurations to work for a project I am helping out with.

There are two parts to the project. Firstly the project itself. Configuring the hibernate.cfg.xml I couldn't get Hibernate search to work. The project is using Spring as well and when I instead put the event listeners in the applicationcontext.xml and the other configuration rows in hibernate.properties I managed to get the project to both generate lucene indexes that had correct data for me to retrieve.

Applicationcontext.xml
Code:
<bean depends-on="propertyConfigurer" id="sessionFactory"
      class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        ...
        <property name="eventListeners">
            <map>
            <entry key="post-update"> <bean class="org.hibernate.search.event.FullTextIndexEventListener"/></entry>
            <entry key="post-insert"> <bean class="org.hibernate.search.event.FullTextIndexEventListener"/></entry>
            <entry key="post-delete"> <bean class="org.hibernate.search.event.FullTextIndexEventListener"/></entry>
            </map>
        </property>
        ...
    </bean>


Hiernate.properties
Code:
hibernate.connection.username=root
hibernate.connection.password=password
hibernate.connection.url=jdbc:mysql://localhost:3306/projectname?zeroDateTimeBehavior=convertToNull
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
hibernate.search.default.indexBase=indexes
hibernate.search.default.directory_provider=org.hibernate.search.store.FSDirectoryProvider


Now I am not sure it is actually paying heed to the hibernate.properties file since the index is not created in a indexes subfolder. But the index atleast is being kept up to date with the events.

Now we get to the real issue. We have a test environment running from ANT build.xml. I am new to both Spring and Hibernate but ANT I know even less about. Running the tests I want it to be able to create and keep an updated lucene index for the tests. This code part was in the build.xml:
Code:
<target name="init-db">
        <taskdef classname="org.hibernate.tool.hbm2ddl.SchemaExportTask" classpathref="master-classpath" name="schemaexport">
            <classpath>
                <path location="src"/>
            </classpath>
        </taskdef>
        <schemaexport config="src/java/hibernate.cfg.xml" delimiter=";" drop="false" output="dist/schema.sql" />
    </target>


So I thought, hey - let's try the config mentioned in the reference material that I didn't get to work in the original project. Doing so I get the following message:

C:\Documents and Settings\User\My Documents\NetBeansProjects\ws\build.xml:62: Schema text failed: invalid configuration
BUILD FAILED (total time: 0 seconds)

The row it refers to is
Code:
<schemaexport config="src/java/hibernate.cfg.xml" delimiter=";" drop="false" output="dist/schema.sql" />
and I only get this problem with the event listeners present. I have copy pasted the code from the reference but maybe there is something I have overlooked.

hibernate.cfg.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/projectname</property>
    <property name="hibernate.connection.username">root</property>
    <property name="hibernate.connection.password">password</property>
    <property name="hibernate.current_session_context_class">thread</property>
    <property name="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</property>
    <property name="hibernate.search.default.indexBase">indexes</property>
    <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"/>
    </event>
    ...
  </session-factory>
</hibernate-configuration>


I would appreciate help in solving this problem.


Top
 Profile  
 
 Post subject: Re: Hibernate search configuration
PostPosted: Tue Jun 01, 2010 4:20 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

I am not sure whether I can help you with your concrete problems, but maybe I can give you some pointer. The Search wiki contains a post on how to use Spring + JPA + Search. From your post it is not clear whether this is helpful for you since you are not mentioning which versions of Hibernate and Search you are using and whether you are using JPA or not.

You are referring in your posts to hibernate.properties and hibernate.cfg.xml. Even though you can have both I would recommend that you unify the configuration into a single file. You did not mention why the problem was with using only hibernate.cfg.xml? Where are the indexes created now?

Regarding your test setup. It is hard to diagnose the problem without a stacktrace? Is the schemaexport task compatible with the Hibernate version you are using? Personally I would not use a file based lucene index. I would use a RAMDirectoryProvider and build/setup the right lucene index as part of each test setup. This is much cleaner and has less of a risk of test inter-dependencies. I would even recommend to run Hibernate against a in memory database for the test. Make the schema export part of the setup procedure as well in your test harness. You can look at the Hibernate Search code to see how we setup tests programmatically there.

--Hardy


Top
 Profile  
 
 Post subject: Re: Hibernate search configuration
PostPosted: Tue Jun 01, 2010 10:59 am 
Newbie

Joined: Mon Apr 19, 2010 12:02 pm
Posts: 6
Hello there Hardy!

Thank you for taking your time to try and sort this issue out. I will try to provide the information lacking for you to get a proper view of this. I am however fairly new at this so I might not be able to answer all your questions.

The project is maintaining persistence through hibernate sessions and transactions, not JPA.

The project is using hibernate 3.2.5 GA so I looked up which version of Hibernate search would be suitable and decided upon Hibernate search 3.0.0 GA.

The indexes are created in the Apache tomcat bin folder as a base and each specific index ends up in a folder named after the class path.

The issue that I first had when using only hibernate.cfg.xml was that I got errors about the listeners not being properly configured I believe. Which is why I tried to configure the event listeners in different ways.

Concerning the test environment;
The test environment works for the project fine. It is when I try to get the hibernate search functionality included into the test that things don't seem to work.

It is if I have written the events in the hibernate.cfg.xml are not being recognized or something. Maybe I am assuming wrongfully about this, I don't know.

Was this helpful in clearing things up and understanding my problem?


Top
 Profile  
 
 Post subject: Re: Hibernate search configuration
PostPosted: Tue Jun 01, 2010 11:19 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Quote:
The project is maintaining persistence through hibernate sessions and transactions, not JPA.

Ok. So you are not using Hibernate Annotations. In this case you have to indeed configure the listeners manually.

Quote:
The indexes are created in the Apache tomcat bin folder as a base and each specific index ends up in a folder named after the class path.

Well in your example you are really just using 'indexes'. Have you tried to specify a fully qualified path? If the index base is not found at all a directory relative to the directory the JVM was started from is created. This could be your tomcat bin directory. Still try using a fully qualified path.

Quote:
The issue that I first had when using only hibernate.cfg.xml was that I got errors about the listeners not being properly configured I believe. Which is why I tried to configure the event listeners in different ways.

You have to provide the full error message so that we are able to analyze the problem. Have you logging enabled. The log files should give you an indication on which files get loaded.

Quote:
Concerning the test environment;
The test environment works for the project fine. It is when I try to get the hibernate search functionality included into the test that things don't seem to work.

Again, without some more detail it is almost impossible to provide useful feedback.

--Hardy


Top
 Profile  
 
 Post subject: Re: Hibernate search configuration
PostPosted: Mon Jun 07, 2010 11:43 am 
Newbie

Joined: Mon Apr 19, 2010 12:02 pm
Posts: 6
Alright so I decided to start from the beginning instead. To get it to work with the normal project and then if I can manage to get the hibernate.cfg.xml to work properly then the ant testing would follow suit and work.

So I removed the event listeners in the applicationcontext.xml.

When I remove the listeners and try to create the initial lucene index I get an exception thrown. This is the stacktrace:

Code:
org.hibernate.HibernateException: Hibernate Search Event listeners not configured, please check the reference documentation and the application's hibernate.cfg.xml
        at org.hibernate.search.util.ContextHelper.getSearchFactoryBySFI(ContextHelper.java:32)
        at org.hibernate.search.util.ContextHelper.getSearchFactory(ContextHelper.java:18)
        at org.hibernate.search.impl.FullTextSessionImpl.getSearchFactoryImplementor(FullTextSessionImpl.java:160)
        at org.hibernate.search.impl.FullTextSessionImpl.index(FullTextSessionImpl.java:134)
        at com.tunerights.dao.TuneDAO.InitIndex(TuneDAO.java:85)
        at com.tunerights.dao.TuneDAO$$FastClassByCGLIB$$a34be56c.invoke(<generated>)
        at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
        at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
        at com.tunerights.dao.TuneDAO$$EnhancerByCGLIB$$28353a16.InitIndex(<generated>)
        at com.tunerights.medialibrary.service.TuneServiceHelper.createInitialIndex(TuneServiceHelper.java:325)
        at com.tunerights.medialibrary.service.TuneServiceHelper$$FastClassByCGLIB$$9897f8d.invoke(<generated>)
        at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
        at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:628)
        at com.tunerights.medialibrary.service.TuneServiceHelper$$EnhancerByCGLIB$$99bf39f7.createInitialIndex(<generated>)
        at com.tunerights.medialibrary.service.TuneService.createInitialIndex(TuneService.java:110)
        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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
        at $Proxy79.createInitialIndex(Unknown Source)
        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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy51.createInitialIndex(Unknown Source)
        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.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:166)
        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82)
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:117)
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:77)
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:95)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:89)
        at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:99)
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:357)
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:146)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:163)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPut(AbstractCXFServlet.java:157)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:640)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
        at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
        at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:116)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:174)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.webapp.DefaultLoginPageGeneratingFilter.doFilterHttp(DefaultLoginPageGeneratingFilter.java:86)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
        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:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
        at java.lang.Thread.run(Thread.java:619)


So I try to add the events to the hibernate.cfg.xml as it is listed in the documentation that followed the build I downloaded.

I add :
Code:
        <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"/>
        </event>

and the xml shows formatting errors. I run netbeans check xml on the file to see what it says and get the following message;
"Checking file:/C:/Documents%20and%20Settings/User/My%20Documents/NetBeansProjects/ws/src/java/hibernate.cfg.xml...
Element type "event" must be followed by either attribute specifications, ">" or "/>". [14] "

I noted something once I started looking into hibernate search which was:
A) The documentation mentioned Hibernate core and hibernate annotations need to be present. I found that hibernate annotations lib was present in the project but not hibernate core. However I found something called hibernate3.jar. I assumed this was the same classes needed and didn't concern myself much more with it seeing as I was able to get bot hte index creation, event listeners and search to work with adding the events to applicationcontext.xml.

"Table 1.1. System requirements
Java Runtime A JDK or JRE version 5 or greater. You can download a Java Runtime for Windows/Linux/Solaris here .
Hibernate Search hibernate-search.jar and all the dependencies from the lib directory of the Hibernate Search distribution, especially lucene :)
Hibernate Core This instructions have been tested against Hibernate 3.2.x. Next to the main hibernate3.jar you will need all required libaries from the lib directory of the distribution. Refer to README.txt in the lib directory of the distibution to determine the minimum runtime requirements.
Hibernate Annotations Even though Hibernate Search can be used without Hibernate Annotations the following instructions will use them for ease of use. The tutorial is tested against version 3.3.x of Hibernate Annotations."

B) It also mentioned that it would be working out of the box and the event listeners were not needed to be put in if using annotations.

"To enable Hibernate Search in Hibernate Core, add the FullTextIndexEventListener for the three Hibernate events that occur after changes are executed to the database. Once again, such a configuration is not useful with Hibernate Annotations or Hibernate EntityManager"


Since am so new to hibernate, spring, ant and hibernate search - assume have overlooked something simple. Can you see what I have missed?


Top
 Profile  
 
 Post subject: Re: Hibernate search configuration
PostPosted: Tue Jun 08, 2010 4:49 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Quote:
Code:
       
        <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"/>
        </event>

and the xml shows formatting errors. I run netbeans check xml on the file to see what it says and get the following message;
"Checking file:/C:/Documents%20and%20Settings/User/My%20Documents/NetBeansProjects/ws/src/java/hibernate.cfg.xml...
Element type "event" must be followed by either attribute specifications, ">" or "/>". [14] "

The error message says it all - you are missing a '>' to close your event node.

Quote:
I noted something once I started looking into hibernate search which was:
A) The documentation mentioned Hibernate core and hibernate annotations need to be present.

Core is required. Annotations is optional. And yes, hibernate3.jar is Hibernate Core

Quote:
B) It also mentioned that it would be working out of the box and the event listeners were not needed to be put in if using annotations.

Annotations contains some code which will detect Hibernate Search on the classpath and activate it.


Top
 Profile  
 
 Post subject: Re: Hibernate search configuration
PostPosted: Tue Jun 08, 2010 6:10 am 
Newbie

Joined: Mon Apr 19, 2010 12:02 pm
Posts: 6
Testing it.


Top
 Profile  
 
 Post subject: Re: Hibernate search configuration
PostPosted: Tue Jun 08, 2010 6:19 am 
Newbie

Joined: Mon Apr 19, 2010 12:02 pm
Posts: 6
I am suprised that the documentation was missing an end tag like that but yeah, major miss on my side to not see it.

So I put the end tag on the events in the hibernate.cfg.xml and the xml seems like it is properly formatted. Running the project and trying to create the index I still get this exception stack trace:

Code:
org.hibernate.HibernateException: Hibernate Search Event listeners not configured, please check the reference documentation and the application's hibernate.cfg.xml
        at org.hibernate.search.util.ContextHelper.getSearchFactoryBySFI(ContextHelper.java:32)
        at org.hibernate.search.util.ContextHelper.getSearchFactory(ContextHelper.java:18)
        at org.hibernate.search.impl.FullTextSessionImpl.getSearchFactoryImplementor(FullTextSessionImpl.java:160)
        at org.hibernate.search.impl.FullTextSessionImpl.index(FullTextSessionImpl.java:134)
        at com.tunerights.dao.TuneDAO.InitIndex(TuneDAO.java:85)
        at com.tunerights.dao.TuneDAO$$FastClassByCGLIB$$a34be56c.invoke(<generated>)
        at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
        at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
        at com.tunerights.dao.TuneDAO$$EnhancerByCGLIB$$41407f43.InitIndex(<generated>)
        at com.tunerights.medialibrary.service.TuneServiceHelper.createInitialIndex(TuneServiceHelper.java:325)
        at com.tunerights.medialibrary.service.TuneServiceHelper$$FastClassByCGLIB$$9897f8d.invoke(<generated>)
        at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
        at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:628)
        at com.tunerights.medialibrary.service.TuneServiceHelper$$EnhancerByCGLIB$$b2ca7f24.createInitialIndex(<generated>)
        at com.tunerights.medialibrary.service.TuneService.createInitialIndex(TuneService.java:110)
        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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
        at $Proxy79.createInitialIndex(Unknown Source)
        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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy51.createInitialIndex(Unknown Source)
        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.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:166)
        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82)
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:117)
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:77)
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:95)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:89)
        at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:99)
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:357)
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:146)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:163)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPut(AbstractCXFServlet.java:157)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:640)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
        at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
        at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:116)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:174)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.webapp.DefaultLoginPageGeneratingFilter.doFilterHttp(DefaultLoginPageGeneratingFilter.java:86)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
        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:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
        at java.lang.Thread.run(Thread.java:619)


Top
 Profile  
 
 Post subject: Re: Hibernate search configuration
PostPosted: Fri Jun 11, 2010 3:36 am 
Newbie

Joined: Mon Apr 19, 2010 12:02 pm
Posts: 6
Any theories or explanations why the stack trace complains about the hibernate.cfg.xml config file despite being configured?


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