Hi,
Runing Hibernate Search as stand-alone is fine. However, runing it as EJB in Jboss application got exception UNABLE LOADED INDEXED CLASS
Below is the persistence.xml, java file and stack trace
Hibernate version: 3.2.2
Mapping documents:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/ ... ce_1_0.xsd" version="1.0">
<persistence-unit name="helloworld" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/DefaultDS</jta-data-source>
<properties>
<property name="hibernate.ejb.cfgfile"
value="hibernate.cfg.xml"/>
<property name="hibernate.search.default.indexBase"
value="c:\lucene\indexes"/>
<property name="hibernate.search.default.directory_provider"
value="org.hibernate.search.store.FSDirectoryProvider"/>
</properties>
</persistence-unit>
</persistence>
Code between sessionFactory.openSession() and session.close():
Object o = em.getDelegate();
EntityManagerImpl eml = (EntityManagerImpl)o;
Session session = eml.getSession();
javax.persistence.Query query = em.createQuery("from Message");
FullTextSession fullTextSession = Search.createFullTextSession(session);
Collection messages = query.getResultList();
Iterator it = messages.iterator();
while(it.hasNext()){
Message mesg = (Message)it.next();
System.out.println(mesg.getText());
fullTextSession.index(mesg);
}
QueryParser parser = new QueryParser("text", new StopAnalyzer()); // also tried it with contact.street as field name
org.apache.lucene.search.Query luceneQuery;
luceneQuery = parser.parse("My name*"); // want to see all streets starting with the letter 'w'
org.hibernate.Query fullTextQuery = fullTextSession.createFullTextQuery(luceneQuery);
System.out.println("fulltextquery: " + fullTextQuery.toString());
List result = fullTextQuery.list(); //EXCEPTION Throw here
System.out.println("result.size(): " + result.size());
16:49:13,785 INFO [STDOUT] fulltextquery: FullTextQueryImpl(text:my text:name*)
16:49:13,806 ERROR [STDERR] org.hibernate.search.SearchException: Unable to load indexed class: hello.Message_$$_javassist_21
16:49:13,806 ERROR [STDERR] at org.hibernate.search.engine.DocumentBuilder.getDocumentClass(DocumentBuilder.java:477)
16:49:13,806 ERROR [STDERR] at org.hibernate.search.query.FullTextQueryImpl.list(FullTextQueryImpl.java:160)
16:49:13,806 ERROR [STDERR] at ejbs.SearchBeanImp.updateIndex(SearchBeanImp.java:64)
16:49:13,806 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
16:49:13,806 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
16:49:13,806 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
16:49:13,806 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
16:49:13,806 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
16:49:13,806 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
16:49:13,806 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
16:49:13,806 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
16:49:13,806 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
Please help!!!
Thanks,
Luyen Tran