Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0040047Openbravo ERPY. DBSourceManagerpublic2019-01-28 17:012019-03-28 14:55
caristu 
caristu 
highminorhave not tried
closedfixed 
5
 
3.0PR19Q2 
alostale
Core
No
0040047: Fix database export to avoid manually copying wstx-asl-3.0.2.jar inside Ant folder
Currently if the wstx-asl-3.0.2.jar library is not present inside the lib folder of the base Ant folder, then after exporting the database the xml headers of the database model files are exported with double quotes.

This is because the com.sun.xml.internal.stream.XMLOutputFactoryImpl[1] class is used instead of the com.ctc.wstx.stax.WstxOutputFactory[2].

Besides, note that apart of exporting the xml header with single quotes, it is faster to use the class provided by the wstx-asl-3.0.2.jar library

[1] https://github.com/keerath/openjdk-8-source/blob/master/jaxp/src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java#L1199 [^]
[2] https://github.com/FasterXML/woodstox/blob/master/src/main/java/com/ctc/wstx/stax/WstxOutputFactory.java [^]
1) Ensure that the wstx-asl-3.0.2.jar is not present inside the lib folder of the base Ant folder.
2) Run ant export.database
3) Note that XML headers have been exported with double quotes
Use a forked ant task to include the wstx-asl-3.0.2.jar in the classpath when executing these export tasks:

- ant export.database
- ant export.sample.data

Note that this change is not needed for the export.config.script because it is using a different mechanism to export the template definition into the XML files. See[1], [2].

Also note that after fixing this issue it will not be necessary to include that library inside the Ant folder as explained here[3].

[1] https://code.openbravo.com/erp/devel/dbsm-main/file/tip/src/org/openbravo/ddlutils/task/ExportConfigScript.java#l240 [^]
[2] https://code.openbravo.com/erp/devel/dbsm-main/file/tip/src/org/apache/ddlutils/io/DatabaseIO.java#l527 [^]
[3] http://wiki.openbravo.com/wiki/Common_Issues_Tips_and_Tricks#After_export.database_all_the_xml_headers_use_double_quotes [^]
No tags attached.
related to design defect 0039056 closed caristu Hibernate pool is being used by some ant tasks 
related to defect 0040246 closed caristu It is not needed to include the woodstox library in the runtime classpath 
causes defect 0040152 closed caristu export.database is slower after defining it as a forked task 
causes defect 0040187 closed caristu export.database gets stuck using old pool 
Issue History
2019-01-28 17:01caristuNew Issue
2019-01-28 17:01caristuAssigned To => caristu
2019-01-28 17:01caristuModules => Core
2019-01-28 17:01caristuTriggers an Emergency Pack => No
2019-01-28 17:02caristuRelationship addedrelated to 0039056
2019-01-28 19:12caristuDescription Updatedbug_revision_view_page.php?rev_id=18205#r18205
2019-01-28 19:12caristuSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=18207#r18207
2019-01-29 08:49caristuDescription Updatedbug_revision_view_page.php?rev_id=18212#r18212
2019-01-29 09:00caristuDescription Updatedbug_revision_view_page.php?rev_id=18213#r18213
2019-01-29 13:53caristuProposed Solution updated
2019-01-29 16:38caristuStatusnew => scheduled
2019-02-01 08:32hgbotCheckin
2019-02-01 08:32hgbotNote Added: 0109376
2019-02-01 08:36hgbotCheckin
2019-02-01 08:36hgbotNote Added: 0109378
2019-02-01 08:36hgbotStatusscheduled => resolved
2019-02-01 08:36hgbotResolutionopen => fixed
2019-02-01 08:36hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/aaa984886667a027a8c99692447febe6e4ca7707 [^]
2019-02-01 08:36caristuReview Assigned To => alostale
2019-02-01 08:44caristuNote Added: 0109381
2019-02-01 10:14alostaleNote Added: 0109417
2019-02-01 10:14alostaleStatusresolved => closed
2019-02-01 10:14alostaleFixed in Version => 3.0PR19Q2
2019-02-05 18:16caristuRelationship addedcauses 0040152
2019-02-12 19:14caristuRelationship addedcauses 0040187
2019-02-20 17:03caristuRelationship addedrelated to 0040246
2019-02-20 18:33caristuNote Edited: 0109381bug_revision_view_page.php?bugnote_id=0109381#r18353
2019-03-28 14:55hudsonbotCheckin
2019-03-28 14:55hudsonbotNote Added: 0110763

Notes
(0109376)
hgbot   
2019-02-01 08:32   
Repository: erp/devel/dbsm-main
Changeset: 3dc03f579c070c8b4fb62a9ca059bf632f02f513
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Fri Feb 01 08:25:34 2019 +0100
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/3dc03f579c070c8b4fb62a9ca059bf632f02f513 [^]

related to bug 40047: dbsm changes required to support forked export tasks

---
M src/org/openbravo/ddlutils/task/AlterDatabaseJava.java
M src/org/openbravo/ddlutils/task/ExportDatabase.java
M src/org/openbravo/ddlutils/task/ExportSampledata.java
A src/org/openbravo/ddlutils/task/JavaTaskUtils.java
---
(0109378)
hgbot   
2019-02-01 08:36   
Repository: erp/devel/pi
Changeset: aaa984886667a027a8c99692447febe6e4ca7707
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Thu Jan 31 19:19:21 2019 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/aaa984886667a027a8c99692447febe6e4ca7707 [^]

Fixes bug 40047: include wstx-asl-3.0.2.jar in the classpath on database export

  - Execute ant export.database and export.sample.data as forked tasks in order to define the classpath of those tasks with the required libraries. This way, it will be no longer needed to manually copying wstx-asl-3.0.2.jar inside Ant folder to get the xml headers of the database model files with single quotes.

  - Besides, the runtime-classpath now includes the Tomcat pool libraries. Therefore these tasks now use it to retrieve the DB connections. Otherwise, the default Hibernate pool would be used, forcing to explicitly close it within the tasks as we do here[1].

  - Updated dbsourcemanager.jar with the changes in DBSourceManager.

[1] https://code.openbravo.com/erp/devel/pi/rev/3ed849d672ae34b8bcec1d16aaea800ea68e5c61 [^]

---
M src-db/database/build.xml
M src-db/database/lib/dbsourcemanager.jar
---
(0109381)
caristu   
2019-02-01 08:44   
(edited on: 2019-02-20 18:33)
Wiki sections updated:

http://wiki.openbravo.com/wiki/Common_Issues_Tips_and_Tricks#After_export.database_all_the_xml_headers_use_double_quotes [^]

http://wiki.openbravo.com/wiki/Installation/Custom/Openbravo_Setup [^]

(0109417)
alostale   
2019-02-01 10:14   
reviewed + tested
(0110763)
hudsonbot   
2019-03-28 14:55   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/b2fbc1588df4 [^]
Maturity status: Test