java - 使用 Hibernate Tools 5.1.0.Final 时出现 InspirationTargetException

标签 java jpa hibernate-tools jboss-developer-studio

编辑:就像下面的答案所说,这是一个错误,并且已经 reported是别人写的。

我试图在我的一个项目中使用 Hibernate Tools 生成 DTO ( this is a question I opened yesterday about that task )。我在当前的 Eclipse Neon 实例中安装了 Hibernate Tools,并遇到了下面详细介绍的问题。

然后,我下载了整个JBoss Developer Studio安装程序并安装它,以确定我的Eclipse实例是否有问题。没有效果。

(注意:在 Eclipse 实例中使用 EclipseLink,我可以从图表生成实体,并从实体生成表格)

我遇到的问题是创建 Hibernate 配置时,即单击下面对话框窗口中的“确定”按钮时,错误日志 View (以及对话框)中出现此异常:

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)之外,我还没有触及其他选项)。

Screen capture of the Hibernate Configuration dialog

这是我的 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 已生成表都不会改变任何事情。

我认为这是由于配置错误造成的,但除了标准异常之外,错误消息中缺乏提示让我束手无策。

是否可以确定此错误的确切原因?

最佳答案

这个问题是一个错误,应该同时解决。尝试最新的 Red Hat Developer Studio 版本。如果问题仍然存在,请打开 JIRA 问题 https://issues.jboss.org .

关于java - 使用 Hibernate Tools 5.1.0.Final 时出现 InspirationTargetException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38644774/

相关文章:

java - 行为类似于@Entity 和@Embeddable 的类

java - 没有第三个表的一对多关联

java - CriteriaBuilder 没有方法 createCriteriaUpdate

java - 带有 LIKE 条件的 Spring Data JPA 查询在运行时抛出异常

hibernate - 持久性异常 : No persistence provider found for schema generation for persistence-unit named default

java - 如何使用自定义 NamingStrategy 在 Eclipse 中配置 Hibernate Tools HQL 编辑器

java - 用于 Hibernate 注释的可视化设计工具

java - Ant 支持基于文件的依赖关系吗?

Java UDP 组播

java - 使用文件集和路径元素在 build.xml 中设置类路径的区别