postgresql 无法完成架构更新:org.h2.jdbc.JdbcSQLException:找不到表“PG_CLASS”;SQL语句
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27694783/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not complete schema update: org.h2.jdbc.JdbcSQLException: Table "PG_CLASS" not found; SQL statement
提问by Klimov Peter
I have next problem when deploy application on openshift. I use a wildfly application server and PostgreSQL cartrige.
在 openshift 上部署应用程序时,我遇到了下一个问题。我使用 Wildfly 应用程序服务器和 PostgreSQL 墨盒。
In persistence.xml i set property "hibernate.hbm2ddl.auto" value="update". In wildfly modules in org/main/postgresql i see that wildfly use postgresql-9.3-1102-jdbc41.jar
在persistence.xml 中,我设置了属性“hibernate.hbm2ddl.auto”值=“更新”。在 org/main/postgresql 中的 wildfly 模块中,我看到 wildfly 使用 postgresql-9.3-1102-jdbc41.jar
12:12:14,760 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] (ServerService Thread Pool -- 62) HHH000319: Could not get database metadata: org.h2.jdbc.JdbcSQLException: Table "PG_CLASS" not found; SQL statement:
select relname from pg_class where relkind='S' [42102-173]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:331)
at org.h2.message.DbException.get(DbException.java:171)
at org.h2.message.DbException.get(DbException.java:148)
at org.h2.command.Parser.readTableOrView(Parser.java:4864)
at org.h2.command.Parser.readTableFilter(Parser.java:1107)
at org.h2.command.Parser.parseSelectSimpleFromPart(Parser.java:1713)
at org.h2.command.Parser.parseSelectSimple(Parser.java:1821)
at org.h2.command.Parser.parseSelectSub(Parser.java:1707)
at org.h2.command.Parser.parseSelectUnion(Parser.java:1550)
at org.h2.command.Parser.parseSelect(Parser.java:1538)
at org.h2.command.Parser.parsePrepared(Parser.java:405)
at org.h2.command.Parser.parse(Parser.java:279)
at org.h2.command.Parser.parse(Parser.java:251)
at org.h2.command.Parser.prepareCommand(Parser.java:218)
at org.h2.engine.Session.prepareLocal(Session.java:428)
at org.h2.engine.Session.prepareCommand(Session.java:377)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1138)
at org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:72)
at org.jboss.jca.adapters.jdbc.WrappedStatement.executeQuery(WrappedStatement.java:344)
at org.hibernate.tool.hbm2ddl.DatabaseMetadata.initSequences(DatabaseMetadata.java:178) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.java:92) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.java:84) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:196) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:178) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:522) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.perform(EntityManagerFactoryBuilderImpl.java:852) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.perform(EntityManagerFactoryBuilderImpl.java:845) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:844) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
at org.jboss.as.jpa.hibernate4.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44) [jipijapa-hibernate4-3-1.0.1.Final.jar:]
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.run(PersistenceUnitServiceImpl.java:154) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.run(PersistenceUnitServiceImpl.java:117) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final]
at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_05]
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:474) [wildfly-security-manager-1.0.0.Final.jar:1.0.0.Final]
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.run(PersistenceUnitServiceImpl.java:182) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_05]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_05]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_05]
at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.1.Final.jar:2.1.1.Final]
I'am use a hibernate as JPA (hibernate-core-4.3.6). And i think that this problem with different version of Postgresql 9.2 and 9.3 Can anybody explain me how to change hibernate dialect at 9.2 Postgres version or change postgresql library module on openshift?
我使用 hibernate 作为 JPA (hibernate-core-4.3.6)。而且我认为这个问题与不同版本的 Postgresql 9.2 和 9.3 有谁能解释我如何在 9.2 Postgres 版本上更改休眠方言或在 openshift 上更改 postgresql 库模块?
采纳答案by Toastor
Had the same error recently. Please open your wildfly's standalone.xml (or standalone-full.xml or whichever you are using) and find and delete the following fragment:
最近有同样的错误。请打开您的wildfly的standalone.xml(或standalone-full.xml或您使用的任何一个)并找到并删除以下片段:
<default-bindings contextservice="java:jboss/ee/concurrency/context/default" datasource="java:jboss/datasources/ExampleDS" jms-connection factory="java:jboss/DefaultJMSConnectionFactory" managed-executor-service="java:jboss/ee/concurrency/executor/default" managed-scheduled-executor-service="java:jboss/ee/concurrency/scheduler/default" managed-thread-factory="java:jboss/ee/concurrency/factory/default"/>
Important: Make sure to shut wildfly down before editing, otherwise it will overwrite the changes the next time it shuts down.
重要提示:请确保在编辑前关闭wildfly,否则下次关闭时会覆盖更改。
回答by Klimov Peter
I just change hibernate property hibernate.hbm2ddl.auto
to create value. This resolved issue for me.
我只是改变休眠属性hibernate.hbm2ddl.auto
来创造价值。这为我解决了问题。
回答by Paul Hilliar
You need this property spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
你需要这个属性 spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
回答by skuarch
spring.jpa.database-platform solved my problem
spring.jpa.database-platform 解决了我的问题
回答by Dheeraj Pure
1) check if you are using correct dialect in application.properties
1) 检查您是否在 application.properties 中使用了正确的方言
spring.jpa.database-platform
2) and check the value of spring.jpa.hibernate.ddl-auto
2)并检查值 spring.jpa.hibernate.ddl-auto