Solutions

Stay on top of everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up

Learn

Stay on top of everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up

Community

Stay on top of everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up

Company

Stay on top of everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up

 
Knowledgebase:
Mimetype Definitions Not Upgraded in Marklogic Server v8.0-1
24 February 2015 08:37 PM

Summary

New and updated mimetypes were added for MarkLogic 8.  If your MarkLogic Server instance has customized mimetypes, the upgrade to MarkLogic Server v8.0-1 will not update the mimetypes table. 

Details

MarkLogic 8 includes the following new mimetype values:

Name    Extension Format
application/json json json
application/rdf+json rj json
application/sparql-results+json srj json
application/xml xml xsd xvs sch    xml
text/json   json
text/xml   xml
application/vnd.marklogic-javascript     sjs text
application/vnd.marklogic-ruleset rules text

If you upgraded to 8.0 from a previous version of MarkLogic Server and if you have ever customized your mimetypes (for example, using the MIME Types Configuration page of the Admin Interface), the upgrade will not automatically add the new mimetypes to your configuration. If you have not added any mimetypes, then the new mimetypes will be automatically added during the upgrade. You can check if you have these mimetypes configured by going to the Mimetype page of the Admin Interface and checking if the above mimetypes exist. If they exist, then there is nothing you need to do.

Effect

Not having these mimetypes may lead to application level failures - for example: running Javascript code via Query Console will fail. 

Resolving Manually

If you do not have the above mimetypes after upgrading to 8.0, you can manually add the mimetypes to your configuration using the Admin Interface. To manually add the configuration, perform the following

  1. Open the Admin Interface in a browser (for example, open http://localhost:8001).
  2. Navigate to the Mimetypes page, near the bottom of the tree menu.
  3. Click the Create tab.
  4. Enter the name,the extension, and the format for the mimetype (see the table above).
  5. Click OK.
  6. Repeat the preceding steps for each mimetype in the above table.

Please be aware that updating the mimetype table results in a MarkLogic Server restart.  You will want to execute this procedure when MarkLogic Server is idle or during a maintenance window.

Resolve by Script

Alternatively, if you do not have the above mimetypes after upgrading to 8.0, you can add the mimetypes to your configuration by executing the following script in Query Console:

xquery version "1.0-ml";

import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy";
declare namespace mt = "http://marklogic.com/xdmp/mimetypes";

let $config := admin:get-configuration()
let $all-mimetypes := admin:mimetypes-get($config) (: existing mimetypes defined :)
let $new-mimetypes := (admin:mimetype("application/json""json""json"),
    admin:mimetype("application/rdf+json""rj""json"),
    admin:mimetype("application/sparql-results+json""srj""json"),
    admin:mimetype("application/xml""xml xsd xvs sch""xml"),
    admin:mimetype("text/json""""json"),
    admin:mimetype("text/xml""""xml"),
    admin:mimetype("application/vnd.marklogic-javascript", "sjs", "text"),
    admin:mimetype("application/vnd.marklogic-ruleset", "rules", "text"))
(: remove intersection to avoid conflicts :)
let $delete-mimetypes :=
    for $mimetype in $all-mimetypes
    return if ($mimetype//mt:name/data() = $new-mimetypes//mt:name/data()) then $mimetype else ()
let $config := admin:mimetypes-delete($config, $delete-mimetypes)
(: save new mimetype definitions :)
return admin:save-configuration( admin:mimetypes-add( $config, $new-mimetypes))
(: executing this query will result in a restart of MarkLogic Server :)

Please be aware that updating the mimetype table results in a MarkLogic Server restart.    You will want to execute this script when MarkLogic Server is idle or during a maintenance window.

Fixes

At the time of this writting, it is expected that the upgrade scripts will be improved in a maintenance release of MarkLogic Server where these updates will occur automatically.

(0 vote(s))
Helpful
Not helpful

Comments (0)