Open bejondshao opened 6 years ago
And issue also happens with postgresql.
The first on tomcat startup, the table user_info contains only one "admin". Shutdown tomcat, start it again. Then run SELECT id, sub, preferred_username, name, email, email_verified FROM user_info;
and I got:
"1" "90342.ASDFJWFA" "admin" "Demo Admin" "admin@example.com" true "2" "01921.FLANRJQW" "user" "Demo User" "user@example.com" true "3" "90342.ASDFJWFA" "admin" "Demo Admin" "admin@example.com" true "4" "01921.FLANRJQW" "user" "Demo User" "user@example.com" true
The third time start tomcat, it gets 3 "admin" user. Do I need to set something to disable run users.sql?
Duplicate rows happen to table client_scope.
'1','openid' '1','profile' '1','email' '1','address' '1','phone' '1','offline_access' '1','openid' '1','profile' '1','email' '1','address' '1','phone' '1','offline_access' '1','openid' '1','profile' '1','email' '1','address' '1','phone' '1','offline_access' '4','address' '4','phone' '4','openid' '4','email' '4','profile'
But table system_scope is fine. There's no duplicate rows in system_scope.
my data-config.xml is
<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3306/oic_cp1250" />
<property name="username" value="user" />
<property name="password" value="123" />
</bean>
<bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
<property name="databasePlatform" value="org.eclipse.persistence.platform.database.MySQLPlatform" />
<property name="showSql" value="true" />
</bean>
<!-- You can optionally initialize the database with test values here,
but this is not recommended for real systems -->
<jdbc:initialize-database data-source="dataSource">
<jdbc:script location="classpath:/db/mysql/mysql_database_tables.sql"/>
<jdbc:script location="classpath:/db/mysql/security-schema.sql"/>
<jdbc:script location="classpath:/db/mysql/loading_temp_tables.sql"/>
<jdbc:script location="classpath:/db/mysql/users.sql"/>
<jdbc:script location="classpath:/db/mysql/clients.sql"/>
<jdbc:script location="classpath:/db/mysql/scopes.sql"/>
</jdbc:initialize-database>
The workaround I choose now is
cp1250
. Run mvn clean package
with the data-config.xml below:<bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
<property name="databasePlatform" value="org.eclipse.persistence.platform.database.MySQLPlatform" />
<property name="showSql" value="true" />
</bean>
<!-- You can optionally initialize the database with test values here,
but this is not recommended for real systems -->
<jdbc:initialize-database data-source="dataSource">
<jdbc:script location="classpath:/db/mysql/mysql_database_tables.sql"/>
<jdbc:script location="classpath:/db/mysql/security-schema.sql"/>
<jdbc:script location="classpath:/db/mysql/loading_temp_tables.sql"/>
</jdbc:initialize-database>
loading_temp_tables.sql
(loading_temp_tables.sql comes first), mysql/mysql_database_index.sql
, mysql/clients.sql
, mysql/scopes.sql
and mysql/users.sql
manually.You should only be using the temp_tables scripts on development databases where you need to bootstrap a system. Production systems should not be running them on startup, and it's not recommended to run them on MySQL or other on-disk databases anyway.
I use tag mitreid-connect-1.3.2, mysql 5.7.16. I config mysql db, build war and deploy to apache.
The default mysql scripts is unable to startup. I copy loading_temp_tables.sql from /db/hsql/loading_temp_tables.sql. I modify it from
to
and modify mysql_database_tables.sql from:
to:
Finally it starts up. I can login now. Then I restart tomcat. The second time I login. I get the same error. And the log shows