cancel
Showing results for 
Search instead for 
Did you mean: 

component-preload.js not found (404 not found) In SAP fiori like UI5 APP

Former Member
0 Kudos

HI All,

I am trying to develop a  fiori like UI5 app.

I have placed the component.js file in the same folder as that of index.html

I have read the Documentation from the below sites.

SAPUI5 SDK - Demo Kit

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/8022ac87-1f60-3110-5383-fa68a91d7...

below are the contents of component.js file   (Zgreenfield is my App name , launchdashboard is my initial view)

-----------------------------------------------------------------

jQuery.sap.declare("ZGreenfield.greenfield_refinery.launchdashboard");

sap.ui.core.UIComponent.extend("ZGreenfield.greenfield_refinery.launchdashboard", {

  createContent : function() {

  // create root view

  var oView = sap.ui.view({

  id : "App",

  viewName : "ZGreenfield.greenfield_refinery.launchdashboard",

  type : "JS",

  viewData : { component : this }

  });

  var oModel = new sap.ui.model.json.JSONModel("jsonFiles/.");

  oView.setModel(oModel);

  // done

  return oView;

  }

});

------------------------------------------------------------------


index.html

-------------------------------------------------------------------

<script

  src="resources/sap-ui-core.js" type="text/javascript"

  id="sap-ui-bootstrap"

  data-sap-ui-theme="sap_platinum"

  data-sap-ui-libs="sap.ui.commons,sap.ui.table,sap.suite.ui.commons,sap.viz"

  data-sap-ui-resourceroots='{

  "ZGreenfield": "./"

  }' >

  </script>

  <script>

  app: new sap.ui.core.ComponentContainer({

  name : "ZGreenfield"

  }).placeAt("content");

  </script>

-------------------------------------------------------------------

below is the folder structure of my app


 


below is the error thrown in my browser console.




Please help !!


Many Thanks

Pandu



Tags edited by: Michael Appleby

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member182048
Active Contributor

Hi Pandu

The Component-preload.js file is somewhat of an undocumented feature, currently it is only supported internally or via you own build tool - see grunt-ui5 this has a Component-preload.js feature.


Essentially the component preload concatenates all the files used by the component, that is all the controllers, views, formatters etc into a single file and minifies the js, json and xml code. The idea being that 1 minified file for all you components is loaded a lot quicker than many un-minified files. Its very effective at reducing the loading of applications.


In your case you can ignore this error.


else if it really annoys you set data-sap-ui-preload="" see Preload Variant for Bootstrapping


hth

jsp

Former Member
0 Kudos

Hi John,

Thank you very much for the reply!

I dont have any problem  ignoring this error but the problem is my App is not working at all it is just showing a balnk screen & in the developer console it shows the above error and nothing else.

Many Thanks

Pandu

former_member182048
Active Contributor
0 Kudos

Hi Pandu

Looking at your console log, the second error is your issue "undefined is not a function"

Suggestion

1. run with debug source <ctrl><alt><shift> + p and chose debug sources

2. re-run app and this time expand the console error to see the full stack path - take a screenshot which has better definition and attach to question

Maybe there is an issue on one of your views.

jsp

masa_139
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Pando,

Please take a look SAP Fiori Launchpad for Developers - Architecture Overview about component.js.

Regards, Masa

SAP Customer Experience Group - CEG

Former Member
0 Kudos

Hi John,

I did run the application with Debug Source and below is the screen shot.

if I run my application removing all the configuration i have done to make a fiori like UI5 App my application is working without any issues.

Many Thanks

Pandu

former_member182048
Active Contributor
0 Kudos

looks like it cannot find you component

error gives a good hint, its the name, change code to


jQuery.sap.declare("ZGreenfield.Component");


sap.ui.core.UIComponent.extend("ZGreenfield.Component", {


hth

jsp

Former Member
0 Kudos

Thanks A lot for the help John,


I have changed the Code now & a new error now. i have attached a couple of screen shots please suggest

Many Thanks

Pandu

former_member182048
Active Contributor
0 Kudos

Hi Pandu

Dont worry about the first issue.

Essentially debug mode tries to load the un-minified version of all your SAPUI5 code "-dbg.js"

The second error is basically saying there is some sort of error in your JSView in the createContent method.

Create a GIST for both the jsView and Controller code for LaunchDashboardView and share the link, eg dont past code into a long running thread.

Cheers

JSP

Former Member
0 Kudos

Hi John,

component.js

https://gist.github.com/pandu536/e3d6feb49b8ec9131de8

launchdashboard.view.js

https://gist.github.com/pandu536/89001be32225b1c08638

launchdashboard.controller.js

https://gist.github.com/pandu536/282082378e394146a733

There is nothing written in the controller but i have attached that as well.

Many Thanks

Pandu

former_member182048
Active Contributor
0 Kudos

Hi Pandu

Thanks for creating the gist files, makes it a lot easier

first off some advice - you need to use JSLint with you code, launchdashboard has a lot of global variables, this will cause issues, not sure if related to error though. To fix put 'var' in front of DailyView, MonthlyView, oTab2 and newsView.

Next, if still having issues, try and comment out the how code block createContent in launchdashboard view to see if it is the issue.

jsp

Former Member
0 Kudos

Hi John,

I have edited the code in launchdashboard.view.js as suggested.

https://gist.github.com/pandu536/89001be32225b1c08638\

I am not using sap.m Libraries is that causing the problem ?

I have commented the code  in create content function and tried to run th App it is still showing the same error.

Many Thanks

Pandu

Former Member
0 Kudos

Hi, Masayuki!

Do I understand correctly, that it is possible to implemenent the Component-preload.js ONLY if launching the app from fiori launchpad?

RieSe
Contributor

You can switch the loader off by this URL-Parameter:

sap-ui-xx-componentPreload=off

Best regards, Stefan

faragelfadaly
Explorer
0 Kudos

working fine for me, thank you.