No se puede convertir org.hibernate.search.hcore.impl.HibernateSearchIntegrator a org.hibernate.integrator.spi.Integrator

Estoy teniendo el siguiente error:

Cannot cast org.hibernate.search.hcore.impl.HibernateSearchIntegrator to 
org.hibernate.integrator.spi.Integrator

Stack trace:

   [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

Aquí está mi código:

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();

I'm just trying to create the index as shown in the hibernate search tutorial aquí in a GWT application. Any ideas how to fix this?

preguntado el 26 de agosto de 12 a las 23:08

Encontré esta publicación relacionada: jira.springsource.org/browse/… -

1 Respuestas

I'm thinking you have hibernate in both your WEB-INF/lib and on the launch classpath. This may confuse the classloader as the implementation and the interface may not be loaded by the same classloader, thus giving an unexpected ClassCastException.

Respondido 22 Oct 12, 17:10

Thanks, JP. Worked after I removed a "hibernate-core" maven dependency that was already supplied by another service jar. - decir

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.