0
votes

SplitApp demo developed in eclipse is working fine. When I am trying to migrate the same to Openui5, I am facing problem.

I have changed the bootstrap url to https://openui5.hana.ondemand.com/resources/sap-ui-core.js.

Still the issue persists.

I get the error as below :

2014-06-15 22:26:43 Device API logging initialized - DEVICE sap-ui-core.js:44
2014-06-15 22:26:43 registerResourcePath ('', 'https://openui5.hana.ondemand.com/resources/') -  sap.ui.ModuleSystem sap-ui-core.js:80
2014-06-15 22:26:43 URL prefixes set to: -  sap.ui.ModuleSystem sap-ui-core.js:80
2014-06-15 22:26:43   (default) : https://openui5.hana.ondemand.com/resources/ -  sap.ui.ModuleSystem sap-ui-core.js:80
2014-06-15 22:26:43 registerResourcePath ('view', './view/') -  sap.ui.ModuleSystem sap-ui-core.js:80
2014-06-15 22:26:43 registerResourcePath ('model', './model/') -  sap.ui.ModuleSystem sap-ui-core.js:80
2014-06-15 22:26:43 registerResourcePath ('app', './app/') -  sap.ui.ModuleSystem sap-ui-core.js:80
2014-06-15 22:26:43 registerResourcePath ('i18n', './i18n/') -  sap.ui.ModuleSystem sap-ui-core.js:80
2014-06-15 22:26:44 registerResourcePath ('model', './model/') -  sap.ui.ModuleSystem sap-ui-core.js:80
GET http://myDomain/i18n/i18n_en_US.properties 404 (Not Found) sap-ui-core.js:27
GET http://myDomain/i18n/i18n_en.properties 404 (Not Found) sap-ui-core.js:27
GET http://myDomain/i18n/i18n.properties 404 (Not Found) sap-ui-core.js:27
GET http://myDomain/model/menu.json 404 (Not Found) sap-ui-core.js:27
2014-06-15 22:26:45 The following problem occurred: error - 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
  <head>

    <meta name="revisit-after" content="10">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <script type="text/javascript" language="JavaScript"
        src="http://cdn.dsultra.com/js/registrar.js"></script>

    <script type="text/javascript" language="JavaScript">
        registrar_frameset({ a_id: 48873,       // edit this to pass your portfolio ID,
                             drid: 'as-drid-2416478692338427'});     // edit this to pass your Domain Registrant ID
    </script>

  </head>
</html>,404,Not Found  sap-ui-core.js:80
GET http://myDomain/model/coffee.json 404 (Not Found) sap-ui-core.js:27
2014-06-15 22:26:45 The following problem occurred: error - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
  <head>

    <meta name="revisit-after" content="10">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <script type="text/javascript" language="JavaScript"
        src="http://cdn.dsultra.com/js/registrar.js"></script>

    <script type="text/javascript" language="JavaScript">
        registrar_frameset({ a_id: 48873,       // edit this to pass your portfolio ID,
                             drid: 'as-drid-2416478692338427'});     // edit this to pass your Domain Registrant ID
    </script>

  </head>
</html>,404,Not Found

The error says it is not able to find json models and properties files. Please let me know if I have to maintain configurations at application level.

Please find the openui5 source in the Github and attached image consists the folder structure in eclipse which is used for sapui5.

Folder structure

1
perhaps you could share the bootstrap parameters and what's in your folder structure, file-wise. Then we might be able to help you more.qmacro
DJ, Thanks for your time. Please find the openui5 source in the GITHUB. I am new to StackOverflow and I do not know how to attach an image in the comments. So I have replied to my own question to attach an image of the folder structure.rajan
Out of all the folders mentioned in the project, I am getting 404 error for json and properties files that are in the folders model and i18n. Is there any specific configuration to be maintained at application level or is it to do anything at domain level? Please help me in finding the solution for the problem. Thanks.rajan

1 Answers

0
votes

Your splitapp_demo/app/Component.js needs to be changes as below:

jQuery.sap.declare("app.Component");
//jQuery.sap.require("app.MyRouter");

sap.ui.core.UIComponent.extend("app.Component", {
    metadata: {
        name: "DEmo App",
        version: "1.0",
        includes: [],
        dependencies: {
            libs: ["sap.m", "sap.ui.layout"], //add any other libraries you need
            components: []
        },

        //rootView : "app.view.App",

        config: {
            resourceBundle: "i18n/i18n.properties",
            //if you have service
            /*serviceConfig : {
                name: "SERVICE_NAME",
                serviceUrl: "/your/service/url/"
            }*/
        },

        routing: {

            routes: [
              //your routes
      ]
        }
    },

    init: function () {
        sap.ui.core.UIComponent.prototype.init.apply(this, arguments);

        var mConfig = this.getMetadata().getConfig();

        // Always use absolute paths relative to our own component
        // (relative paths will fail if running in the Fiori Launchpad)
        var oRootPath = jQuery.sap.getModulePath("app");

        // Set i18n model
        var i18nModel = new sap.ui.model.resource.ResourceModel({
            bundleUrl: [oRootPath, mConfig.resourceBundle].join("/")
        });
        this.setModel(i18nModel, "i18n");

        var sServiceUrl = mConfig.serviceConfig.serviceUrl;

        //This code is only needed for testing the application when there is no local proxy available
        var bIsMocked = jQuery.sap.getUriParameters().get("responderOn") === "true";
        // Start the mock server for the domain model
        if (bIsMocked) {
            this._startMockServer(sServiceUrl);
        }

        // Create and set domain model to the component
        var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, {
            json: true,
            loadMetadataAsync: true
        });

        // if you have static models
        //  var oModel = new sap.ui.model.odata.ODataModel([oRootPath, "model/coffee.json"].join("/"), {json: true,loadMetadataAsync: true});
        this.setModel(oModel);

        // Set device model if needed
        var oDeviceModel = new sap.ui.model.json.JSONModel({
            isTouch: sap.ui.Device.support.touch,
            isNoTouch: !sap.ui.Device.support.touch,
            isPhone: sap.ui.Device.system.phone,
            isNoPhone: !sap.ui.Device.system.phone,
            listMode: sap.ui.Device.system.phone ? "None" : "SingleSelectMaster",
            listItemType: sap.ui.Device.system.phone ? "Active" : "Inactive"
        });
        oDeviceModel.setDefaultBindingMode("OneWay");
        this.setModel(oDeviceModel, "device");

        //this.getRouter().initialize();

    }
});