我尝试使用 docker-toolbox 将Apache Isis的simple-app 1.15.0与Postgresql集成。但是我有一个问题,它说由于数据库被拒绝,我无法创建模式。我试图谷歌它并阅读apache isis文档但无法获得解决方案。
我想我在isis.properties中搞砸了。我只是取消注释了isis.properties的这一部分并进行了一些修改。
isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=org.postgresql.Driver
isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:postgresql://192.168.99.100:5432/mubuss
isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=root
isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=root
这是堆栈跟踪的一部分。
19:49:56,498 [IsisConfigurationDefault main INFO ] adding isis.persistor.datanucleus.classMetadataLoadedListener = org.apache.isis.objectstore.jdo.datanucleus.CreateSchemaObjectFromClassMetadata
19:49:56,499 [IsisConfigurationDefault main INFO ] adding isis.reflector.facet.cssClass.patterns = delete.*:btn-danger,discard.*:btn-warning,remove.*:btn-warning
19:49:56,499 [IsisConfigurationDefault main INFO ] adding isis.persistor.datanucleus.impl.datanucleus.schema.validateConstraints = true
19:49:56,499 [IsisConfigurationDefault main INFO ] adding isis.persistor.datanucleus.impl.datanucleus.identifier.case = MixedCase
19:49:56,505 [ServicesInstallerFromConfigurationAndAnnotation main INFO ] installing org.apache.isis.core.runtime.services.ServicesInstallerFromConfigurationAndAnnotation
19:49:56,693 [IsisConfigurationDefault main INFO ] adding isis.fixtures =
19:49:56,697 [IsisSessionFactoryBuilder main INFO ] initialising Isis System
19:49:56,697 [IsisSessionFactoryBuilder main INFO ] working directory: D:\Paul\Workspace\petclinic\webapp\.
19:49:56,697 [IsisSessionFactoryBuilder main INFO ] resource stream source: chain [file system (directory 'D:\Paul\Workspace\petclinic\webapp\src\main\webapp\WEB-INF'), context loader classpath, context loader classpath, context loader classpath, current class' classpath, servlet context ('/WEB-INF')]
19:49:58,556 [PersistenceSessionFactory main INFO ] did *not* find config properties to use JNDI datasource; will use JDBC
19:49:59,779 [Schema main DEBUG] Column ""DELETEME1509536999770"."UNUSED"" added to internal representation of table.
19:49:59,784 [Schema main DEBUG] Attempt to find JDBC driver 'typeInfo' for jdbc-type=INTEGER but sql-type=INTEGER is not found. Using default sql-type for this jdbc-type.
19:49:59,784 [Schema main DEBUG] Creating table "DELETEME1509536999770"
19:49:59,787 [Schema main DEBUG] CREATE TABLE "DELETEME1509536999770"
(
"UNUSED" int4 NOT NULL
)
19:49:59,790 [Schema main DEBUG] Execution Time = 3 ms
19:49:59,794 [Schema main DEBUG] Catalog Name could not be determined for this datastore
19:49:59,794 [Schema main DEBUG] Dropping table "DELETEME1509536999770"
19:49:59,794 [Schema main DEBUG] DROP TABLE "DELETEME1509536999770" CASCADE
19:49:59,796 [Schema main DEBUG] Execution Time = 1 ms
19:50:00,701 [Schema main DEBUG] Column ""DELETEME1509537000701"."UNUSED"" added to internal representation of table.
19:50:00,701 [Schema main DEBUG] Attempt to find JDBC driver 'typeInfo' for jdbc-type=INTEGER but sql-type=INTEGER is not found. Using default sql-type for this jdbc-type.
19:50:00,701 [Schema main DEBUG] Creating table "DELETEME1509537000701"
19:50:00,701 [Schema main DEBUG] CREATE TABLE "DELETEME1509537000701"
(
"UNUSED" int4 NOT NULL
)
19:50:00,704 [Schema main DEBUG] Execution Time = 3 ms
19:50:00,707 [Schema main DEBUG] Catalog Name could not be determined for this datastore
19:50:00,708 [Schema main DEBUG] Dropping table "DELETEME1509537000701"
19:50:00,708 [Schema main DEBUG] DROP TABLE "DELETEME1509537000701" CASCADE
19:50:00,709 [Schema main DEBUG] Execution Time = 1 ms
19:50:00,786 [CreateSchemaObjectFromClassMetadata main WARN ] Unable to create schema
org.postgresql.util.PSQLException: ERROR: permission denied for database mubuss
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:366)
at org.apache.isis.objectstore.jdo.datanucleus.CreateSchemaObjectFromClassMetadata.exec(CreateSchemaObjectFromClassMetadata.java:120)
at org.apache.isis.objectstore.jdo.datanucleus.CreateSchemaObjectFromClassMetadata.loaded(CreateSchemaObjectFromClassMetadata.java:79)
修改
这是固定的。但我不知道为什么它得到修复。请提供答案。
我使用的是 Docker Toolbox 。并使用来自sameersbn link的这个docker-compose.yml,我认为因为这个yml,当我执行命令 docker-compose up -d 时,它没有下载所有必需的文件。所以当我从这个vovimayhem link尝试这个docker-compose.yml时,它已被修复。我只是假设这个解决了这个问题。
答案 0 :(得分:0)
从您的错误中我假设用户root
无法连接到mubuss
数据库,例如:
postgres=# revoke connect ON DATABASE t from c;
REVOKE
postgres=# \q
-bash-4.2$ psql -U c t
psql: FATAL: permission denied for database "t"
DETAIL: User does not have CONNECT privilege.
因此您需要使用不同的用户或仅授予连接,例如:
postgres=# grant connect ON DATABASE t to c;
GRANT
postgres=# \q
-bash-4.2$ psql -U c t
psql (9.3.14)
Type "help" for help.
t=>
所以对你来说就是
grant connect ON DATABASE mubuss to root;