gpt4 book ai didi

java - 使用 jboss 工具/hibernate 配置连接到数据库时出错

转载 作者:太空宇宙 更新时间:2023-11-04 15:10:29 25 4
gpt4 key购买 nike

我正在尝试使用 jboss 工具 hibernate 代码生成来为我的 postgresql 数据库中的表生成 DAO 和 hibernate 映射。我已经设置了 hibernate 配置,但是当我尝试连接时出现此错误:

java.lang.NoSuchFieldError: INSTANCE
at org.hibernate.type.StandardBasicTypes.<clinit>(StandardBasicTypes.java:54)
at org.hibernate.spatial.dialect.postgis.PostgisDialect.registerTypesAndFunctions(PostgisDialect.java:55)
at org.hibernate.spatial.dialect.postgis.PostgisDialect.<init>(PostgisDialect.java:42)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.hibernate.dialect.resolver.DialectFactory.constructDialect(DialectFactory.java:157)
at org.hibernate.dialect.resolver.DialectFactory.buildDialect(DialectFactory.java:109)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:146)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2163)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2155)
at org.hibernate.console.ConsoleConfiguration$6.execute(ConsoleConfiguration.java:430)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107)
at org.hibernate.console.ConsoleConfiguration.getSettings(ConsoleConfiguration.java:428)
at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$2.execute(LazyDatabaseSchemaWorkbenchAdapter.java:119)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107)
at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.readDatabaseSchema(LazyDatabaseSchemaWorkbenchAdapter.java:115)
at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:65)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:106)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:235)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

我查看了 StandardBasicTypes 的第 54 行,其中显示 public static final BooleanType BOOLEAN = BooleanType.INSTANCE; 并且我跟踪了 BooleanType 类中确实存在的字段 BooleanType.INSTANCE。

我正在使用 hibernate-core-4.1.8.Final.jar、hibernate-spatial-4.0-M1.jar,并且在我的 hibernate 配置中,“Hibernate 版本”是“4.0”。

最佳答案

检查类路径上是否没有两个 hibernate 版本

关于java - 使用 jboss 工具/hibernate 配置连接到数据库时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21388821/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com