The data representation of attachments (which is a part of the SimpleContentPortlet) changed from a Base64-encoded text field in v1.2.x and prior to a BLOB column in v2.0.0. Users of v1.2.x and prior must do the following procedure to export the data from the attachments tables, then re-import it with v2.0.0 or later to migrate the prior attachment data into the BLOB column. Also with v2.0.0 the logging was changed from log4j (log4j.properties) to logback (logback.xml) so you will need to update your uportal-portlets-overlay/SimpleContentPortlet accordingly.
- Export the existing data using the 1.2.x version of the portlet
- Import the saved data using the 2.0.0+ version of the portlet
- Update the version of the portlet you are deploying. Also update from log4j to loback for logging.
Clone the SimpleContentPortlet from https://github.com/Jasig/SimpleContentPortlet. You can do this on your target system (e.g. production) or on a system that has access to the target (e.g. production) database.
Modify src/main/resources/hibernate.properties to refer to your current database. Refer to the values in your uPortal filters/<environment>.properties file.
From the root of the SimpleContentPortlet source, export the existing data.
Checkout the latest version of the SimpleContentPortlet
- Using your database tools, back up the tables SCM_ATTACHMENT and sequence UP_ATTACHMENT_SEQ
Drop tables SCM_ATTACHMENT and sequence UP_ATTACHMENT_SEQ
From the root of the SimpleContentPortlet source, import the exported data. The database column will be created if it is not already present (if the new portlet is deployed to uPortal, that will also create the new column).
Update your uPortal pom.xml to use the latest released 2.0.0+ version (see http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.jasig.portlet.simplecontent%22 for latest version). Alternately for steps 7 and 8 you can cherry-pick https://github.com/Jasig/uPortal/commit/afeb7366caf02f607066f752158f1aa3bae47cd0.
- (within uPortal) Update your uportal-portlets-overlay/SimpleContentPortlet to switch from log4j.properties to loback.xml by putting this logback.xml into uportal-portlets-overlay/SimpleContentPortlet/src/main/resources. With uPortal master, the uportal-portlets-overlay/SimpleContentPortlet/pom.xml already includes filtering logback.xml as part of the maven build process. Also delete uportal-portlets-overlay/SimpleContentPortlet/src/main/resources/log4j.properties.
Deploy your uPortal (ant deploy-ear). Test and insure you are able to view the existing attachments, and can upload and view new attachments.
Insure on your target server that <tomcatHome>/webapps/SimpleContentPortlet/content is empty before performing your test of accessing existing attachments. That directory is the location the portlet hydrates files from the database onto the hard disk to avoid database accesses for subsequent attachment accesses. The directory should be empty as a result of deploying the portlet. If there are remaining files in the directory, these will be served instead of accessing the database and you may have a false sense that the export/import worked correctly when it had not.
Also clear your browser cache to insure content is not served from the browser's local cache.
- (optional but recommended) Drop the extraneous column SCM_ATTACHMENTS.DATA. This column held the Base64-encoded version of the attachments, but is now replaced by the column BDATA.