【问题标题】:Weird hibernate reference error, however it is not added as a library奇怪的休眠引用错误,但是它没有作为库添加
【发布时间】:2014-03-07 17:40:19
【问题描述】:

我收到以下错误:

Exception in Application constructor
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:367)
    at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Unable to construct Application instance: class StartUp
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:884)
    at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56)
    at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at com.sun.javafx.application.LauncherImpl$7.run(LauncherImpl.java:791)
    at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:335)
    at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301)
    at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
    at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
    ... 1 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/Session
    at gui.GraphicApplication.<init>(GraphicApplication.java:28)
    at StartUp.<init>(StartUp.java:26)
    ... 15 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.Session
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 17 more
Exception running application StartUp

但是我什至没有使用 Hibernate 库,我使用的是 JPA,我尝试搜索“Session”、“hibernate”和其他字符串,但我找不到任何这些字符串,但它却抛出了这个错误。

这些是我目前正在使用的库:

我之前使用的是hibernate,但我必须使用JPA,所以我删除了与Hibernate有关的所有内容。

堆栈跟踪引用了我的一些文件,但这些行与数据库管理无关。

【问题讨论】:

  • lAppointmentGroupMap.put("group02", new Agenda.AppointmentGroupImpl().withStyleClass("group2"));这些类都不是可持久的,也不以任何方式使用休眠
  • 堆栈跟踪不会说谎; NoClassDefFoundError 意味着该行引入了对 Hibernate Session 的要求。它可能在这些类的一个部门中,或者在一个部门的一个部门中。但它是从那里拉进来的。
  • 好吧,我找不到任何东西,我用相同的源文件重新创建了项目,现在一切似乎都可以工作了

标签: java hibernate jpa persistence


【解决方案1】:

您有没有将 Hibernate JAR 添加到服务器的 lib 目录中?

【讨论】:

    【解决方案2】:

    堆栈跟踪清楚地表明“gui.GraphicApplication.(GraphicApplication.java:28)”正在引用它,所以看看并修复它?

    【讨论】:

      猜你喜欢
      • 2013-02-12
      • 1970-01-01
      • 1970-01-01
      • 2016-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-19
      • 2016-01-03
      相关资源
      最近更新 更多