avatar image
Former Member

Uncaught TypeError: Cannot read property 'initialize' of undefined

Hi,

I have developed UI5 application and deployed into ABAP server.

When I try to run on ABAP server from Eclipse it is giving below error message. It is working fine when I run this application as "Web App Preview".

Please advice.

The error line it is giving is "oRouter.initialize()" in Component.js

Uncaught TypeError: Cannot read property 'initialize' of undefined
    at f.init (Component.js:14)
    at f.constructor (sap-ui-core.js:135)
    at f.constructor (sap-ui-core.js:141)
    at f.constructor (UIComponent.js:6)
    at new f (sap-ui-core.js:135)
    at Object.sap.ui.component (sap-ui-core.js:141)
    at F.a.onBeforeRendering (ComponentContainer.js:6)
    at F.a._callEventHandles (sap-ui-core.js:147)
    at F.a._handleEvent (sap-ui-core.js:147)
    at t (sap-ui-core.js:147)

Component.js code

sap.ui.core.UIComponent.extend("ztest.Component", {
metadata : {
manifest : "json"
},

init : function(){
// call this method of UIComponent and register this component for Routing
sap.ui.core.UIComponent.prototype.init.apply(this, arguments);

var oRouter = this.getRouter();
oRouter.initialize(); //here oRouter is undefined
}
});

manifest.json code

{
"_version": "1.3.0",
"sap.app" : {
"id" : "test",
"dataSources" : {
"testUri" : {
"uri" : "proxy/http/<host>:<port>/sap/opu/odata/SAP/<serv. name>/",
"type" : "OData"
}
}
},
"sap.ui": {
"_version": "1.3.0",
"technology": "UI5",
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
}
},

"sap.ui5" : {
"_version": "1.2.0",
"rootView": {
"viewName": "ztest.view.App",
"type": "XML",
"id": "app"
},
"handleValidation": true,
"autoPrefixId": true,
"dependencies": {
"minUI5Version": "1.34",
"libs": {
"sap.ui.core": {
"minVersion": "1.34.0"
},
"sap.m": {
"minVersion": "1.34.0"
},
"sap.ui.layout": {
"minVersion": "1.34.0"
}
}
},
"models" : {
"" : {
"dataSource" : "testUri"
},
"tiles": {
"type": "sap.ui.model.json.JSONModel",
"uri": "model/tiles.json"
}
},
"routing" : {
"config" : {
"routerClass" : "sap.m.routing.Router",
"viewType" : "XML",
"viewPath" : "ztest.view",
"controlId" : "app",
"controlAggregation" : "pages"
},
"routes" : [
{
"pattern" : "",
"name" : "launchPad",
"target" : "launchpad"
},
{
"pattern" : "ztest",
"name" : "testInput",
"target" : "input"
},
{
"pattern" : "test/{query}",
"name" : "testDisplay",
"target" : "output"
}
],

"targets" : {
"launchpad" : {
"viewName" : "Launchpad",
"viewLevel" : 1
},
"input" : {
"viewName" : "Input",
"viewLevel" : 2
},
"notFound" : {
"viewName" : "NotFound",
"transition" : "show"
},
"output" : {
"viewName" : "Output",
"viewLevel" : 3
}
}
}
}
}
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers

Skip to Content