cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 in web application bundle

Former Member
0 Kudos

I'm currently trying to build a simple web application bundle which makes use of sapui5. My bundle has roughly the following content:

`- META-INF/

    `- MANIFEST.MF

    `- p2.inf

`- WEB-INF/

    `- classes/

    `- lib/

    `- web.xml

`- js/

`- resources/

`- index.html

The WEB-INF/lib folder contains the 13 jars for sapui5 version 1.8.6. The index.html includes the sap bootstrap js  and a local js which builds the shell content. The bootstrapping works but when it comes to the creation of the app specific sapui5 controllers and views I'm getting a browser error saying the resource is not available. On the server the log contains entries like:

javax.naming.NameNotFoundException: Name '/resources/foo/bar/l10n/messagebundle_en.properties' does not exist.

at org.eclipse.gemini.web.tomcat.internal.loading.BundleDirContext.getNamedEntry(BundleDirContext.java:104)

at org.eclipse.gemini.web.tomcat.internal.loading.BundleDirContext.doGetAttributes(BundleDirContext.java:169)

at org.apache.naming.resources.BaseDirContext.getAttributes(BaseDirContext.java:1102)

at org.apache.naming.resources.BaseDirContext.getAttributes(BaseDirContext.java:1055)

at org.apache.naming.resources.ProxyDirContext.cacheLoad(ProxyDirContext.java:1613)

at org.apache.naming.resources.ProxyDirContext.cacheLookup(ProxyDirContext.java:1536)

at org.apache.naming.resources.ProxyDirContext.lookup(ProxyDirContext.java:297)

at org.apache.catalina.core.ApplicationContext.getResource(ApplicationContext.java:536)

at org.apache.catalina.core.ApplicationContextFacade.getResource(ApplicationContextFacade.java:201)

at com.sap.ui5.resource.impl.ServletResourceLocator.findResource(ServletResourceLocator.java:87)

at com.sap.ui5.resource.ResourceServlet.findResource(ResourceServlet.java:603)

at com.sap.ui5.resource.ResourceServlet.findResource(ResourceServlet.java:622)

at com.sap.ui5.resource.ResourceServlet.serveResource(ResourceServlet.java:453)

at com.sap.ui5.resource.ResourceServlet.doGet(ResourceServlet.java:191)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)

at com.sap.security.auth.service.webcontainer.internal.Authenticator.invoke(Authenticator.java:147)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)

at com.sap.core.tenant.valve.TenantValidationValve.invokeNextValve(TenantValidationValve.java:169)

at com.sap.core.tenant.valve.TenantValidationValve.invoke(TenantValidationValve.java:84)

at com.sap.core.js.monitoring.tomcat.valve.RequestTracingValve.invoke(RequestTracingValve.java:27)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:722)|

Any hints someone?

Accepted Solutions (1)

Accepted Solutions (1)

pmuessig
Advisor
Advisor
0 Kudos

Hi Tobias,

do you store the messagebundle_en.properties under resources in your web application? There is a classloading issue with the SAPUI5 resource handler and local resources in case of web application bundles. Therefore the SAPUI5 resource handler only finds the resources coming from the bundle classpath and not from the web context classpath. This issue is known but not so easy to fix - unfortunately...

If you put your code from resources/foo/bar/* under js/foo/bar/* and use the following command to register this path as module path for foo.bar then your code should work:

jQuery.sap.registerModulePath("foo.bar", "./js/foo/bar");

Details about the modularization concept + explanation of the upper code can be found in the UI5 demokit: https://sapui5.netweaver.ondemand.com/sdk/#docs/guide/ModularizationConcept.html

Hope this helps and best regards,

Peter

Former Member
0 Kudos

Hi Peter,

thanks for your explanation. I'm already aware of the local resource registration (see also http://scn.sap.com/thread/3301200). I must confess that I haven't read the sapui5 documentation in depth yet. As you can see in my wab layout I've put the resources into a subfolder of the bundle root. But I only added 'WEB-INF/classes' and 'WEB-INF/lib' to my bundle classpath (not '.'). Maybe I was on a wrong path here because it looks like the resource is loaded from the bundle and not from the classpath in the exception stack trace. I also haven't included the com.sap.ui5.resource.osgi fragment - maybe this also makes a difference? Haven't had the time to check that yet...

Anyway I changed my current setup to load the sapui5 components from the nwc  installation and register local resources. Works like a charm and decreases the size of my wab by some megabytes.

Thanks and best regards,

Tobias

Answers (0)