You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Emad Radwan <er...@gmail.com> on 2022/05/07 22:58:28 UTC

Problem loading data in SQL Server

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

Re: Problem loading data in SQL Server

Posted by Emad Radwan <er...@gmail.com>.
Hi All,

Besides what I mentioned below, if I try to run Ofbiz and try to login as admin/ofbiz, I get the following message ‘You can’t login to this application’ and these messages in the log. I feel that’s because some admin data is missing, but as I mentioned earlier even if I drop the DB and re-create it keeps giving duplicate PK errors. Appreciate any help, please.

Regards,
Emad.

2022-05-09 22:43:01,855 |jsse-nio-8443-exec-9 |ControlServlet                |T| [[[login(Domain:https://localhost)] Request Begun, encoding=[UTF-8]- total:0.0,since last(Begin):0.0]]
2022-05-09 22:43:01,888 |jsse-nio-8443-exec-9 |ConfigXMLReader               |I| controller loaded: 0.001s, 16 requests, 14 views in file:/C:/apache-ofbiz-18/plugins/birt/webapp/ordermgr/WEB-INF/controller.xml
2022-05-09 22:43:01,939 |jsse-nio-8443-exec-9 |ConfigXMLReader               |I| controller loaded: 0.007s, 366 requests, 147 views in file:/C:/apache-ofbiz-18/applications/order/webapp/ordermgr/WEB-INF/controller.xml
2022-05-09 22:43:01,972 |jsse-nio-8443-exec-9 |ConfigXMLReader               |I| controller loaded: 0.001s, 49 requests, 21 views in file:/C:/apache-ofbiz-18/framework/common/webcommon/WEB-INF/common-controller.xml
2022-05-09 22:43:02,009 |jsse-nio-8443-exec-9 |ConfigXMLReader               |I| controller loaded: 0.0s, 0 requests, 0 views in file:/C:/apache-ofbiz-18/framework/common/webcommon/WEB-INF/handlers-controller.xml
2022-05-09 22:43:02,040 |jsse-nio-8443-exec-9 |ConfigXMLReader               |I| controller loaded: 0.0s, 4 requests, 0 views in file:/C:/apache-ofbiz-18/applications/commonext/webapp/WEB-INF/controller.xml
2022-05-09 22:43:02,082 |jsse-nio-8443-exec-9 |ConfigXMLReader               |I| controller loaded: 0.006s, 379 requests, 154 views in file:/C:/apache-ofbiz-18/applications/content/webapp/content/WEB-INF/controller.xml
2022-05-09 22:43:02,083 |jsse-nio-8443-exec-9 |JWTManager                    |I| Internal single sign on is disabled.
2022-05-09 22:43:02,088 |jsse-nio-8443-exec-9 |LoginWorker                   |I| Setting default delegator
2022-05-09 22:43:02,099 |jsse-nio-8443-exec-9 |ServiceDispatcher             |T| Sync service [order/userLogin] finished in [11] milliseconds
2022-05-09 22:43:02,099 |jsse-nio-8443-exec-9 |VisitHandler                  |I| Found visitorId [10000] in cookie
2022-05-09 22:43:02,107 |jsse-nio-8443-exec-9 |ServiceDispatcher             |T| Sync service [order/preferenceGetSetPermission] finished in [1] milliseconds
2022-05-09 22:43:02,111 |jsse-nio-8443-exec-9 |ServiceDispatcher             |T| Sync service [order/setUserPreference] finished in [6] milliseconds
2022-05-09 22:43:02,115 |jsse-nio-8443-exec-9 |RequestHandler                |I| Ran Event [java:org.apache.ofbiz.webapp.control.LoginWorker#login] from [request], result is [error]
2022-05-09 22:43:02,115 |jsse-nio-8443-exec-9 |RequestHandler                |E| Request login caused an error with the following message: You cannot login to this application
2022-05-09 22:43:02,115 |jsse-nio-8443-exec-9 |RequestHandler                |I| Rendering View [login].  Hidden sessionId by default.
2022-05-09 22:43:02,120 |jsse-nio-8443-exec-9 |ServiceDispatcher             |T| Sync service [order/getUserPreferenceGroup] finished in [3] milliseconds
2022-05-09 22:43:02,142 |jsse-nio-8443-exec-9 |ScreenFactory                 |I| Got 26 screens in 0.018s from: file:/C:/apache-ofbiz-18/framework/common/widget/CommonScreens.xml
2022-05-09 22:43:02,274 |jsse-nio-8443-exec-9 |ScreenFactory                 |I| Got 25 screens in 0.017s from: file:/C:/apache-ofbiz-18/themes/common-theme/widget/CommonScreens.xml
2022-05-09 22:43:02,290 |jsse-nio-8443-exec-9 |ScreenFactory                 |I| Got 4 screens in 0.015s from: file:/C:/apache-ofbiz-18/applications/order/widget/ordermgr/CommonScreens.xml
2022-05-09 22:43:02,302 |jsse-nio-8443-exec-9 |ScreenFactory                 |I| Got 1 screens in 0.01s from: file:/C:/apache-ofbiz-18/applications/commonext/widget/CommonScreens.xml
2022-05-09 22:43:02,305 |jsse-nio-8443-exec-9 |PrimaryKeyFinder              |I| Returning null because found incomplete primary key in find: [GenericEntity:PartyNameView][partyId,null()]
2022-05-09 22:43:02,373 |jsse-nio-8443-exec-9 |ServiceDispatcher             |T| Sync service [order/getLastSystemInfoNote] finished in [17] milliseconds
2022-05-09 22:43:02,527 |jsse-nio-8443-exec-9 |ServerHitBin                  |I| Visit delegatorName=default, ServerHitBin delegatorName=default
2022-05-09 22:43:02,648 |jsse-nio-8443-exec-9 |ControlServlet                |T| [[[login(Domain:https://localhost)] Request Done- total:0.793,since last([login(Domain:htt...):0.793]]
2022-05-09 22:43:02,858 |jsse-nio-8443-exec-8 |ControlServlet                |T| [[[SetTimeZoneFromBrowser(Domain:https://localhost)] Request Begun, encoding=[UTF-8]- total:0.0,since last(Begin):0.0]]
2022-05-09 22:43:02,864 |jsse-nio-8443-exec-8 |JWTManager                    |I| Internal single sign on is disabled.
2022-05-09 22:43:02,869 |jsse-nio-8443-exec-8 |ServiceDispatcher             |T| [[Sync service failed...- total:0.0,since last(Begin):0.0]] - 'order / SetTimeZoneFromBrowser'
2022-05-09 22:43:02,869 |jsse-nio-8443-exec-8 |TransactionUtil               |I| Transaction rolled back
2022-05-09 22:43:02,870 |jsse-nio-8443-exec-8 |TransactionUtil               |W| Not committing transaction, status is No Transaction (6)
2022-05-09 22:43:02,870 |jsse-nio-8443-exec-8 |RequestHandler                |I| Ran Event [service:#SetTimeZoneFromBrowser] from [request], result is [error]
2022-05-09 22:43:02,870 |jsse-nio-8443-exec-8 |RequestHandler                |E| Request SetTimeZoneFromBrowser caused an error with the following message: User authorization is required for this service: SetTimeZoneFromBrowser
2022-05-09 22:43:02,870 |jsse-nio-8443-exec-8 |RequestHandler                |I| [RequestHandler.doRequest]: Response is a chained request. Hidden sessionId by default.
2022-05-09 22:43:02,871 |jsse-nio-8443-exec-8 |RequestHandler                |I| [RequestHandler]: Chain in place: requestUri=json overrideViewUri=null Hidden sessionId by default.
2022-05-09 22:43:02,872 |jsse-nio-8443-exec-8 |RequestHandler                |I| Ran Event [java:org.apache.ofbiz.common.CommonEvents#jsonResponseFromRequestAttributes] from [request], result is [success]
2022-05-09 22:43:02,879 |jsse-nio-8443-exec-8 |ServerHitBin                  |I| Visit delegatorName=default, ServerHitBin delegatorName=default
2022-05-09 22:43:02,884 |jsse-nio-8443-exec-8 |ControlServlet                |T| [[[SetTimeZoneFromBrowser(Domain:https://localhost)] Request Done- total:0.026,since last([SetTimeZoneFromB...):0.026]]

> On 8 May 2022, at 12:58 AM, Emad Radwan <er...@gmail.com> wrote:
> 
> 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