編輯:像下面的答案說,這是一個錯誤,它已被其他人reported。InvocationTargetException當使用Hibernate工具5.1.0.Final
我試圖使用Hibernate Tools在我的項目中生成DTO(this is a question I opened yesterday about that task)。我在當前的Eclipse Neon實例中安裝了Hibernate Tools,並遇到了下面詳細描述的問題。
然後,我下載了一個完整的JBoss Developer Studio安裝程序並安裝它,以確定我的Eclipse實例是否有問題。無濟於事。
(注:在Eclipse實例使用的EclipseLink,我可以生成從圖中的實體,並從實體表)
我的問題是這樣的例外在錯誤日誌視圖(也作爲對話框)創建Hibernate配置時,即,點擊在下文中進一步所述對話窗口中的OK按鈕時:
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.hibernate.tool.util.MetadataHelper.getMetadataFromMethod(MetadataHelper.java:78)
at org.hibernate.tool.util.MetadataHelper.getMetadata(MetadataHelper.java:16)
at org.jboss.tools.hibernate.runtime.v_5_1.internal.ConfigurationFacadeImpl.getMetadata(ConfigurationFacadeImpl.java:168)
at org.jboss.tools.hibernate.runtime.v_5_1.internal.ConfigurationFacadeImpl.buildMappings(ConfigurationFacadeImpl.java:106)
at org.hibernate.console.ConsoleConfiguration$4.execute(ConsoleConfiguration.java:272)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:108)
at org.hibernate.console.ConsoleConfiguration.buildMappings(ConsoleConfiguration.java:270)
at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:44)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:98)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:104)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:231)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: 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:498)
at org.hibernate.tool.util.MetadataHelper.getMetadataFromMethod(MetadataHelper.java:72)
... 12 more
Caused by: java.lang.NullPointerException
at org.jboss.tools.hibernate.runtime.v_5_1.internal.JPAConfiguration.getMetadata(JPAConfiguration.java:36)
... 17 more
這裏是配置的屏幕捕獲(不是數據庫對話框其他被設置爲MySQL (InnoDB)
上標籤Options
,我沒有觸及其他選項)。
這裏是我的hibernate.properties文件的內容:
hibernate.bytecode.use_reflection_optimizer=false
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.password=verbus
hibernate.connection.url=jdbc:mysql://localhost:3306/verbus
hibernate.connection.username=verbus
hibernate.ddl-auto=none
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.format_sql=true
hibernate.search.autoregister_listeners=true
hibernate.show_sql=true
hibernate.validator.apply_to_ddl=false
hibernate.default_entity_mode=pojo
hibernate.order_inserts=true
hibernate.order_updates=true
持久單元存在,並創建和更新採用DALI的JPA圖編輯器組件。
數據庫是否爲空或表已由EclipseLink生成表不會改變事情。
我想這是錯誤配置的結果,但缺少來自錯誤信息的提示而不僅僅是一個標準的異常,這讓我很無奈。
是否有可能確定此錯誤的確切原因?