0
votes

For testing an app in my WebIDE I'm planning to use mock data which I have already created. But unfortunately I'm not able to run my app with mock data. I created an index.html according to this file and to this question

But when I start my app I just see a lighter blue background and nothing else. My console is full of errors and he can't find many of the used resources. I'm not using any customized libraries, all things that are used aren't included by me.

These are the errors in the console:

XMLHttpRequest cannot load ComponentBase.js. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'webide-link' is therefore not allowed access. The response had HTTP status code 404.

Uncaught Error: failed to load 'ui/s2p/srm/sourcingcockpit/Component.js' from ./Component.js: Error: failed to load 'sap/ca/scfld/md/ComponentBase.js' from https://openui5.hana.ondemand.com/resources/sap/ca/scfld/md/ComponentBase.js: 0 - NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load

And one error is very strange: The JS-library sinon.js couldn't be found though it's existing.

Update: My index.html (saved in root-dir of the app):

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <title>SAPUI5 App</title>
    <script
        id="sap-ui-bootstrap"
        src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
        data-sap-ui-theme="sap_bluecrystal"
        data-sap-ui-libs="sap.m"
        data-sap-ui-bindingSyntax="complex"
        data-sap-ui-compatVersion="edge"
        data-sap-ui-preload="async"
        data-sap-ui-resourceroots='{
                "namespace": "./"
            }'>
    </script>
    <script>
        sap.ui.getCore().attachInit(function () {
            new sap.m.Shell({
                app: new sap.ui.core.ComponentContainer({
                    name: "namespace"
                })
            }).placeAt("content");
        });
    </script>
</head>
<body class="sapUiBody" id="content">
</body>
</html>

Update 2: I tried to add this content to my neo-app.json, but I don't really know how to format the path to the Component.js

{
        "path": "/Component.js",
        "target": {
            "type": "service",
            "name": "sapui5",
            "entryPath": "/ui/s2p/srm/sourcingcockpit/"
        },
        "description": "Component Resource"
 }

Update 3: I tried to run the app without mock server and I always get the error that the sap-ui-core.js couldn't be found. But when I open the file which couldn't be found with the given link I can see the sap-ui-core.js.

1
Can you add your index.html? - hirse
Sure, I updated my post. - Zumarta

1 Answers

0
votes

From your second error, you can see that it is trying to load ui/s2p/srm/sourcingcockpit/Component.js from the OpenUI5 CDN where it cannot be found.
I am assuming, that file belongs to your app, so you should add the location to the resourceroots.

In the index.html you posted, replace "namespace" with the namespace you are using.