我收到以下错误:
Cannot cast org.hibernate.search.hcore.impl.HibernateSearchIntegrator to
org.hibernate.integrator.spi.Integrator
堆栈跟踪:
[WARN] Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'XXX threw an unexpected exception: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider org.hibernate.search.hcore.impl.HibernateSearchIntegrator could not be instantiated: java.lang.ClassCastException: Cannot cast org.hibernate.search.hcore.impl.HibernateSearchIntegrator to org.hibernate.integrator.spi.Integrator
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider org.hibernate.search.hcore.impl.HibernateSearchIntegrator could not be instantiated: java.lang.ClassCastException: Cannot cast org.hibernate.search.hcore.impl.HibernateSearchIntegrator to org.hibernate.integrator.spi.Integrator
at java.util.ServiceLoader.fail(ServiceLoader.java:224)
at java.util.ServiceLoader.access$100(ServiceLoader.java:181)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:370)
at java.util.ServiceLoader$1.next(ServiceLoader.java:438)
at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:251)
at org.hibernate.integrator.internal.IntegratorServiceImpl.(IntegratorServiceImpl.java:53)
at org.hibernate.service.internal.BootstrapServiceRegistryImpl.(BootstrapServiceRegistryImpl.java:80)
at org.hibernate.service.internal.BootstrapServiceRegistryImpl.(BootstrapServiceRegistryImpl.java:57)
at org.hibernate.service.ServiceRegistryBuilder.(ServiceRegistryBuilder.java:76)
at com.orangeraft.hms.server.module.login.service.LoginServiceImpl.login(LoginServiceImpl.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
... 22 more
Caused by: java.lang.ClassCastException: Cannot cast org.hibernate.search.hcore.impl.HibernateSearchIntegrator to org.hibernate.integrator.spi.Integrator
at java.lang.Class.cast(Class.java:3007)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:362)
... 34 more
这是我的代码:
Configuration configuration = new Configuration();
configuration.configure();
ServiceRegistry serviceRegistry = new ServiceRegistryBuilder()
.applySettings(configuration.getProperties())
.buildServiceRegistry();
SessionFactory sf = configuration.buildSessionFactory(serviceRegistry);
Session hibernateSession = sf.getCurrentSession();
FullTextSession fullTextSession = Search.getFullTextSession(hibernateSession);
fullTextSession.createIndexer().startAndWait();
我只是想在 GWT 应用程序中创建索引,如休眠搜索教程中所示。任何想法如何解决这一问题?