Hello Community,

After struggle configuring Ofbiz to build against SQL Server I have problem 
loading seed data and logging as
admin/ofbiz

I tried a number of grade/gradlew commands to build/load data and the latest 
was ‘gradlew cleanall loadall’

Part of the messages I get is related to primary key failure due to trying to 
insert a duplicate value although I dropped the database and re-created it 
before starting the new build.

Here’s part of the exit messages, if you can help, please.

Regards,
Emad


Caused by: org.apache.ofbiz.entity.GenericEntityException: Error while 
inserting: [GenericEntity:Person][createdStamp,2022-05-08 
00:43:57.619(java.sql.Timestamp)][createdTxStamp,2022-05-08 
00:43:57.618(java.sql.Timestamp)][lastUpdatedStamp,2022-05-08 
00:43:57.619(java.sql.Timestamp)][lastUpdatedTxStamp,2022-05-08 
00:43:57.618(java.sql.Timestamp)][partyId,_NA_(java.lang.String)] (SQL 
Exception while executing the following:INSERT INTO dbo.PERSON (PARTY_ID, 
SALUTATION, FIRST_NAME, MIDDLE_NAME, LAST_NAME, PERSONAL_TITLE, SUFFIX, 
NICKNAME, FIRST_NAME_LOCAL, MIDDLE_NAME_LOCAL, LAST_NAME_LOCAL, OTHER_LOCAL, 
MEMBER_ID, GENDER, BIRTH_DATE, DECEASED_DATE, HEIGHT, WEIGHT, 
MOTHERS_MAIDEN_NAME, MARITAL_STATUS, SOCIAL_SECURITY_NUMBER, PASSPORT_NUMBER, 
PASSPORT_EXPIRE_DATE, TOTAL_YEARS_WORK_EXPERIENCE, COMMENTS, 
EMPLOYMENT_STATUS_ENUM_ID, RESIDENCE_STATUS_ENUM_ID, OCCUPATION, 
YEARS_WITH_EMPLOYER, MONTHS_WITH_EMPLOYER, EXISTING_CUSTOMER, CARD_ID, 
LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) 
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (Cannot insert duplicate key row in object 
'dbo.PERSON' with unique index 'CARD_ID_IDX'. The duplicate key value is 
(<NULL>).))
        at 
org.apache.ofbiz.entity.datasource.GenericDAO.singleInsert(GenericDAO.java:172)
        at 
org.apache.ofbiz.entity.datasource.GenericDAO.insert(GenericDAO.java:110)
        at 
org.apache.ofbiz.entity.datasource.GenericHelperDAO.create(GenericHelperDAO.java:66)
        at 
org.apache.ofbiz.entity.GenericDelegator.create(GenericDelegator.java:874)
        ... 14 more
Caused by: org.apache.ofbiz.entity.GenericDataSourceException: SQL Exception 
while executing the following:INSERT INTO dbo.PERSON (PARTY_ID, SALUTATION, 
FIRST_NAME, MIDDLE_NAME, LAST_NAME, PERSONAL_TITLE, SUFFIX, NICKNAME, 
FIRST_NAME_LOCAL, MIDDLE_NAME_LOCAL, LAST_NAME_LOCAL, OTHER_LOCAL, MEMBER_ID, 
GENDER, BIRTH_DATE, DECEASED_DATE, HEIGHT, WEIGHT, MOTHERS_MAIDEN_NAME, 
MARITAL_STATUS, SOCIAL_SECURITY_NUMBER, PASSPORT_NUMBER, PASSPORT_EXPIRE_DATE, 
TOTAL_YEARS_WORK_EXPERIENCE, COMMENTS, EMPLOYMENT_STATUS_ENUM_ID, 
RESIDENCE_STATUS_ENUM_ID, OCCUPATION, YEARS_WITH_EMPLOYER, 
MONTHS_WITH_EMPLOYER, EXISTING_CUSTOMER, CARD_ID, LAST_UPDATED_STAMP, 
LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
?, ?, ?, ?, ?) (Cannot insert duplicate key row in object 'dbo.PERSON' with 
unique index 'CARD_ID_IDX'. The duplicate key value is (<NULL>).)
        at 
org.apache.ofbiz.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:435)
        at 
org.apache.ofbiz.entity.datasource.GenericDAO.singleInsert(GenericDAO.java:167)
        ... 17 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert 
duplicate key row in object 'dbo.PERSON' with unique index 'CARD_ID_IDX'. The 
duplicate key value is (<NULL>).
        at 
com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:265)
        at 
com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1676)
        at 
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:615)
        at 
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:537)
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7785)
        at 
com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:3793)
        at 
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:268)
        at 
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:242)
        at 
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:483)
        at 
org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:136)
        at 
org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:136)
        at 
org.apache.ofbiz.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:431)
        ... 18 more

> Task :ofbiz --load-data FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ofbiz --load-data'.
> Process 'command 'C:\Program Files\Eclipse 
> Adoptium\jdk-8.0.322.6-hotspot\bin\java.exe'' finished with non-zero exit 
> value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug 
option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with 
Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See 
https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 2m 36s
25 actionable tasks: 21 executed, 4 up-t

Reply via email to