当前位置: 首页 > 知识库问答 >
问题:

HibernateJava。lang.NoSuchMethodError:>org。冬眠积分器。内部的IntegratorServiceImpl

宓诚
2023-03-14

在我的jax rs上使用hibernate时,出现以下错误:

HTTP错误500

访问 /services/datesTest.问题原因:

Server Error Caused by:

java.lang.连接器上的异常。Connector.buildSessionFactory(Connector.java:32)连接器。连接器处的Connector.getSessionFactory(Connector.java:37)。Connector.get会话(Connector.java:45)在mainproject.services.HibernateDatesTest.verify令牌(HibernateDatesTest.java:24)在sun.reflect.NativeMEDAccessorImpl.invoke0(本地方法)在sun.reflect.NativeMEDAccessorImpl.invoke(NativeMEDAccessorImpl.java:57)在sun.reflect.委托mpl.invoke(委托MEDAccessorImpl.java:43)在java.lang.reflect.Method.invoke(方法. java: 606)在com. sun. jersey. spi.容器。java: 60)在com. sun. jersey. server. implified. mode. way.方法调度。AbstractResourceMeodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMeodDispatchProvider. java: 185),网址为com. sun. jersey. server. implified. mode. method. outch。在com. sun. jersey. server. implified. uri.规则中发送(ResourceJavaMeodDispatcher. java: 75)。在com. sun. jersey. server. implified. uri.规则中接受(HttpMEODRLE. java: 288)。接受(ResourceClassCode. java: 108)在com. sun. jersey. server. implified. uri.规则。接受(RightHandPathRule. java: 147)在com. sun. jersey. server. implified. uri.规则。接受(RootResourceClassesRule. java: 84)在com. sun. jersey. server. imp. Application。WebApplication ationImpl._handleRequest(WebApplication ationInp. java: 1469)at com. sun. jersey. server. imp. Application.WebApplication ationImpl._handleRequest(WebApplication ationInp. html" target="_blank">java: 1400)在com. sun. jersey. server. imp. Application。在com. sun. jersey. server. implified. Application上的WebApplication. Inv. handleRequest(WebApplication. Inv. java: 1349)。在com. sun. jersey. spi.容器. servlet上的WebApplication. Inp. handleRequest(WebApplication. Inp. java: 1339)。WebComponent. service(WebComponent. java: 416),网址为com. sun. jersey. spi.容器. servlet。ServletContainer. service(ServletContainer. java: 537),网址为com. sun. jersey. spi.容器. servlet。ServletContainer. service(ServletContainer. java: 699)在javax. servlet. http.服务(HttpServlet. java: 820)在org. eclipse. jetty. servlet。在org. eclipse. jetty. servlet上的ServletHolder. Handder(ServletHolder. java: 565)。ServletHandler. doHandle(ServletHandler. java: 479)在org. eclipse. jetty. server. handler。处理(ScopedHandler. java: 119)在org. eclipse. jetty. security。处理(SecurityHandler. java: 521)在org. eclipse. jetty. server. session。doHandle(SessionHandler. java: 227)在org. eclipse. jetty. server. handler。ContextHandler. doHandle(ContextHandler. java: 1031)在org. eclipse. jetty. servlet。ServletHandler. doScope(ServletHandler. java: 406)在org. eclipse. jetty. server. session。SessionHandler. doScope(SessionHandler. java: 186)在org. eclipse. jetty. server. handler。ContextHandler. doScope(ContextHandler. java: 965)在org. eclipse. jetty. server. handler。处理(ScopedHandler. java: 117)在org. eclipse. jetty. server. handler。在org. eclipse. jetty. server上处理(HandlerWrapper. java: 111)。在org. eclipse. jetty. server上处理(Server. java: 349)。在org. eclipse. jetty. server上的AbstractHttpConnection. handleRequest(AbstractHttpConnection. java: 449)。在org. eclipse. jetty. http上完成(AbstractHttpConnection. java: 910)。httpParser. parseNext(HttpParser. java: 634)在org. eclipse. jetty. http。在org. eclipse. jetty. server上可用(HttpParser. java: 230)。在org. eclipse. jetty. io. nio中的asyncHttpConnection. hand(AsyncHttpConnection. java: 76)。在org. eclipse. jetty. io. nio上选择ChannelEndPoint. Handder(选择ChannelEndPoint. java: 609)。在org. eclipse. jetty. util. thread上选择1美元。在org. eclipse. jetty. util. thon上的QueuedThreadPool. runJobs(QueuedThreadPool. java: 599)。QueuedThreadPool3 USD. run(QueuedThreadPool. java: 534)at java. lang.线程. run(Thread. java: 744)引起:java. lang.NoSuchMultiodError: org. hibernate.集成器。Inpl.(Ljava/util/LinkedHashSet; Lorg/hibernate/引导/注册表/类加载/spi/ClassLoaderService;)V at org. hibernate. boot.注册。在org. hibernate. boot. den上创建(BootstrapServiceAuthstryBuilder. java: 247)。标准服务注册生成器)java: 73)在连接器。Connector. BuildSessionFactory(Connector. java: 21)...44更多原因:

java.lang.NoSuchmethod odError:org.hibernate.integrator.internal.的问题)Ljava/util/LinkedHashSet; Lorg/hibernate/引导/注册表/类加载/spi/ClassLoaderService;)V在org.hibernate.boot.registry.BootstrapService登记册Builder.build(BootstrapService登记册Builder.java:247)在org.hibernate.boot.registry.标准服务登记册构建器。(连接器上的标准服务注册uilder.java:73)。Connector.buildSessionFactory(Connector.java:21)连接器。Connector.getSessionFactory(Connector.java:37)连接器。Connector.get会话(Connector.java:45)mainproject.services.HibernateDatesTest.verify令牌(HibernateDatesTest.java:24)sun.reflect.NativeMEodAccessorImpl.invoke0(本地方法)sun.reflect.NativeMEodAccessorImpl.invoke(NativeMEOAccessorInp. java: 57)at sun. reff.在java. lang.反射中调用(委托方法访问或执行. java: 43)。在com. sun. jersey. spi.容器中调用(method. java: 606)。java: 60)在com. sun. jersey. server. implified. mode. way.方法调度。AbstractResourceMeodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMeodDispatchProvider. java: 185),网址为com. sun. jersey. server. implified. mode. method. outch。在com. sun. jersey. server. implified. uri.规则中发送(ResourceJavaMeodDispatcher. java: 75)。在com. sun. jersey. server. implified. uri.规则中接受(HttpMEODRLE. java: 288)。接受(ResourceClassCode. java: 108)在com. sun. jersey. server. implified. uri.规则。接受(RightHandPathRule. java: 147)在com. sun. jersey. server. implified. uri.规则。接受(RootResourceClassesRule. java: 84)在com. sun. jersey. server. imp. Application。WebApplication ationImpl._handleRequest(WebApplication ationInp. java: 1469)at com. sun. jersey. server. imp. Application.WebApplication ationImpl._handleRequest(WebApplication ationInp. java: 1400)在com. sun. jersey. server. imp. Application。在com. sun. jersey. server. implified. Application上的WebApplication. Inv. handleRequest(WebApplication. Inv. java: 1349)。在com. sun. jersey. spi.容器. servlet上的WebApplication. Inp. handleRequest(WebApplication. Inp. java: 1339)。WebComponent. service(WebComponent. java: 416),网址为com. sun. jersey. spi.容器. servlet。ServletContainer. service(ServletContainer. java: 537),网址为com. sun. jersey. spi.容器. servlet。ServletContainer. service(ServletContainer. java: 699)在javax. servlet. http.服务(HttpServlet. java: 820)在org. eclipse. jetty. servlet。在org. eclipse. jetty. servlet上的ServletHolder. Handder(ServletHolder. java: 565)。ServletHandler. doHandle(ServletHandler. java: 479)在org. eclipse. jetty. server. handler。处理(ScopedHandler. java: 119)在org. eclipse. jetty. security。处理(SecurityHandler. java: 521)在org. eclipse. jetty. server. session。doHandle(SessionHandler. java: 227)在org. eclipse. jetty. server. handler。ContextHandler. doHandle(ContextHandler. java: 1031)在org. eclipse. jetty. servlet。ServletHandler. doScope(ServletHandler. java: 406)在org. eclipse. jetty. server. session。SessionHandler. doScope(SessionHandler. java: 186)在org. eclipse. jetty. server. handler。ContextHandler. doScope(ContextHandler. java: 965)在org. eclipse. jetty. server. handler。处理(ScopedHandler. java: 117)在org. eclipse. jetty. server. handler。在org. eclipse. jetty. server上处理(HandlerWrapper. java: 111)。在org. eclipse. jetty. server上处理(Server. java: 349)。在org. eclipse. jetty. server上的AbstractHttpConnection. handleRequest(AbstractHttpConnection. java: 449)。在org. eclipse. jetty. http上完成(AbstractHttpConnection. java: 910)。httpParser. parseNext(HttpParser. java: 634)在org. eclipse. jetty. http。在org. eclipse. jetty. server上可用(HttpParser. java: 230)。在org. eclipse. jetty. io. nio中的asyncHttpConnection. hand(AsyncHttpConnection. java: 76)。在org. eclipse. jetty. io. nio上选择ChannelEndPoint. Handder(选择ChannelEndPoint. java: 609)。在org. eclipse. jetty. util. thread上选择1美元。在org. eclipse. jetty. util. thon上的QueuedThreadPool. runJobs(QueuedThreadPool. java: 599)。QueuedThreadPool3 USD. run(QueuedThreadPool. java: 534)at java. lang.线程. run(线程. java: 744)由码头://

我的会话生成器类:

package connectors;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;

public class Connector {

    private static SessionFactory sessionFactory;

    private static SessionFactory buildSessionFactory() {
        try {
            // Create the SessionFactory from hibernate.cfg.xml
            Configuration configuration = new Configuration();
            configuration.configure("hibernate.cfg.xml");
            System.out.println("Hibernate Configuration loaded");

            //apply configuration property settings to StandardServiceRegistryBuilder
            StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());
            System.out.println("Hibernate serviceRegistry created");

            SessionFactory sessionFactory = configuration.buildSessionFactory(ssrb.build());


            return sessionFactory;
        }
        catch (Throwable ex) {
            // Make sure you log the exception, as it might be swallowed
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }

    public static SessionFactory getSessionFactory() {
        if(sessionFactory == null) sessionFactory = buildSessionFactory();
        return sessionFactory;
    }




    public static Session getSession(){
        return getSessionFactory().openSession();
    }
}

我的Pom.xml:

http://maven.apache.org/xsd/maven-4.0.0.xsd"

<artifactId>resqueue-mainproj</artifactId> <dependencies>
<!-- our projects -->


<dependency>
    <groupId>serverside</groupId>
    <artifactId>resqueue-dal</artifactId>
    <version>1.0</version>
</dependency>

<dependency>
    <groupId>serverside</groupId>
    <artifactId>resqueue-srdlib</artifactId>
    <version>1.0</version>
</dependency>
<!-- Jetty -->
<dependency>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-servlet</artifactId>
    <version>7.6.0.v20120127</version>
</dependency>
<dependency>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-webapp</artifactId>
    <version>7.6.0.v20120127</version>
</dependency>

<!-- Nimbus -->
<dependency>
    <groupId>com.nimbusds</groupId>
    <artifactId>nimbus-jose-jwt</artifactId>
    <version>2.9</version>
</dependency>

<!-- Jersey -->
<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-server</artifactId>
    <version>1.8</version>
</dependency>
<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-json</artifactId>
    <version>1.8</version>
</dependency>

<!-- jUnit -->
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.10</version>
    <scope>test</scope>
</dependency>
<!--org.apache.http -->

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.3.2</version>
</dependency>

<!-- JSON LIB -> added for testing only  -->
<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.2.4</version>
</dependency>

<!-- Hibernate -->

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.30</version>
</dependency>
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>4.3.6.Final</version>
</dependency>

<!-- for JPA, use hibernate-entitymanager instead of hibernate-core -->
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>4.3.6.Final</version>
</dependency>

我从所有其他版本中清除了maven回购。有什么想法吗?

共有3个答案

高承望
2023-03-14

试试这个核心;

如果你有apache tomcat,你需要在apache/lib中添加ojbc6

OJBC6

<!-- ORACLE JDBC driver, need install yourself -->
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc6</artifactId>
        <version>11.2.0</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>3.6.3.Final</version>
    </dependency>

    <dependency>
        <groupId>javassist</groupId>
        <artifactId>javassist</artifactId>
        <version>3.12.1.GA</version>
    </dependency>
祁驰
2023-03-14

你能试试下面的代码吗

另外,您确定在您的类路径中没有多个版本的hibernate JAR吗。

public class Connector {

    private static SessionFactory sessionFactory;

    private static SessionFactory buildSessionFactory() {
        try {
            // Create the SessionFactory from hibernate.cfg.xml
            Configuration configuration = new Configuration();
            configuration.configure("hibernate.cfg.xml");
            System.out.println("Hibernate Configuration loaded");

            //apply configuration property settings to StandardServiceRegistryBuilder
            StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());
            System.out.println("Hibernate serviceRegistry created");

            sessionFactory = configuration.buildSessionFactory(ssrb.build());


            return sessionFactory;
        }
        catch (Throwable ex) {
            // Make sure you log the exception, as it might be swallowed
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }

    public static SessionFactory getSessionFactory() {
        if(sessionFactory == null) {
        sessionFactory = buildSessionFactory();
    }
        return sessionFactory;
    }




    public static Session getSession(){
        return getSessionFactory().openSession();
    }
}
鲁鹏
2023-03-14

确保已从类路径中删除所有先前版本的Hibernate。

在github上查看它,我不明白为什么会出现这种情况,除非您有版本冲突导致的类加载器问题,因为您正在/正在使用的两个版本中都存在integratorserviceinpl,这对我来说意味着类加载器问题

 类似资料:
  • 在HQL中,我试图获取没有分类的工件(当活动为0时) 每当我跑步时,我都会出错 分类定义: 你可以参考我之前遇到的问题来理解我到底想做什么任务1和任务2

  • 另一种方法是使用Crieteria关联,但关联只能与和一起工作! 请在这里帮帮我。

  • 我使用的是Spring Boot 4、Hibernate和JPA注释。我遇到了这个错误 组织。冬眠PersistentObjectException:传递给persist的分离实体。 我试着在互联网上搜索,但没有找到正确的答案。我尝试使用而不是,但没有成功。此外,我认为在更新资源时使用。 这是我的代码: ` `积垢服务 ` ` 存储库 ` '抽象存储库 ` ` 工厂` '支持形式 ` ` 控制器

  • 我试图加入以下JPA查询,但出现以下错误: 组织。冬眠hql。内部的阿斯特。QuerySyntaxException:预期加入的路径![from com.crm.entity.User-User-join-fetch-Role-on-Role.User_-id=User.id,其中User.deleted=false,User.enabled=true,User.username=:usernam

  • 配置类的应用程序侦听器时出现错误 这实际上是我的错误 ** 严重:配置类org的应用程序侦听器时出错。springframework。网状物上下文ContextLoaderListener java。lang.NoClassDefFoundError:javax/servlet/ServletContextListener **在爪哇。lang.ClassLoader。java上的findBoot

  • 我试图用Hibernate5创建或更新用户,它抛出以下异常:org。冬眠资源jdbc。内部的LogicalConnectionManagedImpl@779de014关门了 我正在使用以下技术: Spring4 冬眠5 马文 蚀 这是我的: 这是我的: 错误消息: Hibernatexml文件: