我整夜都在搜寻,但似乎找不到任何解决方法。每次我尝试从应用程序登录数据库时,都会得到以下信息:
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1774) ~[jfxrt.jar:?]
at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657) ~[jfxrt.jar:?]
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86) ~[jfxrt.jar:?]
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238) ~[jfxrt.jar:?]
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) ~[jfxrt.jar:?]
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) ~[jfxrt.jar:?]
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) ~[jfxrt.jar:?]
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) ~[jfxrt.jar:?]
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) ~[jfxrt.jar:?]
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) ~[jfxrt.jar:?]
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) ~[jfxrt.jar:?]
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) ~[jfxrt.jar:?]
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74) ~[jfxrt.jar:?]
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54) ~[jfxrt.jar:?]
at javafx.event.Event.fireEvent(Event.java:198) ~[jfxrt.jar:?]
at javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3470) ~[jfxrt.jar:?]
at javafx.scene.Scene$ClickGenerator.access$8100(Scene.java:3398) ~[jfxrt.jar:?]
at javafx.scene.Scene$MouseHandler.process(Scene.java:3766) ~[jfxrt.jar:?]
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485) ~[jfxrt.jar:?]
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762) ~[jfxrt.jar:?]
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494) ~[jfxrt.jar:?]
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394) ~[jfxrt.jar:?]
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295) ~[jfxrt.jar:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_181]
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432) ~[jfxrt.jar:?]
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389) ~[jfxrt.jar:?]
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431) ~[jfxrt.jar:?]
at com.sun.glass.ui.View.handleMouseEvent(View.java:555) ~[jfxrt.jar:?]
at com.sun.glass.ui.View.notifyMouse(View.java:937) ~[jfxrt.jar:?]
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) ~[jfxrt.jar:?]
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177) ~[jfxrt.jar:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71) ~[?:1.8.0_181]
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275) ~[?:1.8.0_181]
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1771) ~[jfxrt.jar:?]
... 31 more
Caused by: java.lang.ExceptionInInitializerError
at com.my.package.persistence.util.HibernateConnection.<init>(HibernateConnection.java:93) ~[classes/:?]
at com.my.package.persistence.util.HibernateConnection.connect(HibernateConnection.java:118) ~[classes/:?]
at sc.database.DatabaseController.initializeDatabase(DatabaseController.java:191) ~[classes/:?]
at sc.ui.UserLoginController.verifyCredentials(UserLoginController.java:98) ~[classes/:?]
at sc.ui.UserLoginController.moveToChooseNewOrExistingSession(UserLoginController.java:83) ~[classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71) ~[?:1.8.0_181]
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275) ~[?:1.8.0_181]
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1771) ~[jfxrt.jar:?]
... 31 more
Caused by: org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.JoinedSubclassEntityPersister
at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:123) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:77) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:154) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:295) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at com.my.package.persistence.util.HibernateConnection.<init>(HibernateConnection.java:90) ~[classes/:?]
at com.my.package.persistence.util.HibernateConnection.connect(HibernateConnection.java:118) ~[classes/:?]
at sc.database.DatabaseController.initializeDatabase(DatabaseController.java:191) ~[classes/:?]
at sc.ui.UserLoginController.verifyCredentials(UserLoginController.java:98) ~[classes/:?]
at sc.ui.UserLoginController.moveToChooseNewOrExistingSession(UserLoginController.java:83) ~[classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71) ~[?:1.8.0_181]
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275) ~[?:1.8.0_181]
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1771) ~[jfxrt.jar:?]
... 31 more
Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:91) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:116) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:382) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:551) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:135) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_181]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_181]
at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:96) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:77) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:154) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:295) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at com.my.package.persistence.util.HibernateConnection.<init>(HibernateConnection.java:90) ~[classes/:?]
at com.my.package.persistence.util.HibernateConnection.connect(HibernateConnection.java:118) ~[classes/:?]
at sc.database.DatabaseController.initializeDatabase(DatabaseController.java:191) ~[classes/:?]
at sc.ui.UserLoginController.verifyCredentials(UserLoginController.java:98) ~[classes/:?]
at sc.ui.UserLoginController.moveToChooseNewOrExistingSession(UserLoginController.java:83) ~[classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71) ~[?:1.8.0_181]
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275) ~[?:1.8.0_181]
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1771) ~[jfxrt.jar:?]
... 31 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_181]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_181]
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:88) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:116) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:382) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:551) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:135) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_181]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_181]
at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:96) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:77) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:154) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:295) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at com.my.package.persistence.util.HibernateConnection.<init>(HibernateConnection.java:90) ~[classes/:?]
at com.my.package.persistence.util.HibernateConnection.connect(HibernateConnection.java:118) ~[classes/:?]
at sc.database.DatabaseController.initializeDatabase(DatabaseController.java:191) ~[classes/:?]
at sc.ui.UserLoginController.verifyCredentials(UserLoginController.java:98) ~[classes/:?]
at sc.ui.UserLoginController.moveToChooseNewOrExistingSession(UserLoginController.java:83) ~[classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71) ~[?:1.8.0_181]
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275) ~[?:1.8.0_181]
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1771) ~[jfxrt.jar:?]
... 31 more
Caused by: java.lang.IllegalArgumentException: Could not create type
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:140) ~[byte-buddy-1.7.4.jar:?]
at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:346) ~[byte-buddy-1.7.4.jar:?]
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:161) ~[byte-buddy-1.7.4.jar:?]
at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:355) ~[byte-buddy-1.7.4.jar:?]
at org.hibernate.bytecode.internal.bytebuddy.ByteBuddyState.load(ByteBuddyState.java:181) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.bytecode.internal.bytebuddy.ByteBuddyState.loadProxy(ByteBuddyState.java:107) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.proxy.pojo.bytebuddy.ByteBuddyProxyHelper.buildProxy(ByteBuddyProxyHelper.java:54) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.proxy.pojo.bytebuddy.ByteBuddyProxyFactory.postInstantiate(ByteBuddyProxyFactory.java:62) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:156) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:58) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_181]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_181]
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:88) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:116) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:382) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:551) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:135) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_181]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_181]
at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:96) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:77) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:154) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:295) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at com.my.package.persistence.util.HibernateConnection.<init>(HibernateConnection.java:90) ~[classes/:?]
at com.my.package.persistence.util.HibernateConnection.connect(HibernateConnection.java:118) ~[classes/:?]
at sc.database.DatabaseController.initializeDatabase(DatabaseController.java:191) ~[classes/:?]
at sc.ui.UserLoginController.verifyCredentials(UserLoginController.java:98) ~[classes/:?]
at sc.ui.UserLoginController.moveToChooseNewOrExistingSession(UserLoginController.java:83) ~[classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71) ~[?:1.8.0_181]
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275) ~[?:1.8.0_181]
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1771) ~[jfxrt.jar:?]
... 31 more
Caused by: java.lang.NoSuchMethodError: net.bytebuddy.dynamic.loading.ClassInjector$UsingLookup.isAvailable()Z
at org.hibernate.bytecode.internal.bytebuddy.ByteBuddyState.resolveClassLoadingStrategy(ByteBuddyState.java:227) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.bytecode.internal.bytebuddy.ByteBuddyState.lambda$load$0(ByteBuddyState.java:185) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:138) ~[byte-buddy-1.7.4.jar:?]
at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:346) ~[byte-buddy-1.7.4.jar:?]
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:161) ~[byte-buddy-1.7.4.jar:?]
at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:355) ~[byte-buddy-1.7.4.jar:?]
at org.hibernate.bytecode.internal.bytebuddy.ByteBuddyState.load(ByteBuddyState.java:181) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.bytecode.internal.bytebuddy.ByteBuddyState.loadProxy(ByteBuddyState.java:107) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.proxy.pojo.bytebuddy.ByteBuddyProxyHelper.buildProxy(ByteBuddyProxyHelper.java:54) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.proxy.pojo.bytebuddy.ByteBuddyProxyFactory.postInstantiate(ByteBuddyProxyFactory.java:62) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:156) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:58) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_181]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_181]
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:88) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:116) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:382) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:551) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:135) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_181]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_181]
at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:96) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:77) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:154) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:295) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708) ~[hibernate-core-5.3.6.Final.jar:5.3.6.Final]
at com.my.package.persistence.util.HibernateConnection.<init>(HibernateConnection.java:90) ~[classes/:?]
at com.my.package.persistence.util.HibernateConnection.connect(HibernateConnection.java:118) ~[classes/:?]
at sc.database.DatabaseController.initializeDatabase(DatabaseController.java:191) ~[classes/:?]
at sc.ui.UserLoginController.verifyCredentials(UserLoginController.java:98) ~[classes/:?]
at sc.ui.UserLoginController.moveToChooseNewOrExistingSession(UserLoginController.java:83) ~[classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71) ~[?:1.8.0_181]
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275) ~[?:1.8.0_181]
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1771) ~[jfxrt.jar:?]
... 31 more
在以下情况下设置sessionFactory时会发生这种情况:
private HibernateConnection(HibernateConfig config) {
try {
Configuration cfg = new Configuration()
.addPackage("com.my.package.persistence.entity")
.setProperty("hibernate.connection.url", config.getUrl())
.setProperty("hibernate.connection.username", config.getUsername())
.setProperty("hibernate.connection.password", config.getPassword())
.setProperty("hibernate.dialect", config.getDialect())
.setProperty("hibernate.hbm2ddl.auto", config.getMode())
.setProperty("hibernate.validator.autoregister_listeners", "false")
.setProperty("hibernate.validator.apply_to_ddl", "false")
.addAnnotatedClass(AbstractPerson.class)
.addAnnotatedClass(Address.class)
.addAnnotatedClass(Dependent.class)
.addAnnotatedClass(Person.class)
.addAnnotatedClass(Session.class)
.addAnnotatedClass(SessionField.class)
.addAnnotatedClass(SessionFieldEntry.class);
ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
.applySettings(cfg.getProperties()).build();
sessionFactory = cfg.buildSessionFactory(serviceRegistry);
} catch (Exception e) {
throw new ExceptionInInitializerError(e);
}
而我的依赖:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.197</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.3.6.Final</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
我已经从pom中删除了休眠注释3.5.6,已经深入研究了类文件以尝试了解发生了什么,并且浏览了很多类似的问题,但是它们通常似乎缺少getter或简单的东西。像那样。这似乎是Hibernate所依赖的。
任何帮助表示赞赏。
最佳答案
在上面查看samabcde的评论以获取答案。如此处所述,主程序包中的测试框架正在干扰本应从持久性程序包中使用的字节伙伴的版本。