Corda fails to startup if hibernate_sequence is already created in Postgres - spring

My Spring and Corda nodes share the same Posgres database. When I start first Corda nodes and then Spring everything goes smoothly. But if I start everything together like 'docker-compose up' I see following exception. It seems that Corda doesn't like if Spring creates hibernate_sequence first.
I see this problem with Corda 4.0 but with Corda 3.3 everything worked fine.
Is there any way to avoid this not-expected behaviour?
> ! ATTENTION: This node is running in development mode! This is not safe for production deployment.
[ERROR] 14:50:53+0000 [main] liquibase.severe - master.changelog.json: migration/common.changelog-init.xml::1511451595465-1.3::R3.Corda: Change Set migration/common.changelog-init.xml::1511451595465-1.3::R3.Corda failed. Error: ERROR: relation "hibernate_sequence" already exists [Failed SQL: CREATE SEQUENCE public.hibernate_sequence MINVALUE 1]
[ERROR] 14:50:53+0000 [main] internal.NodeStartupLogging.invoke - Could not create the DataSource: Migration failed for change set migration/common.changelog-init.xml::1511451595465-1.3::R3.Corda:
Reason: liquibase.exception.DatabaseException: ERROR: relation "hibernate_sequence" already exists [Failed SQL: CREATE SEQUENCE public.hibernate_sequence MINVALUE 1]: Could not create the DataSource: Migration failed for change set migration/common.changelog-init.xml::1511451595465-1.3::R3.Corda:
Reason: liquibase.exception.DatabaseException: ERROR: relation "hibernate_sequence" already exists [Failed SQL: CREATE SEQUENCE public.hibernate_sequence MINVALUE 1] [errorCode=euq4co, moreInformationAt=https://errors.corda.net/OS/5.0-SNAPSHOT/euq4co]

This is a bug documented here: https://r3-cev.atlassian.net/browse/CORDA-2393.

Indeed sequenceExists precondition solved the issue. The fix is pushed to Corda master in 57d0040.

Related

Liquibase in a Spring Application doesn't fail on unknown change type

We’ve recently ran into an issue where we had a typo in a Liquibase change type and nothing caught this issue. We used the addNonNullConstraint change type, which does not exist, instead of addNotNullConstraint.
The issue here is that we're using YAML format for the changeset file, which doesn't have any validation. With the XML format, we would at least get an error in the editor.
Executing the Liquibase CLI validate command finds the faulty change set:
➜ git: ✗ liquibase validate
Starting Liquibase at 13:46:47 (version 4.17.0 #4922 built at 2022-10-05 14:56+0000)
Liquibase Version: 4.17.0
Liquibase Community 4.17.0 by Liquibase
Unexpected error running Liquibase: Error parsing db/changelog.yaml
- Caused by: Error parsing /db/changes/0019_mark-column-non-null.yaml
- Caused by: Error parsing /db/changes/0019_mark-column-non-null.yaml: Unknown change type 'addNonNullConstraint'. Check for spelling or capitalization errors and missing extensions such as liquibase-commercial.
For more information, please use the --log-level flag
But when starting up the Spring Boot app, there’s no hint that something went wrong with one of the new changesets that need to be applied:
INFO Liquibase.database : Set default schema name to public
INFO liquibase.lockservice : Successfully acquired change log lock
INFO liquibase.changelog : Reading from public.databasechangelog
Running Changeset: /db/changes/0019_mark-column-non-null.yaml::Mark column as non-null::Dev
INFO liquibase.changelog : ChangeSet /db/changes/0019_mark-column-non-null.yaml::Mark column as non-null::Dev ran successfully in 0ms
Ideally, the Spring Boot app would validate the change sets before applying them, and fail if the change type is unknown. But I could not find out how to run the Liquibase validate command in the context of the Spring integration.

liquibase.exception.DatabaseException: Syntax error in SQL statement " CREATE EXTENSION[*] UUID-OSSP;

Im using postgres with liquibase on cloud and h2db on my local machine. When i write sql queries for generating uuid, i get the error during build:
liquibase.exception.DatabaseException: Syntax error in SQL statement " CREATE EXTENSION[*] UUID-OSSP;
So i removed ossp extension and used gen_random_uuid() instead. And i get the below eror:
Caused by: liquibase.exception.LiquibaseException:
liquibase.exception.MigrationFailedException: Migration failed for change set db/scripts/123_Somescripts.sql::raw::includeAll:
Reason: liquibase.exception.DatabaseException: Syntax error in SQL statement "
I start getting this error during build when i include H2 DB dependency. Otherwise the build works fine.
BUT, even if build works fine, i get the error:
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
Process finished with exit code 0
I configured postgres db in appication-local.yml, and activated local profile but build still fails.

OBIEE12c configuration failed with oracle database 19c

My OBIEE12c configuration failed after proceed 12%.
OBIEE version: 12.2.1.4
Oracle Database version: 19c
Stack Trace:
Variable in stdconfigactionhandler : BI Configuration
progress in calculate progress6
progress in calculate progress6
java.lang.IllegalStateException: Action:BI_Configuration failed with error:Configure BI Failed with Execution of [/u01/app/middleware/bi_home/oracle_common/common/bin/wlst.sh, /u01/app/middleware/bi_home/bi/modules/oracle.bi.configassistant/essbase.py, /u01/app/middleware/bi_home, /u01/app/middleware/bi_home/user_projects/domains/bi12c, weblogic, Expanded, EDWIPRDAPP1, 9502, 9503, ORACLE, oracle.jdbc.OracleDriver, jdbc:oracle:thin:#//EDWIPRDDB-scan:1521/edwprddb, DEVBI, jdbc:oracle:thin:#//EDWIPRDDB-scan:1521/edwprddb, ] failed with exit value 1
at oracle.as.install.engine.modules.configuration.client.ConfigAction.fail(ConfigAction.java:281)
at oracle.bi.install.config.actions.BIConfigAction.doExecute(BIConfigAction.java:137)
at oracle.as.install.engine.modules.configuration.client.ConfigAction.execute(ConfigAction.java:405)
at oracle.as.install.engine.modules.configuration.action.TaskPerformer.run(TaskPerformer.java:88)
at oracle.as.install.engine.modules.configuration.action.TaskPerformer.startConfigAction(TaskPerformer.java:108)
at oracle.as.install.engine.modules.configuration.action.ActionRequest.perform(ActionRequest.java:15)
at oracle.as.install.engine.modules.configuration.action.RequestQueue.performSequentialExecution(RequestQueue.java:284)
at oracle.as.install.engine.modules.configuration.action.RequestQueue.perform(RequestQueue.java:260)
at oracle.as.install.engine.modules.configuration.standard.StandardConfigActionManager.start(StandardConfigActionManager.java:185)
at oracle.as.install.engine.modules.configuration.boot.ConfigurationExtension.kickstart(ConfigurationExtension.java:82)
at oracle.as.install.engine.modules.configuration.ConfigurationModule.run(ConfigurationModule.java:87)
at java.lang.Thread.run(Thread.java:820)
In Config Module Finish Event...
The following workaround can fix the issue
Step 1: First following command in the current session
export JAVA_OPTIONS="-Doracle.jdbc.fanEnabled=false ${JAVA_OPTIONS} ${JAVA_PROPERTIES}"
export JAVA_OPTIONS
export CONFIG_JVM_ARGS=-Doracle.jdbc.fanEnabled=false
Step 2: Remove or rename the following file
$Oracle_home/oracle_common/lib/ons.jar
Ste3. Re-run the configuration assistant
$Oracle_Home/bi/bin/config.sh or config.cmd

Unable to create a table from Hive CLI - ERROR 23502

I seem to be getting the below exception when I try to create a table using Hive client.
create table if not exists test (id int, name string) comment 'test table';
11:15:32.016 [HiveServer2-Background-Pool: Thread-34] ERROR org.apache.hadoop.hive.metastore.RetryingHMSHandler - Retrying HMSHandler after 2000 ms (attempt 1 of 10) with error: javax.jdo.JDODataStoreException: Insert of object "org.apache.hadoop.hive.metastore.model.MTable#784fafc2" using statement "INSERT INTO TBLS (TBL_ID,CREATE_TIME,DB_ID,LAST_ACCESS_TIME,OWNER,RETENTION,SD_ID,TBL_NAME,TBL_TYPE,VIEW_EXPANDED_TEXT,VIEW_ORIGINAL_TEXT) VALUES (?,?,?,?,?,?,?,?,?,?,?)" failed : Column 'IS_REWRITE_ENABLED' cannot accept a NULL value.
at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:543)
at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:720)
Caused by: ERROR 23502: Column 'IS_REWRITE_ENABLED' cannot accept a NULL value.
at org.apache.derby.client.am.ClientStatement.completeExecute(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parseEXCSQLSTTreply(Unknown Source)
I did search but couldn't find a satisfactory resolution.
Here is my set up:
Hive 2.1.0
OS: Windows
Hadoop: 2.9.2
Derby: 10.14.2.0
What am i missing?
Thanks.
Seems like a compatibility issue with derby. I moved back to a earlier version of derby 10.2.1.1 and the issue went away.

Worklight 6.2 migration tool error

I am working on migrating data from WL 5.0.6.2 to 6.2. While doing that I encountered problems running data migration tool.
Background:
Approach:
we export the WRKLGHT table from 5062 DB to an intermediate DB for data migration so the running DB is not affected.
DBs:
1. schema: proj
its storing 5062 runtime data, upgrade-worklight-506-60-oracle.sql, upgrade-worklight-60-61-oracle.sql upgrade sql are executed.
2. schema: proj6
its blank DB at first, "create-worklightadmin-oracle.sql" is executed to prepare WLADMIN tables.
WL Project existing:
1. wlProj
its the app running on 5062 WL server
2. wlProj6
its the target project running on 6.2 WL, and data will be migrated to be used by this project
Steps:
1. recreate proj6 schema
1.1 SQLPlus -> connect as SYSTEM -> "drop user proj6 cascade"
1.2. -> "create user proj6 identified by {password}" -> "grant all privileges to proj6"
2. execute "create-worklightadmin-oracle.sql" on proj6 schema
2.1 SQLDeveloper -> connect as user proj6
2.2 run #"{ WL server install dir}/databases/create-worklightadmin-oracle.sql";
2.3 commit
3. Open cmd and run the following command
java -cp ojdbc6.jar;worklight-ant-deployer.jar com.ibm.worklight.config.dbmigration62.MigrationTool -p /wlProj -sourceurl jdbc:oracle:thin:#//192.168.0.**:1521/xe -sourcedriver oracle.jdbc.driver.OracleDriver -sourceuser proj -sourcepassword *** -targeturl jdbc:oracle:thin:#//192.168.0.***:1521/xe -targetdriver oracle.jdbc.driver.OracleDriver -targetuser proj6 -targetpassword *** 2>out.txt
'migrating wlProj-{ios,android}' & 'migrating access data record for wlProj-.....' are shown in cmd.
And in out.txt, the following error is shown.
15 WorklightManagementPU-oracle INFO [main] openjpa.Runtime - Starting OpenJPA 1.2.2
15 WorklightManagementPU-oracle INFO [main] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.OracleDictionary".
com.ibm.worklight.config.dbmigration62.exceptions.MigrationException: FWLSE3406E: The applications migration failed with error The field "description" of instance "ApplicationEntity[id=51, name=wlProj, displayName=, description=null, thumbnail=null, platformVersion=null]" contained a null value; the metadata for this field specifies that nulls are illegal..
at com.ibm.worklight.config.dbmigration62.MigrationTool.run(MigrationTool.java:195)
at com.ibm.worklight.config.dbmigration62.MigrationTool.main(MigrationTool.java:128)
Caused by: <openjpa-1.2.2-r422266:898935 fatal user error> org.apache.openjpa.persistence.InvalidStateException: The field "description" of instance "ApplicationEntity[id=51, name=wlProj, displayName=, description=null, thumbnail=null, platformVersion=null]" contained a null value; the metadata for this field specifies that nulls are illegal.
at org.apache.openjpa.kernel.SingleFieldManager.preFlush(SingleFieldManager.java:540)
at org.apache.openjpa.kernel.SingleFieldManager.preFlush(SingleFieldManager.java:478)
at org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManagerImpl.java:2829)
at org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:39)
at org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(StateManagerImpl.java:960)
at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1967)
at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1927)
at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1845)
at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81)
at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1369)
at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:877)
at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:512)
at com.ibm.worklight.config.dbmigration62.ApplicationMigration.migrateApplication(ApplicationMigration.java:138)
at com.ibm.worklight.config.dbmigration62.ApplicationMigration.migrate(ApplicationMigration.java:63)
at com.ibm.worklight.config.dbmigration62.AbstractMigration.run(AbstractMigration.java:66)
at com.ibm.worklight.config.dbmigration62.MigrationTool.run(MigrationTool.java:183)
... 1 more
ERROR 20 : FWLSE3406E: The applications migration failed with error The field "description" of instance "ApplicationEntity[id=51, name=wlProj, displayName=, description=null, thumbnail=null, platformVersion=null]" contained a null value; the metadata for this field specifies that nulls are illegal..
This is recorded as IBM PMR #77138,999,738, and was identified as a defect that is currently being worked on.
There is no local fix to do other than wait for a fix via the support ticket.

Resources